Skip to content
Snippets Groups Projects
Commit 8c9f9e70 authored by Xun Yang's avatar Xun Yang
Browse files

static this

parent ea18724a
No related branches found
No related tags found
No related merge requests found
...@@ -143,7 +143,7 @@ class MethodNode(ASTNode): ...@@ -143,7 +143,7 @@ class MethodNode(ASTNode):
if 'static' in self.mods: if 'static' in self.mods:
names = getNameNodes(self.body) names = getNameNodes(self.body)
for n in names: for n in names:
if n.pointToThis and n.prefixLink.__class__.__name__ in ['MethodNode', 'FieldNode'] and 'static' not in n.prefixLink.mods: if 'this' in n.name or (n.pointToThis and n.prefixLink.__class__.__name__ == ['MethodNode', 'FieldNode'] and 'static' not in n.prefixLink.mods):
raise Exception("ERROR: Cannot use non-static member {} in static method {} in class {}".format(n.name, self.name, self.typeName)) raise Exception("ERROR: Cannot use non-static member {} in static method {} in class {}".format(n.name, self.name, self.typeName))
# With method body # With method body
......
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