/// <summary> /// A private helper method to check for an IIdentifierContainer's /// VariableIdNode. /// </summary> /// <returns>An IProperty.</returns> /// <param name="node">Node.</param> private IProperty getVariableProperty(IIdentifierContainer node) { // if the variable node is not set, report an error and return // a VoidProperty to signal this one doesn't evaluate if (node.IDNode == null) { analyzer.notifyError(new UninitializedVariableError(node)); return(voidProperty); } VariableIdNode idNode = node.IDNode; // check the evaluation type of the id node IProperty property = idNode.Accept(this.typeChecker).asProperty(); // if it wasn't declared, report an error if (property.GetTokenType() == TokenType.ERROR) { analyzer.notifyError(new UninitializedVariableError(node)); return(voidProperty); } return(property); }
/// <summary> /// Visits the variable identifier node. /// </summary> /// <returns>An ISemanticCheckValue.</returns> /// <param name="node">Node.</param> public ISemanticCheckValue VisitVariableIdNode(VariableIdNode node) { // let the evaluator evaluate this node return(node.Accept(evaluator)); }