public Function(BaseStructure Base, bool asConstructor) : base(Base.Name, Base.Modifiers, Base.AccessModifier, Base.Childs) { Directive = Base.Directive; CompileCache.UnknownLabelNameErrorList = new List <ConstantErrorMark>(); CompileCache.Variables = new List <VariableMark>(); CompileCache.NamedConsts = new List <ConstantMark>(); Parameters = new List <FunctionParameter>(); if (asConstructor) { Target = RuleTarget.Constructor; IsConstuctor = true; } else { Target = RuleTarget.Method; Modifier retModifier = GetModifier(ReturnKeyword); if (retModifier.Value == NoReturnableValueKeyword) { RetType = TypeReference.Void; HasNoRetValue = true; } else { RetType = new TypeReference(retModifier.Value, null); } if (GetModifier(OverrideKeyword) != null) { IsStatic = true; } if (GetModifier(VirtualKeyword) != null) { IsStatic = true; } if (GetModifier(StaticKeyword) != null) { IsStatic = true; } if (GetModifier(EntryPointKeyword) != null) { IsEntryPoint = true; } } foreach (var parameter in Modifiers.FindAll(p => p.Name == ParameterKeyword)) { var parts = parameter.Value.Split(':'); var type = parts[0]; var name = parts[1]; Parameters.Add(new FunctionParameter( new TypeReference(type, null), name)); } }
public Field(BaseStructure Base) : base(Base.Name, Base.Modifiers, Base.AccessModifier, Base.Childs) { Target = RuleTarget.Field; Directive = Base.Directive; Modifier type = GetModifier(TypeKeyword); Type = new TypeReference(type.Value, null); IsStatic = GetModifier(StaticKeyword) != null; }
public Assembly(BaseStructure Base) : base(Base.Name, Base.Modifiers, Base.AccessModifier, Base.Childs) { UsedTypes = new List <TypeReference>(); Classes = new List <Class>(); ParentAssembly = null; Target = RuleTarget.Assembly; Directive = Base.Directive; SetParentAssembly(Base.Childs); foreach (var item in Base.Childs) { Classes.Add(item as Class); } }
public Class(BaseStructure Base) : base(Base.Name, Base.Modifiers, Base.AccessModifier, Base.Childs) { Extends = new List <Class>(); StaticFields = new Dictionary <int, Object>(); Target = RuleTarget.Class; Directive = Base.Directive; Constructors = new List <Function>(); InnerClasses = new List <Class>(); Functions = new List <Function>(); Fields = new List <Field>(); foreach (var child in Base.Childs) { switch (child.Target) { case RuleTarget.Class: (child as Class).IsInner = true; (child as Class).InnerParent = this; InnerClasses.Add(child as Class); break; case RuleTarget.Method: (child as Function).BaseClass = this; Functions.Add(child as Function); break; case RuleTarget.Field: { Field field = child as Field; field.BaseClass = this; Fields.Add(child as Field); } break; case RuleTarget.Constructor: (child as Function).BaseClass = this; (child as Function).RetType = new TypeReference(this, null); Constructors.Add(child as Function); break; default: break; } } }
public Function(BaseStructure Base) : this(Base, false) { }