public override Node VisitIdentifierExpression(DustParser.IdentifierExpressionContext context) { string name = context.GetText(); IdentifierExpression property = visitorContext.GetProperty(name); Function function = visitorContext.GetFunction(name); if (property == null && function == null) { visitorContext.ErrorHandler.ThrowError(new SyntaxError($"Identifier '{name}' is not defined", context.GetRange())); return(null); } if (property == null) { return(function); } return(property); }
public IdentifierExpression GetProperty(string name) { return(Properties.Get(element => element.Name == name) ?? parent?.GetProperty(name)); }