Skip to content
Snippets Groups Projects
Commit bee66b30 authored by Nicholas Robinson's avatar Nicholas Robinson
Browse files

J1_ProtectedAccess1&2

parent b3359ed5
No related branches found
No related tags found
No related merge requests found
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 #######################
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment