Exemplo n.º 1
0
        public AbcMethod Exit()
        {
            var instance = _generator.Corlib.Environment.Instance;

            return(instance.DefineMethod(
                       Sig.@static("exit_impl", AvmTypeCode.Void, AvmTypeCode.Int32, "exitCode"),
                       code =>
            {
                var isFlash = IsFlashPlayer();
                code.Getlex(isFlash);
                code.Call(isFlash);
                var ifNotFlash = code.IfFalse();

                var ns = Abc.DefinePackage("avmplus");
                var mn = Abc.DefineQName(ns, "System");
                code.Getlex(mn);
                mn = Abc.DefineQName(ns, "exit");
                code.GetLocal(1);                                 //exitCode
                code.Call(mn, 1);
                code.ReturnVoid();

                ifNotFlash.BranchTarget = code.Label();

                ns = Abc.DefinePackage("flash.System");
                mn = Abc.DefineQName(ns, "System");
                code.Getlex(mn);
                mn = Abc.DefineQName(ns, "exit");
                code.GetLocal(1);                                 //exitCode
                code.Add(InstructionCode.Coerce_u);               //???
                code.Call(mn, 1);
                code.ReturnVoid();
            }));
        }
Exemplo n.º 2
0
        public AbcMultiname DefinePrivateName(string name)
        {
            var ns = GetPrivateNamespace();

            return(Abc.DefineQName(ns, name));
        }