@@ -310,6 +310,15 @@ class ClassCreateNode(ASTNode):
else:
raiseException("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'inself.cons.mods:
curClass=self.env.getNode(self.typeName,'type')
ifcurClass.packageName!=classDef.packageName:
raiseException("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))