diff --git a/ExprPrimaryNodes.py b/ExprPrimaryNodes.py index a5194ae0b818ce2c92cb167d891fb1e0d2c92cf7..687be3d453957b7e01dafc35705476c3a56dcba9 100644 --- a/ExprPrimaryNodes.py +++ b/ExprPrimaryNodes.py @@ -1,6 +1,7 @@ from AST import ASTNode, getParseTreeNodes from Environment import Env from UnitNodes import LiteralNode +import MemberNodes from TheTypeNode import TypeNode, TypeStruct from NameNode import NameNode, checkProtected @@ -494,9 +495,10 @@ class MethodInvNode(ASTNode): m = getMethod(self.ID.prefixLink.values(), self.ID.methodName, self.args) else: self.primary.checkType() - m = getMethod(self.primary.myType.typePointer.methods, self.ID.methodName, self.args) - - from pprint import pprint + methods = [] + methods.extend(self.primary.myType.typePointer.methods) + methods.extend([meth for meth in self.primary.myType.typePointer.inherits if isinstance(meth, MemberNodes.MethodNode)]) # need to check inherited methods as well + m = getMethod(methods, self.ID.name, self.args) if m: # check static @@ -514,7 +516,7 @@ class MethodInvNode(ASTNode): return else: - raise Exception("ERROR: Class {} doesn't have a method {} with given argument types.".format(self.typeName, self.ID.methodName)) + raise Exception("ERROR: Class {} doesn't have a method {} with given argument types.".format(self.typeName, self.ID.name)) ################# Helper #######################