Exemplo n.º 1
0
 public int RegisterField(FieldInfo info, int type_id)
 {
     int num = this.AppVar();
     this[num].Name = info.Name;
     this[num].Level = type_id;
     this[num].Kind = MemberKind.Field;
     this[num].TypeId = this.RegisterType(info.FieldType, false);
     FieldObject m = new FieldObject(this.scripter, num, type_id);
     if (info.IsPublic)
     {
         m.Modifiers.Add(Modifier.Public);
     }
     if (info.IsStatic)
     {
         m.Modifiers.Add(Modifier.Static);
     }
     m.Imported = true;
     m.Field_Info = info;
     this[num].Val = m;
     ClassObject val = (ClassObject) this[type_id].Val;
     val.AddMember(m);
     m.OwnerType = val.ImportedType;
     return num;
 }
Exemplo n.º 2
0
 private void OperCreateField()
 {
     int num = this.r.arg1;
     int id = this.r.arg2;
     ClassObject classObject = this.GetClassObject(id);
     bool upcase = this.GetUpcase();
     int nameIndex = this.symbol_table[num].NameIndex;
     if (classObject.GetMemberByNameIndex(nameIndex, upcase) != null)
     {
         string name = this.symbol_table[num].Name;
         this.scripter.CreateErrorObjectEx("CS0102. The class '{0}' already contains a definition for '{1}'.", new object[] { classObject.Name, name });
     }
     else
     {
         FieldObject obj4 = new FieldObject(this.scripter, num, id);
         obj4.PCodeLine = this.n;
         this.PutVal(num, obj4);
         classObject.AddMember(obj4);
         this.n++;
     }
 }