MethodCallExprAST.py (6657:ef5fae93a3b2) | MethodCallExprAST.py (6690:4dc4e494e4d8) |
---|---|
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; --- 41 unchanged lines hidden (view full) --- 50 return_type,tcode = expr_ast.inline(True) 51 params.append(str(tcode)) 52 fix = code.nofix() 53 code("$prefix${{self.proc_name}}(${{', '.join(params)}}))") 54 code.fix(fix) 55 56 # Verify that this is a method of the object 57 if methodId not in obj_type.methods: | 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; --- 41 unchanged lines hidden (view full) --- 50 return_type,tcode = expr_ast.inline(True) 51 params.append(str(tcode)) 52 fix = code.nofix() 53 code("$prefix${{self.proc_name}}(${{', '.join(params)}}))") 54 code.fix(fix) 55 56 # Verify that this is a method of the object 57 if methodId not in obj_type.methods: |
58 error("Invalid method call: Type '%s' does not have a method '%s'", 59 obj_type, methodId) | 58 self.error("Invalid method call: Type '%s' does not have a method '%s'", 59 obj_type, methodId) |
60 61 if len(self.expr_ast_vec) != \ 62 len(obj_type.methods[methodId].param_types): 63 # Right number of parameters | 60 61 if len(self.expr_ast_vec) != \ 62 len(obj_type.methods[methodId].param_types): 63 # Right number of parameters |
64 error("Wrong number of parameters for function name: '%s', " + \ 65 "expected: , actual: ", proc_name, | 64 self.error("Wrong number of parameters for function name: '%s', " + \ 65 "expected: , actual: ", proc_name, |
66 len(obj_type.methods[methodId].param_types), 67 len(self.expr_ast_vec)) 68 69 for actual_type, expected_type in \ 70 zip(paramTypes, obj_type.methods[methodId].param_types): 71 if actual_type != expected_type: | 66 len(obj_type.methods[methodId].param_types), 67 len(self.expr_ast_vec)) 68 69 for actual_type, expected_type in \ 70 zip(paramTypes, obj_type.methods[methodId].param_types): 71 if actual_type != expected_type: |
72 error("Type mismatch: expected: %s actual: %s", 73 expected_type, actual_type) | 72 self.error("Type mismatch: expected: %s actual: %s", 73 expected_type, actual_type) |
74 75 # Return the return type of the method 76 return obj_type.methods[methodId].return_type 77 78 def findResources(self, resources): 79 pass 80 81class MemberMethodCallExprAST(MethodCallExprAST): --- 46 unchanged lines hidden --- | 74 75 # Return the return type of the method 76 return obj_type.methods[methodId].return_type 77 78 def findResources(self, resources): 79 pass 80 81class MemberMethodCallExprAST(MethodCallExprAST): --- 46 unchanged lines hidden --- |