Ejemplo n.º 1
0
        public override void CheckSemantics(TigerScope scope, Report report)
        {
            ContainingScope = scope;

            //Create new scope
            var childScope = new TigerScope(scope, "Let");

            //Check children
            DeclarationListNode.CheckSemantics(childScope, report);
            InstructionSequenceNode.CheckSemantics(childScope, report);

            if (!DeclarationListNode.IsOK || !InstructionSequenceNode.IsOK)
            {
                return;
            }

            TigerType = InstructionSequenceNode.TigerType;

            //Check return type

            if (!childScope.ValidReturnType(TigerType))
            {
                report.AddError(SemanticErrors.InvalidReturnType(this, TigerType));
            }
        }