From c86f849d5a1da1fc77f2fca43b82cb6760f68bc9 Mon Sep 17 00:00:00 2001 From: "Brad Beckmann ext:(%2C%20Nilay%20Vaish%20%3Cnilay%40cs.wisc.edu%3E)" Date: Thu, 30 Jun 2011 19:49:26 -0500 Subject: Ruby: Add support for functional accesses This patch rpovides functional access support in Ruby. Currently only the M5Port of RubyPort supports functional accesses. The support for functional through the PioPort will be added as a separate patch. --- src/mem/slicc/ast/MemberExprAST.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src/mem/slicc/ast') diff --git a/src/mem/slicc/ast/MemberExprAST.py b/src/mem/slicc/ast/MemberExprAST.py index a13205252..412c178d8 100644 --- a/src/mem/slicc/ast/MemberExprAST.py +++ b/src/mem/slicc/ast/MemberExprAST.py @@ -49,10 +49,15 @@ class MemberExprAST(ExprAST): code.fix(fix) # Verify that this is a valid field name for this type - if self.field not in return_type.data_members: - self.error("Invalid object field: " + - "Type '%s' does not have data member %s" % \ - (return_type, self.field)) - - # Return the type of the field - return return_type.data_members[self.field].type + if self.field in return_type.data_members: + # Return the type of the field + return return_type.data_members[self.field].type + else: + if "interface" in return_type: + interface_type = self.symtab.find(return_type["interface"]); + if self.field in interface_type.data_members: + # Return the type of the field + return interface_type.data_members[self.field].type + self.error("Invalid object field: " + + "Type '%s' does not have data member %s" % \ + (return_type, self.field)) -- cgit v1.2.3