//TODO : add resolution to object members as well public override bool VisitIdentifierOperand(QuestScriptParser.IdentifierOperandContext context) { //if the parent is RValue -> it is an identifier that is part of an expression, and not a statement if (context.HasParentOfType <QuestScriptParser.RValueContext>() && !_current.IsVariableDefined(context.GetText())) { RecordErrorIfUndefined(context, context.GetText()); } return(base.VisitIdentifierOperand(context)); }
public override ObjectType VisitIdentifierOperand(QuestScriptParser.IdentifierOperandContext context) { //this is either an object or a variable identifier. var identifier = context.GetText(); var variable = _scriptEnvironmentBuilder.GetVariableFromCurrentEnvironment(identifier); if (variable != null) //so this is variable... { return(variable.Type); } //TODO: add here the resolving types of an object if identifier is an object (which are global in Quest) return(base.VisitIdentifierOperand(context)); }
public override Lazy <object> VisitIdentifierOperand(QuestScriptParser.IdentifierOperandContext context) { return(new Lazy <object>(() => { var variable = _scriptEnvironmentBuilder.GetVariableFromCurrentEnvironment(context.GetText()); return variable != null ? variable.Value : null; })); }