Deleted Added
sdiff udiff text old ( 6882:898047a3672c ) new ( 6999:f226c098c393 )
full compact
1# Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
2# Copyright (c) 2009 The Hewlett-Packard Development Company
3# All rights reserved.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions are
7# met: redistributions of source code must retain the above copyright
8# notice, this list of conditions and the following disclaimer;

--- 11 unchanged lines hidden (view full) ---

20# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28from m5.util import code_formatter
29
30from slicc.ast.ExprAST import ExprAST
31
32class MethodCallExprAST(ExprAST):
33 def __init__(self, slicc, proc_name, expr_ast_vec):
34 super(MethodCallExprAST, self).__init__(slicc)
35 self.proc_name = proc_name
36 self.expr_ast_vec = expr_ast_vec
37
38 def generate(self, code):
39 tmp = code_formatter()
40 paramTypes = []
41 for expr_ast in self.expr_ast_vec:
42 return_type = expr_ast.generate(tmp)
43 paramTypes.append(return_type)
44
45 obj_type, methodId, prefix = self.generate_prefix(paramTypes)
46
47 # generate code

--- 38 unchanged lines hidden (view full) ---

86
87 self.obj_expr_ast = obj_expr_ast
88
89 def __repr__(self):
90 return "[MethodCallExpr: %r%r %r]" % (self.proc_name,
91 self.obj_expr_ast,
92 self.expr_ast_vec)
93 def generate_prefix(self, paramTypes):
94 code = code_formatter()
95
96 # member method call
97 obj_type = self.obj_expr_ast.generate(code)
98 methodId = obj_type.methodId(self.proc_name, paramTypes)
99
100 prefix = ""
101 implements_interface = False
102 if methodId not in obj_type.methods:

--- 68 unchanged lines hidden ---