mirror of
https://github.com/davidhalter/jedi.git
synced 2026-05-17 05:49:37 +08:00
Fix classes in static analysis.
This commit is contained in:
+15
-9
@@ -722,10 +722,10 @@ class Class(ClassOrFunc):
|
|||||||
|
|
||||||
def get_super_arglist(self):
|
def get_super_arglist(self):
|
||||||
if self.children[2] != '(': # Has no parentheses
|
if self.children[2] != '(': # Has no parentheses
|
||||||
return []
|
return None
|
||||||
else:
|
else:
|
||||||
if self.children[3] == ')': # Empty parentheses
|
if self.children[3] == ')': # Empty parentheses
|
||||||
return []
|
return None
|
||||||
else:
|
else:
|
||||||
return self.children[3]
|
return self.children[3]
|
||||||
|
|
||||||
@@ -745,19 +745,25 @@ class Class(ClassOrFunc):
|
|||||||
# Yield itself, class needs to be executed for decorator checks.
|
# Yield itself, class needs to be executed for decorator checks.
|
||||||
yield self
|
yield self
|
||||||
# Super arguments.
|
# Super arguments.
|
||||||
for args in self.get_super_arglist:
|
arglist = self.get_super_arglist()
|
||||||
if args.type == 'args':
|
try:
|
||||||
# metaclass= or list comprehension or */**
|
children = arglist.children
|
||||||
raise NotImplementedError('Metaclasses not implemented')
|
except AttributeError:
|
||||||
else:
|
if arglist is not None:
|
||||||
yield args
|
yield arglist
|
||||||
|
else:
|
||||||
|
for argument in children:
|
||||||
|
if argument.type == 'argument':
|
||||||
|
# metaclass= or list comprehension or */**
|
||||||
|
raise NotImplementedError('Metaclasses not implemented')
|
||||||
|
else:
|
||||||
|
yield argument
|
||||||
|
|
||||||
# care for the class suite:
|
# care for the class suite:
|
||||||
for node_to_execute in self.children[-1].nodes_to_execute():
|
for node_to_execute in self.children[-1].nodes_to_execute():
|
||||||
yield node_to_execute
|
yield node_to_execute
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def _create_params(parent, argslist_list):
|
def _create_params(parent, argslist_list):
|
||||||
"""
|
"""
|
||||||
`argslist_list` is a list that can contain an argslist as a first item, but
|
`argslist_list` is a list that can contain an argslist as a first item, but
|
||||||
|
|||||||
Reference in New Issue
Block a user