Descriptor for a field of a class
Inheritance: Member
Esempio n. 1
0
 private void storeMixinStatic()
 {
     // mixin fields route to implementation class
     FPod.NField   f     = pod.nfield(u2(), false);
     PERWAPI.Field field = emitter.findField(f.parentType + "_", f.fieldName, f.fieldType);
     code.FieldInst(FieldOp.stsfld, field);
 }
Esempio n. 2
0
        private void loadStr()
        {
            int index = u2();

            PERWAPI.Field field = emitter.findField(podClass, "S" + index, "System.String");
            code.FieldInst(FieldOp.ldsfld, field);
        }
Esempio n. 3
0
        private void loadType(FTypeRef tref)
        {
            string podName  = tref.podName;
            string typeName = tref.typeName;

            // if pod is "sys", then we can perform a shortcut and use
            // one of the predefined fields in Sys
            if (!tref.isGenericInstance() && podName == "sys")
            {
                PERWAPI.Field field = emitter.findField("Fan.Sys.Sys", typeName + "Type", "Fan.Sys.Type");
                code.FieldInst(FieldOp.ldsfld, field);
                if (tref.isNullable())
                {
                    typeToNullable();
                }
                return;
            }

            // lazy allocate my parent's type literal map: sig -> fieldName
            if (parent.typeLiteralFields == null)
            {
                parent.typeLiteralFields = new Hashtable();
            }
            Hashtable map = parent.typeLiteralFields;

            // types are lazy loaded and then cached in a private static field called
            // type$literal$count which will get generated by FTypeEmit (we keep track of signature
            // to fieldname in the typeConstFields map)
            string sig       = tref.signature;
            string fieldName = (string)map[sig];

            if (fieldName == null)
            {
                fieldName = "type$literal$" + map.Count;
                map[sig]  = fieldName;
            }
            //int fieldRef = emit.field(parent.className + "." + fieldName + ":Lfan/sys/Type;");

            //code.op2(GETSTATIC, fieldRef);
            //code.op(DUP);
            //int nonNull = code.branch(IFNONNULL);
            //code.op(POP);
            //code.op2(LDC_W, emit.strConst(sig));
            //code.op(ICONST_1);
            //code.op2(INVOKESTATIC, parent.sysFindType());
            //code.op(DUP);
            //code.op2(PUTSTATIC, fieldRef);
            //code.mark(nonNull);

            //emitter.EmitField(string name, string type, FieldAttr attr)
            //PERWAPI.Field field = emitter.EmitField("Fan.Sys.Sys", typeName + "Type", "Fan.Sys.Type");
            //code.FieldInst(FieldOp.ldsfld, field);

            // TODO - store in static field (all that crap above this)
            code.ldstr(sig);
            Method method = emitter.findMethod("Fan.Sys.Type", "find",
                                               new string[] { "System.String" }, "Fan.Sys.Type");

            code.MethInst(MethodOp.call, method);
        }
Esempio n. 4
0
        private void loadDuration()
        {
            int index = u2();

            PERWAPI.Field field = emitter.findField(podClass, "Dur" + index, "Fan.Sys.Duration");
            code.FieldInst(FieldOp.ldsfld, field);
        }
Esempio n. 5
0
        private void loadFloat()
        {
            int index = u2();

            PERWAPI.Field field = emitter.findField(podClass, "F" + index, "System.Double");
            code.FieldInst(FieldOp.ldsfld, field);
        }
Esempio n. 6
0
        private void loadDecimal()
        {
            int index = u2();

            PERWAPI.Field field = emitter.findField(podClass, "D" + index, "Fan.Sys.BigDecimal");
            code.FieldInst(FieldOp.ldsfld, field);
        }
Esempio n. 7
0
        private void loadUri()
        {
            int index = u2();

            PERWAPI.Field field = emitter.findField(podClass, "U" + index, "Fan.Sys.Uri");
            code.FieldInst(FieldOp.ldsfld, field);
        }
Esempio n. 8
0
        internal PERWAPI.PEFile GenerateCode(Field CurrentRubyClass)
        {
            CodeGenContext context = new CodeGenContext();
            context.CurrentRubyClass = CurrentRubyClass;

            string name = "Eval_" + System.Guid.NewGuid().ToString("N");

            context.CreateAssembly("./", name + ".dll", name, false);

            GenerateClassForMethod(context);
                      
            return context.Assembly;
        }
        internal CodeGenContext(CodeGenContext context) {
            this.Assembly = context.Assembly;
            this.Method = context.Method;
            this.CLRLocals = context.CLRLocals;
            this.labels = context.labels;
            this.CurrentRubyClass = context.CurrentRubyClass;

            this.orig_func = context.orig_func;                 // BBTAG
            this.orig_func_formals = context.orig_func_formals; // BBTAG
            this.currentSkeleton = context.currentSkeleton;     // BBTAG
            this.postPassList = context.postPassList;           // BBTAG
            this.peFiles = context.peFiles;                     // BBTAG
        }
Esempio n. 10
0
 internal void AddToFieldList(Field f)
 {
     f.SetParent(this);
     fields.Add(f);
 }
Esempio n. 11
0
 /// <summary>
 /// Add an instruction with a field parameter
 /// </summary>
 /// <param name="inst">the CIL instruction</param>
 /// <param name="f">the field parameter</param>
 public void FieldInst(FieldOp inst, Field f)
 {
     Debug.Assert(f != null);
     if (f is FieldDef)
         if (((FieldDef)f).GetScope() != thisMeth.GetScope())
             throw new DescriptorException();
     AddToBuffer(new FieldInstr(inst,f));
 }
Esempio n. 12
0
 private void storeStatic()
 {
     FPod.NField   f     = pod.nfield(u2(), false);
     PERWAPI.Field field = emitter.findField(f.parentType, f.fieldName, f.fieldType);
     code.FieldInst(FieldOp.stsfld, field);
 }
Esempio n. 13
0
        //////////////////////////////////////////////////////////////////////////
        // Field
        //////////////////////////////////////////////////////////////////////////

        private void loadInstance()
        {
            FPod.NField   f     = pod.nfield(u2(), false);
            PERWAPI.Field field = emitter.findField(f.parentType, f.fieldName, f.fieldType);
            code.FieldInst(FieldOp.ldfld, field);
        }
Esempio n. 14
0
 internal void stsfld(Field field) {
     buffer.FieldInst(FieldOp.stsfld, field);
 }
 internal StaticField(Field field, YYLTYPE location)
     : base(location)
 {
     this.field = field;
 }
Esempio n. 16
0
 /*-------------------- Constructors ---------------------------------*/
 public FieldInstr(FieldOp inst, Field f)
     : base((uint)inst)
 {
     field = f;
     size += 4;
 }
Esempio n. 17
0
 public void SetField(Field fld)
 {
     field = fld;
 }
Esempio n. 18
0
 internal void ldsfld(Field field) {
     buffer.FieldInst(FieldOp.ldsfld, field);
 }