From 426e38af8b112c5b78dd36f88e66e28f55f27ecd Mon Sep 17 00:00:00 2001 From: Nilay Vaish Date: Sun, 30 Aug 2015 10:52:58 -0500 Subject: 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. --- src/mem/slicc/parser.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/mem/slicc/parser.py') diff --git a/src/mem/slicc/parser.py b/src/mem/slicc/parser.py index 0cbe9ea63..49177345d 100644 --- a/src/mem/slicc/parser.py +++ b/src/mem/slicc/parser.py @@ -669,15 +669,18 @@ class SLICC(Grammar): def p_expr__member_method_call(self, p): "aexpr : aexpr DOT ident '(' exprs ')'" - p[0] = ast.MemberMethodCallExprAST(self, p[1], p[3], p[5]) + p[0] = ast.MemberMethodCallExprAST(self, p[1], + ast.FuncCallExprAST(self, p[3], p[5])) def p_expr__member_method_call_lookup(self, p): "aexpr : aexpr '[' exprs ']'" - p[0] = ast.MemberMethodCallExprAST(self, p[1], "lookup", p[3]) + p[0] = ast.MemberMethodCallExprAST(self, p[1], + ast.FuncCallExprAST(self, "lookup", p[3])) def p_expr__class_method_call(self, p): "aexpr : type DOUBLE_COLON ident '(' exprs ')'" - p[0] = ast.ClassMethodCallExprAST(self, p[1], p[3], p[5]) + p[0] = ast.ClassMethodCallExprAST(self, p[1], + ast.FuncCallExprAST(self, p[3], p[5])) def p_expr__aexpr(self, p): "expr : aexpr" -- cgit v1.2.3