//TODO UNDERSTAND
 public void Visit(AritmethicNode node)
 {
     Visit(node as BinaryNode);
     if (object_return_type)
     {
         Code.Add(new AssignStrToVarCodeLine(return_type, "Int"));
     }
 }
示例#2
0
        //faltan poner los scope
        public void Visit(AritmethicNode node)
        {
            node.Rigthexpr.Accept(this);
            node.Leftexpr.Accept(this);

            if (node.Leftexpr.staticType.Text != node.Rigthexpr.staticType.Text)
            {
                errors.Add(ErrorSemantic.InvalidUseOfOperator(node, node.Leftexpr.staticType, node.Rigthexpr.staticType));
            }

            else if (node.Leftexpr.staticType.Text != "Int" || node.Rigthexpr.staticType.Text != "Int")
            {
                errors.Add(ErrorSemantic.InvalidUseOfOperator(node));
            }

            else if (!scope.IsDefinedType("Int", out node.staticType))
            {
                errors.Add(ErrorSemantic.NotDeclaredType(new TypeNode(node.line, node.column, "Int")));
            }
        }
示例#3
0
 public static string InvalidUseOfOperator(AritmethicNode node)
 {
     return($"(line: {node.line}, column: {node.column})" +
            $" El operador '{node.Operator}' no se puede aplicar a 'Int'."
            );
 }
 public void Visit(AritmethicNode node)
 {
     throw new NotImplementedException();
 }