Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch 14 #9

Merged
merged 2 commits into from
Jul 6, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/parser.pyj
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ def parse($TEXT, options):
atom = expr_atom(False)
expect(")")
nonlocal parent
parent = atom.name
parent = stringifyName(atom)
return atom
else:
return None
Expand Down Expand Up @@ -1987,7 +1987,7 @@ def parse($TEXT, options):
if funcname.property is "__init__":
funcname.property = "constructor"

S.in_scope[-1].callsSuper = S.in_scope.length > 1 and S.in_scope[-2].type is 'class' and expr.expression.name is S.in_scope[-2].parent
S.in_scope[-1].callsSuper = S.in_scope.length > 1 and S.in_scope[-2].type is 'class' and stringifyName(expr.expression) is S.in_scope[-2].parent
return validateCallArgs(subscripts(ast.ClassCall({
start: start,
class: expr.expression,
Expand Down Expand Up @@ -2031,18 +2031,18 @@ def parse($TEXT, options):

return expr

def stringifyName(expr):
if isinstance(expr, ast.Dot):
return stringifyName(expr.expression) + "." + expr.property
return expr.name

def keepDecoratorOrImport(expr, imp=False):
# helper function for figuring out whether this decorator should be dropped
if imp:
if not options.dropImports.length: return True
else:
if not options.dropDecorators.length: return True

def stringifyName(expr):
if isinstance(expr, ast.Dot):
return stringifyName(expr.expression) + "." + expr.property
return expr.name

if JS('typeof expr') is 'string':
# passed in a string
name = expr
Expand Down