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

ClassCreateNode protected check

parent 2fb3c978
No related branches found
No related tags found
No related merge requests found
......@@ -310,6 +310,15 @@ class ClassCreateNode(ASTNode):
else:
raise Exception("ERROR: Class {} doesn't have a constructor with given argument types.".format(classDef.name))
# check to make sure we are allowed to call this (protected?)
# if self.cons is protected, check that:
# - current class is in the same package
if 'protected' in self.cons.mods:
curClass = self.env.getNode(self.typeName, 'type')
if curClass.packageName != classDef.packageName:
raise Exception("ERROR: In class {0}, using a protected constructor, but class {1} is not in class {0}'s package ({2}).".format(curClass.name, classDef.name, curClass.packageName))
#################################################################################
# condOrExpr
......
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