private ElementScope CreateInterfaceProperty(string name, int offset) { ElementScope prop = members[offset] as ElementScope; if (prop != null) { return(prop); } int name_ref = br.ReadInt32(); TypeScope type = GetTypeReference(); if (br.ReadByte() == 1) { br.ReadInt32(); } if (br.ReadByte() == 1) { br.ReadInt32(); } int num = br.ReadInt32(); List <ElementScope> prms = new List <ElementScope>(); for (int i = 0; i < num; i++) { prms.Add(GetParameter(null)); } br.ReadInt32(); PascalABCCompiler.SemanticTree.field_access_level fal = (PascalABCCompiler.SemanticTree.field_access_level)br.ReadByte(); PascalABCCompiler.SemanticTree.polymorphic_state ps = (PascalABCCompiler.SemanticTree.polymorphic_state)br.ReadByte(); //ReadDebugInfo(); prop = new ElementScope(new SymInfo(name, SymbolKind.Property, name), type, cur_scope); prop.declaringUnit = root_scope; switch (fal) { case PascalABCCompiler.SemanticTree.field_access_level.fal_internal: prop.acc_mod = access_modifer.internal_modifer; break; case PascalABCCompiler.SemanticTree.field_access_level.fal_private: prop.acc_mod = access_modifer.private_modifer; return(null); case PascalABCCompiler.SemanticTree.field_access_level.fal_protected: prop.acc_mod = access_modifer.protected_modifer; break; case PascalABCCompiler.SemanticTree.field_access_level.fal_public: prop.acc_mod = access_modifer.public_modifer; break; } switch (ps) { case PascalABCCompiler.SemanticTree.polymorphic_state.ps_static: prop.is_static = true; break; case PascalABCCompiler.SemanticTree.polymorphic_state.ps_virtual: prop.is_virtual = true; break; } //members[offset] = prop; AddMember(prop, offset); return(prop); }
private ElementScope CreateInterfaceClassField(string name, int offset) { ElementScope field = members[offset] as ElementScope; if (field != null) { return(field); } int name_off = br.ReadInt32(); TypeScope type = GetTypeReference(); field = new ElementScope(new SymInfo(name, SymbolKind.Field, name), type, cur_scope); field.declaringUnit = root_scope; AddMember(field, offset); object initv = null; if (CanReadObject()) { initv = CreateExpression(); } br.ReadInt32(); PascalABCCompiler.SemanticTree.field_access_level fal = (PascalABCCompiler.SemanticTree.field_access_level)br.ReadByte(); PascalABCCompiler.SemanticTree.polymorphic_state ps = (PascalABCCompiler.SemanticTree.polymorphic_state)br.ReadByte(); switch (fal) { case PascalABCCompiler.SemanticTree.field_access_level.fal_internal: field.acc_mod = access_modifer.internal_modifer; break; case PascalABCCompiler.SemanticTree.field_access_level.fal_private: field.acc_mod = access_modifer.private_modifer; return(null); case PascalABCCompiler.SemanticTree.field_access_level.fal_protected: field.acc_mod = access_modifer.protected_modifer; break; case PascalABCCompiler.SemanticTree.field_access_level.fal_public: field.acc_mod = access_modifer.public_modifer; break; } switch (ps) { case PascalABCCompiler.SemanticTree.polymorphic_state.ps_static: field.is_static = true; break; case PascalABCCompiler.SemanticTree.polymorphic_state.ps_virtual: field.is_virtual = true; break; } //field = new class_field(name,type,cont,ps,fal,loc); field.cnst_val = initv; //members[offset] = field; AddMember(field, offset); return(field); }
private ProcScope CreateInterfaceMethod(string name, int offset) { ProcScope cmn = members[offset] as ProcScope; if (cmn != null) { return(cmn); } cmn = new ProcScope(name, cur_scope); cmn.declaringUnit = root_scope; //members[offset] = cmn; AddMember(cmn, offset); int name_ref = br.ReadInt32(); br.ReadByte(); br.ReadByte(); bool is_generic = br.ReadBoolean(); if (is_generic) { throw new NotSupportedException(); } //ssyy //\ssyy if (br.ReadByte() == 1) //return_value_type { cmn.return_type = GetTypeReference(); if (br.ReadByte() == 1) { GetLocalVariable(cmn); } } int num_par = br.ReadInt32(); for (int i = 0; i < num_par; i++) { cmn.parameters.Add(GetParameter(cmn)); } br.ReadInt32(); br.ReadInt32(); cmn.is_constructor = br.ReadBoolean(); cmn.is_forward = br.ReadBoolean(); br.ReadBoolean(); PascalABCCompiler.SemanticTree.field_access_level fal = (PascalABCCompiler.SemanticTree.field_access_level)br.ReadByte(); PascalABCCompiler.SemanticTree.polymorphic_state ps = (PascalABCCompiler.SemanticTree.polymorphic_state)br.ReadByte(); switch (fal) { case PascalABCCompiler.SemanticTree.field_access_level.fal_internal: cmn.acc_mod = access_modifer.internal_modifer; break; case PascalABCCompiler.SemanticTree.field_access_level.fal_private: cmn.acc_mod = access_modifer.private_modifer; return(null); case PascalABCCompiler.SemanticTree.field_access_level.fal_protected: cmn.acc_mod = access_modifer.protected_modifer; break; case PascalABCCompiler.SemanticTree.field_access_level.fal_public: cmn.acc_mod = access_modifer.public_modifer; break; } switch (ps) { case PascalABCCompiler.SemanticTree.polymorphic_state.ps_static: cmn.is_static = true; break; case PascalABCCompiler.SemanticTree.polymorphic_state.ps_virtual: cmn.is_virtual = true; break; } br.ReadInt32(); br.ReadInt32(); cmn.is_override = br.ReadBoolean() == true; cmn.Complete(); return(cmn); }