mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-09 23:34:45 +08:00
@@ -183,9 +183,12 @@ class AbstractInstanceContext(Context):
|
|||||||
else:
|
else:
|
||||||
bound_method = BoundMethod(
|
bound_method = BoundMethod(
|
||||||
self.evaluator, self, class_context,
|
self.evaluator, self, class_context,
|
||||||
self.parent_context, scope
|
parent_context, scope
|
||||||
)
|
)
|
||||||
return bound_method.get_function_execution()
|
return bound_method.get_function_execution()
|
||||||
|
elif scope.type == 'classdef':
|
||||||
|
class_context = er.ClassContext(self.evaluator, scope, parent_context)
|
||||||
|
return class_context
|
||||||
else:
|
else:
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
return class_context
|
return class_context
|
||||||
|
|||||||
@@ -509,3 +509,20 @@ Config.mode
|
|||||||
|
|
||||||
#? int()
|
#? int()
|
||||||
Config.mode2
|
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):
|
def with_param(self):
|
||||||
return lambda x: x + self.a()
|
return lambda x: x + self.a()
|
||||||
|
|
||||||
|
lambd = lambda self: self.foo
|
||||||
|
|
||||||
#? int()
|
#? int()
|
||||||
C().a()
|
C().a()
|
||||||
|
|
||||||
@@ -75,6 +77,11 @@ index = C().with_param()(1)
|
|||||||
#? float()
|
#? float()
|
||||||
['', 1, 1.0][index]
|
['', 1, 1.0][index]
|
||||||
|
|
||||||
|
#? float()
|
||||||
|
C().lambd()
|
||||||
|
#? int()
|
||||||
|
C(1).lambd()
|
||||||
|
|
||||||
|
|
||||||
def xy(param):
|
def xy(param):
|
||||||
def ret(a, b):
|
def ret(a, b):
|
||||||
|
|||||||
Reference in New Issue
Block a user