Exemplo n.º 1
0
        private void FinishType(AbcInstance instance)
        {
            //TODO: Comment when copying of value types will be implemented using Reflection
            CopyImpl.Copy(instance);

            BuildCompiledMethods(instance);
        }
Exemplo n.º 2
0
        private AbcMethod GetUnboxMethod(IType elemType)
        {
            var m = _generator.Boxing.Unbox(elemType, false);

            if (m != null)
            {
                return(m);
            }
            return(CopyImpl.StaticCopy(_generator, elemType));
        }
Exemplo n.º 3
0
        private void InitTypeFuncs(AbcCode code, IType type, AbcInstance instance)
        {
            var f = _generator.Boxing.Box(type);

            if (f != null)
            {
                code.GetLocal(varType);
                code.GetStaticFunction(f);
                code.SetProperty(Const.Type.BoxFunction);
            }

            f = _generator.Boxing.Unbox(type, false);
            if (f != null)
            {
                code.GetLocal(varType);
                code.GetStaticFunction(f);
                code.SetProperty(Const.Type.UnboxFunction);
            }

            f = CopyImpl.StaticCopy(instance);
            if (f != null)
            {
                code.GetLocal(varType);
                code.GetStaticFunction(f);
                code.SetProperty(Const.Type.CopyFunction);
            }

            var ctor = type.FindParameterlessConstructor();

            if (ctor != null)
            {
                f = _generator.MethodBuilder.Build(ctor) as AbcMethod;
                if (f != null && !f.IsInitializer)
                {
                    f = _generator.TypeBuilder.DefineCtorStaticCall(ctor);
                    Debug.Assert(f != null);
                    code.GetLocal(varType);
                    code.GetStaticFunction(f);
                    code.SetProperty(Const.Type.CreateFunction);
                }
            }
        }