mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 14:04:26 +08:00
@@ -183,9 +183,12 @@ class AbstractInstanceContext(Context):
|
||||
else:
|
||||
bound_method = BoundMethod(
|
||||
self.evaluator, self, class_context,
|
||||
self.parent_context, scope
|
||||
parent_context, scope
|
||||
)
|
||||
return bound_method.get_function_execution()
|
||||
elif scope.type == 'classdef':
|
||||
class_context = er.ClassContext(self.evaluator, scope, parent_context)
|
||||
return class_context
|
||||
else:
|
||||
raise NotImplementedError
|
||||
return class_context
|
||||
|
||||
@@ -509,3 +509,20 @@ Config.mode
|
||||
|
||||
#? int()
|
||||
Config.mode2
|
||||
|
||||
|
||||
# -----------------
|
||||
# Nested class/def/class
|
||||
# -----------------
|
||||
class Foo(object):
|
||||
a = 3
|
||||
def create_class(self):
|
||||
class X():
|
||||
a = self.a
|
||||
self.b = 3.0
|
||||
return X
|
||||
|
||||
#? int()
|
||||
Foo().create_class().a
|
||||
#? float()
|
||||
Foo().b
|
||||
|
||||
@@ -65,6 +65,8 @@ class C():
|
||||
def with_param(self):
|
||||
return lambda x: x + self.a()
|
||||
|
||||
lambd = lambda self: self.foo
|
||||
|
||||
#? int()
|
||||
C().a()
|
||||
|
||||
@@ -75,6 +77,11 @@ index = C().with_param()(1)
|
||||
#? float()
|
||||
['', 1, 1.0][index]
|
||||
|
||||
#? float()
|
||||
C().lambd()
|
||||
#? int()
|
||||
C(1).lambd()
|
||||
|
||||
|
||||
def xy(param):
|
||||
def ret(a, b):
|
||||
|
||||
Reference in New Issue
Block a user