示例#1
0
        public override void ValidateSemantic()
        {
            var type = iDNode.EvaluateType();

            if ((!(type is IntType) && !(type is BoolType)))
            {
                throw new SemanticException("Invalid types.");
            }
        }
示例#2
0
        public override void ValidateSemantic()
        {
            var valorType = eValor.EvaluateType();

            if (!SymbolsTable.vars.ContainsKey(id.ToString()))
            {
                SymbolsTable.vars[id.ToString()] = valorType;
                return;
            }
            var nodeType = id.EvaluateType();

            if (valorType.GetType() != nodeType.GetType())
            {
                throw new SemanticException("Incorrect assignation types.");
            }
        }