AS3 コードから Tamarin の ESC コンパイラを呼び出そうとしています。ESC コンパイラーのバイトコードを Flash Player にロードしましたが、それを呼び出すと、どんなソースコードをフィードしても、ESC コンパイラーは常に同じ何もしないバイトコードを返します。人間が読める ESC コードは次のようになります。
function compileStringToBytes(input, context="(string)", start_line=1) {
let [_,_,res] = compile( (function () input),
(function (abc) abc.getBytes()),
context,
start_line );
return res;
}
次の AS3 コードを使用して呼び出しています。
var compile:Function = getDefinitionByName("ESC::compileStringToBytes") as Function;
var array:ByteArray = compile( function():String { return "trace(\"hi\");" },
"test" );
しかし、どのソース コードをフィードしても、常に 2 つの関数のバイト コードが返されます。一方が他方を呼び出し、どちらの関数も何も実行しません。
これは、返されるバイト コードです (メタデータは取り除かれ、人間が読める形式に変換されます)。
script0
const <#internal test>::internal:Namespace = <#internal test> /* slot_id 0 */
const <#internal test>::public:Namespace = /* slot_id 0 */
var Function:* /* slot_id 0 */
function script0$init():* /* disp_id 0*/
{
// local_count=2 max_scope=1 max_stack=2 code_len=11
0 getlocal0
1 pushscope
2 findpropstrict Function
4 newfunction function ():* /* disp_id 0*/
6 setproperty Function
8 getlocal1
9 returnvalue
10 returnvoid
}
function ():* /* disp_id 0*/
{
// local_count=1 max_scope=0 max_stack=0 code_len=1
0 returnvoid
}
前もって感謝します!これが筋金入りの質問であることは承知していますが、筋金入りのコーダーがそれに光を当ててくれることを願っています!