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

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

            if (!IdNode.IsOK || !TypeNode.IsOK)
            {
                return;
            }

            //Check use of variable name
            if (!scope.VariableNameAvailable(IdNode.Name))
            {
                report.AddError(SemanticErrors.RepeatedParameterName(IdNode, IdNode.Name));
                return;
            }

            //Add variable to scope
            VariableInfo = scope.DefineVariable(IdNode.Name, TypeNode.TigerType, scope);
            TigerType    = TypeNode.TigerType;
        }