Example #1
0
        //for type checking of the case labels to work, the type of expression used above needs to be passed down to the switch blocks.

        public override void TypeCheck()
        {
            this.expression.TypeCheck();

            if (!expression.type.isTheSameAs(new NamedType("INT")))
            {
                System.Console.WriteLine("Type error in SwitchStatement\n");
                throw new Exception("TypeCheck error");
            }

            foreach (SwitchBlockGroup Blk in block)
            {
                Blk.setswichExprType(expression.type);
                Blk.TypeCheck();
            }
        }