public void GetComponents(VariableComponentCollection componentCollection) { // Add attribute components. AttributesGetter.GetAttributes(ParseInfo.Script.Diagnostics, _defineContext.Attributes, componentCollection); // Add workshop ID if (_defineContext.ID) { componentCollection.AddComponent(new WorkshopIndexComponent(int.Parse(_defineContext.ID.Text), _defineContext.ID.Range)); } // Extended collection if (_defineContext.Extended) { componentCollection.AddComponent(new ExtendedCollectionComponent(_defineContext.Range)); } // Initial value if (_defineContext.InitialValue != null) { componentCollection.AddComponent(new InitialValueComponent(_defineContext.InitialValue)); } // Macro if (_defineContext.MacroSymbol) { componentCollection.AddComponent(new MacroComponent(_defineContext.MacroSymbol.Range)); } }
public Var GetVar() { _parseInfo = _contextHandler.ParseInfo; _diagnostics = _parseInfo.Script.Diagnostics; _nameRange = _contextHandler.GetNameRange(); _name = _contextHandler.GetName() ?? "?"; // Get then check components. ComponentCollection = new VariableComponentCollection(_diagnostics); _contextHandler.GetComponents(ComponentCollection); CheckComponents(); ComponentCollection.FinishedObtainingComponents(); _scope = _scopeHandler.GetScope(ComponentCollection.IsAttribute(AttributeType.Static)); // Create the varinfo. _varInfo = new VarInfo(_name, _contextHandler.GetDefineLocation(), _parseInfo); _varInfo.Scope = _scope; // Get the variable type. _typeRange = _contextHandler.GetTypeRange(); GetCodeType(); // Get the variable being overriden. GetOverridenVariable(); // If the type of the variable is PortableLambdaType, set the TokenType to Function if (_varInfo.Type is Lambda.PortableLambdaType) { _varInfo.TokenType = SemanticTokenType.Function; } // Apply attributes. ComponentCollection.Apply(_varInfo); Apply(); TypeCheck(); _varInfo.Recursive = IsRecursive(); // Get the resulting variable. var result = new Var(_varInfo); // Add the variable to the operational scope. if (_nameRange != null) { _scopeHandler.CheckConflict(_parseInfo, new(_name), _nameRange); } _scopeHandler.Add(result.GetDefaultInstance(_scopeHandler.DefinedIn()), ComponentCollection.IsAttribute(AttributeType.Static)); // Done return(result); }
public void GetComponents(VariableComponentCollection componentCollection) { }
public void GetComponents(VariableComponentCollection componentCollection) { componentCollection.AddComponent(new InitialValueComponent(_context.Value)); }