diff options
author | Nilay Vaish <nilay@cs.wisc.edu> | 2014-02-20 17:26:49 -0600 |
---|---|---|
committer | Nilay Vaish <nilay@cs.wisc.edu> | 2014-02-20 17:26:49 -0600 |
commit | dd5c72e5a7e09634c992092f80dafe82f4274d45 (patch) | |
tree | 3edbb6b80c898e2ac792d69fac0fe1423d385cbe /src/mem | |
parent | b312a41f21b6f76607fe7480a915a4c5093386a3 (diff) | |
download | gem5-dd5c72e5a7e09634c992092f80dafe82f4274d45.tar.xz |
ruby: slicc: slight code refactoring
Diffstat (limited to 'src/mem')
-rw-r--r-- | src/mem/slicc/ast/MethodCallExprAST.py | 26 | ||||
-rw-r--r-- | src/mem/slicc/ast/ObjDeclAST.py | 6 |
2 files changed, 12 insertions, 20 deletions
diff --git a/src/mem/slicc/ast/MethodCallExprAST.py b/src/mem/slicc/ast/MethodCallExprAST.py index cf30cfa96..bf133b374 100644 --- a/src/mem/slicc/ast/MethodCallExprAST.py +++ b/src/mem/slicc/ast/MethodCallExprAST.py @@ -140,23 +140,21 @@ class MemberMethodCallExprAST(MethodCallExprAST): implemented_paramTypes.append(implemented_paramType) + implementedMethodId = "" if implements_interface: - implementedMethodId = obj_type.methodIdAbstract(self.proc_name, - implemented_paramTypes) - else: - implementedMethodId = "" + implementedMethodId = obj_type.methodIdAbstract( + self.proc_name, implemented_paramTypes) if implementedMethodId not in obj_type.methods: - self.error("Invalid method call: " \ - "Type '%s' does not have a method %s, '%s' nor '%s'", - obj_type, self.proc_name, methodId, implementedMethodId) - else: - # - # Replace the methodId with the implementedMethodId found in - # the method list. - # - methodId = implementedMethodId - return_type = obj_type.methods[methodId].return_type + self.error("Invalid method call: Type '%s' " \ + "does not have a method %s, '%s' nor '%s'", + obj_type, self.proc_name, methodId, + implementedMethodId) + + # Replace the methodId with the implementedMethodId + # found in the method list. + methodId = implementedMethodId + return_type = obj_type.methods[methodId].return_type if return_type.isInterface: prefix = "static_cast<%s &>" % return_type.c_ident diff --git a/src/mem/slicc/ast/ObjDeclAST.py b/src/mem/slicc/ast/ObjDeclAST.py index a87ede724..4fd85d143 100644 --- a/src/mem/slicc/ast/ObjDeclAST.py +++ b/src/mem/slicc/ast/ObjDeclAST.py @@ -39,8 +39,6 @@ class ObjDeclAST(DeclAST): return "[ObjDecl: %r]" % self.ident def generate(self): - machineComponentSym = False - if "network" in self and not ("virtual_network" in self or "physical_network" in self) : self.error("Network queues require a 'virtual_network' attribute") @@ -84,7 +82,3 @@ class ObjDeclAST(DeclAST): machine.addObject(v) self.symtab.newSymbol(v) - - # used to cheat-- that is, access components in other machines - if machineComponentSym: - self.symtab.newMachComponentSym(v) |