summaryrefslogtreecommitdiff
path: root/src/mem/slicc/ast/FuncCallExprAST.py
diff options
context:
space:
mode:
authorNilay Vaish <nilay@cs.wisc.edu>2015-08-30 10:52:58 -0500
committerNilay Vaish <nilay@cs.wisc.edu>2015-08-30 10:52:58 -0500
commit426e38af8b112c5b78dd36f88e66e28f55f27ecd (patch)
tree816058a6290c911cac7bbca9e478b2bf3d4ec9a5 /src/mem/slicc/ast/FuncCallExprAST.py
parent4727fc26f885d09f07f18a10fabe6c75dffe165f (diff)
downloadgem5-426e38af8b112c5b78dd36f88e66e28f55f27ecd.tar.xz
ruby: slicc: avoid duplicate code for function argument check
Both FuncCallExprAST and MethodCallExprAST had code for checking the arguments with which a function is being called. The patch does away with this duplication. Now the code for checking function call arguments resides in the Func class.
Diffstat (limited to 'src/mem/slicc/ast/FuncCallExprAST.py')
-rw-r--r--src/mem/slicc/ast/FuncCallExprAST.py17
1 files changed, 1 insertions, 16 deletions
diff --git a/src/mem/slicc/ast/FuncCallExprAST.py b/src/mem/slicc/ast/FuncCallExprAST.py
index 9336a2297..0c9880d6d 100644
--- a/src/mem/slicc/ast/FuncCallExprAST.py
+++ b/src/mem/slicc/ast/FuncCallExprAST.py
@@ -93,22 +93,7 @@ class FuncCallExprAST(ExprAST):
if func is None:
self.error("Unrecognized function name: '%s'", func_name_args)
- if len(self.exprs) != len(func.param_types):
- self.error("Wrong number of arguments passed to function : '%s'" +\
- " Expected %d, got %d", self.proc_name,
- len(func.param_types), len(self.exprs))
-
- cvec = []
- type_vec = []
- for expr,expected_type in zip(self.exprs, func.param_types):
- # Check the types of the parameter
- actual_type,param_code = expr.inline(True)
- if str(actual_type) != 'OOD' and \
- str(actual_type) != str(expected_type):
- expr.error("Type mismatch: expected: %s actual: %s" % \
- (expected_type, actual_type))
- cvec.append(param_code)
- type_vec.append(expected_type)
+ cvec, type_vec = func.checkArguments(self.exprs)
# OK, the semantics of "trigger" here is that, ports in the
# machine have different priorities. We always check the first