예제 #1
0
        public override void CheckSemantics(TigerScope scope, Report report)
        {
            ContainingScope = scope;

            //Check children
            IdNode.CheckSemantics(scope, report);

            if (!IdNode.IsOK)
            {
                return;
            }

            //Check variable existence
            VariableInfo = scope.FindVariable(IdNode.Name);

            if (VariableInfo == null)
            {
                report.AddError(SemanticErrors.NonExistentVariableReference(IdNode, IdNode.Name));
            }
            else
            {
                TigerType = VariableInfo.TigerType;
            }
        }