Example #1
0
        private void InitSlotPtr(AbcCode code, VarPtr ptr)
        {
            GetActivation(code);
            if (AbcGenConfig.UseActivationTraits)
            {
                switch (ptr.Ptr.PtrKind)
                {
                case PointerKind.SlotPtr:
                    code.CreateSlotPtr(ptr.Ptr, _activationVar);
                    break;

                case PointerKind.PropertyPtr:
                    code.CreatePropertyPtr(ptr.Slot.Name, () => GetActivation(code));
                    break;

                case PointerKind.FuncPtr:
                    code.CreateFuncPtr(ptr.Slot);
                    break;
                }
            }
            else
            {
                code.Getlex(ptr.Ptr.SlotType);
                GetActivation(code);
                code.Construct(1);
            }
            code.SetSlot(ptr.Ptr);
        }
Example #2
0
        private void NewObject(AbcCode code, IMethod method)
        {
            var type = method.DeclaringType;

            var abcMethod = method.AbcMethod();

            if (abcMethod != null)
            {
                if (abcMethod.IsInitializer) //default ctor!
                {
                    if (type.Is(AvmTypeCode.Object))
                    {
                        code.NewObject(0);
                    }
                    else
                    {
                        code.Construct(method.Parameters.Count);
                    }
                    return;
                }

                if (type.Is(SystemTypeCode.String))
                {
                    code.Call(abcMethod);
                    return;
                }

                var ctor = _generator.TypeBuilder.DefineCtorStaticCall(method);
                code.Call(ctor);
            }
            else
            {
                throw new NotImplementedException();
            }
        }
Example #3
0
        public static void Ctor(IMethod method, AbcCode code)
        {
            var vec = method.DeclaringType.Data as IVectorType;

            if (vec == null)
            {
                throw new InvalidOperationException();
            }
            code.Construct(method.Parameters.Count);
            code.Coerce(vec.Name);
        }
Example #4
0
 public static void NewArray(IMethod method, AbcCode code)
 {
     if (method.Parameters.Count == 1)
     {
         //size is onto the stack
         code.Getlex(AvmTypeCode.Array);
         code.Swap();
         code.Construct(1);
         code.CoerceArray();
         return;
     }
     code.Add(InstructionCode.Newarray, 0);
 }
Example #5
0
 public static void CreateInstance(IMethod method, AbcCode code)
 {
     code.Construct(method.Parameters.Count);
 }
Example #6
0
 public static void Ctor(IMethod method, AbcCode code)
 {
     code.Construct(method.Parameters.Count);
 }
Example #7
0
 public static void Ctor(AbcCode code)
 {
     code.Construct(0);
 }