@@ -123,7 +123,7 @@ truncateType(std::string fulltype)
123123
124124// given a primary, determine its type
125125std::string
126- TypeChecker::expressionHelper (ast::Expression* node)
126+ TypeChecker::getType (ast::Expression* node)
127127{
128128 switch (node->getExpressionType ())
129129 {
@@ -146,7 +146,7 @@ TypeChecker::expressionHelper(ast::Expression* node)
146146 for (ast::UDTitem* const & item : udt->getAttributes ())
147147 {
148148 fullTypeName += " $" + item->getKey ()->getValue () + " $" +
149- primaryHelper (item->getValue ());
149+ getType (item->getValue ());
150150 }
151151
152152 return fullTypeName;
@@ -160,7 +160,7 @@ TypeChecker::expressionHelper(ast::Expression* node)
160160 ast::PrimaryExpression* subnode =
161161 dynamic_cast <ast::PrimaryExpression*>(node);
162162
163- return primaryHelper (subnode->getPrimary ());
163+ return getType (subnode->getPrimary ());
164164 }
165165 case ast::Expression::UnaryExpression:
166166 return " bool" ;
@@ -169,7 +169,7 @@ TypeChecker::expressionHelper(ast::Expression* node)
169169
170170// given a primary, determine the type
171171std::string
172- TypeChecker::primaryHelper (ast::Primary* primary)
172+ TypeChecker::getType (ast::Primary* primary)
173173{
174174 ast::Primary::PrimaryType type = primary->getPrimaryType ();
175175
@@ -378,7 +378,7 @@ TypeChecker::compareFunctions(std::vector<std::string> inputs,
378378 for (int i = 0 ; i < numArgs; i++)
379379 {
380380 ast::Primary* arg = args.at (i);
381- std::string actual = primaryHelper (arg);
381+ std::string actual = getType (arg);
382382
383383 // if not primitive, see if it is a variable in the symbol table
384384 if (!isPrimitive (actual))
@@ -428,9 +428,9 @@ TypeChecker::compareFunctions(std::vector<std::string> inputs,
428428
429429// given a right expression, determin its type
430430std::string
431- TypeChecker::getRightExpressionType (ast::BinaryExpression* node)
431+ TypeChecker::getType (ast::BinaryExpression* node)
432432{
433- return expressionHelper (node->getLeftExpr ());
433+ return getType (node->getLeftExpr ());
434434}
435435
436436// ------- Additions to the symbol table ------- //
@@ -464,7 +464,7 @@ TypeChecker::visit(ast::NewUDTDefinition* node)
464464 // visit expression
465465 visit (node->getExpression ());
466466
467- std::string exprType = expressionHelper (node->getExpression ());
467+ std::string exprType = getType (node->getExpression ());
468468
469469 std::string temp;
470470 std::string prev;
@@ -602,7 +602,7 @@ TypeChecker::visit(ast::PrimitiveDefition* node)
602602 // visit expression
603603 visit (node->getBinaryExpression ());
604604
605- std::string exprType = getRightExpressionType (node->getBinaryExpression ());
605+ std::string exprType = getType (node->getBinaryExpression ());
606606
607607 // ensure assignment is the expected type
608608 if (exprType != type)
@@ -718,7 +718,7 @@ TypeChecker::visit(ast::FunctionDefinition* node)
718718 ast::BinaryExpression* returnedExpr =
719719 subnode->getBinaryExpression ();
720720
721- std::string actualReturnType = getRightExpressionType (returnedExpr);
721+ std::string actualReturnType = getType (returnedExpr);
722722
723723 if (actualReturnType != out_type)
724724 semanticErrorHandler->handle (new Error (
@@ -870,7 +870,7 @@ TypeChecker::visit(ast::Negation* node)
870870 visit (node->getBinaryExpression ());
871871
872872 // ensure that all negations are boolean
873- std::string type = getRightExpressionType (node->getBinaryExpression ());
873+ std::string type = getType (node->getBinaryExpression ());
874874 if (type != " bool" )
875875 semanticErrorHandler->handle (new Error (
876876 node->getLineNum (),
@@ -892,9 +892,9 @@ TypeChecker::visit(ast::BinaryExpression* node)
892892 visit (node->getLeftExpr ());
893893 visit (node->getRightExpr ());
894894
895- std::string lType = expressionHelper (node->getLeftExpr ());
895+ std::string lType = getType (node->getLeftExpr ());
896896
897- std::string rType = getRightExpressionType (node->getRightExpr ());
897+ std::string rType = getType (node->getRightExpr ());
898898
899899 switch (node->getBinaryExpressionType ())
900900 {
0 commit comments