/// <summary> /// Add unknown-type declarations /// </summary> public void AddDecls(DeclarationList fs, Scope s = 0) { if (fs == null) { return; } if (s != 0) { foreach (IScopedDeclaration d in fs) { d.SetScope(s); } } foreach (var d in fs) { if (d is MethodDeclaration) { decls.Add(d); } else if (d is PropertyDeclaration) // a property is a field too { properties.Add(d); } else if (d is FieldDeclaration) // a property is a field too { fields.Add(d); } else { ErrorInternal("Unknown Declaration in ObjectSection AddDecls"); } } }
public ArrayProperty(String ident, TypeNode type, DeclarationList indexes, PropertySpecifiers specs, bool def) : base(ident, type, specs) { this.indexes = indexes; this.specifiers = specs; this.isDefault = def; }
public VariantDeclaration(String id, VariableType t, DeclarationList varfields) : base(id, t) { // TODO /// if (!(t is IOrdinalType)) // throw new TypeRequiredException("Ordinal"); this.varfields = varfields; }
public ParametersSection(DeclarationList decls = null) : base(decls) { returnVar = null; if (decls == null) { decls = new DeclarationList(); } }
public void AddProperties(DeclarationList fs, Scope s) { if (fs != null) { foreach (PropertyDeclaration d in fs) { d.SetScope(s); } } properties.Add(fs); }
public void AddFields(DeclarationList fs, Scope s) { if (fs != null) { foreach (FieldDeclaration d in fs) { d.SetScope(s); } } fields.Add(fs); }
public void AddMethods(DeclarationList fs, Scope s) { if (fs != null) { foreach (MethodDeclaration d in fs) { d.SetScope(s); } } decls.Add(fs); }
public Section(DeclarationList dls) { decls = dls; if (decls == null) { decls = new DeclarationList(); } else { foreach (var d in decls) { if (d is CallableDeclaration) { (d as CallableDeclaration).declaringSection = this; } } } }
// Kept in the baseclass, 'decls' list // public DeclarationList methods; public ObjectSection(DeclarationList fs = null, DeclarationList ds = null, Scope s = Scope.Published) : base(new DeclarationList()) { fields = fs; if (fields == null) { fields = new DeclarationList(); } properties = new DeclarationList(); AddDecls(ds, s); // methods and properties if (Enum.IsDefined(typeof(Scope), s)) { foreach (FieldDeclaration d in fields) { d.SetScope(s); } } }
public TopLevelDeclarationSection(NodeList uses, DeclarationList decls) : base(decls) { this.uses = uses; }
public ImplementationSection(NodeList uses, DeclarationList decls) : base(uses, decls) { }
public ProgramSection(NodeList uses, DeclarationList decls, BlockStatement code) : base(uses, decls) { this.block = code; }
public RecordType(DeclarationList compTypes) { this.compTypes = compTypes; }
public VarEntryDeclaration(Expression tagvalue, DeclarationList fields) : base(null, null) // type must be later set to the variant type { this.tagvalue = tagvalue; this.fields = new RecordType(fields); }
public VariantDeclaration(String id, RangeType t, DeclarationList varfields) : this(id, (VariableType)t, varfields) { }
public InterfaceSection(NodeList uses, DeclarationList decls) : base(uses, decls) { }
public Section() { decls = new DeclarationList(); }
public LibraryNode(String name, NodeList uses, DeclarationList decls, BlockStatement body) : base((name == null)? "$untitled$" : name) { section = new ProgramSection(uses, decls, body); }
public RoutineSection(DeclarationList decls, Statement block) : base(decls) { this.block = block; }