forked from VimPlug/jedi
Move some of the compiled.create calls to compiled.builtin_from_name
This commit is contained in:
@@ -146,7 +146,8 @@ class FunctionExecutionContext(TreeContext):
|
||||
try:
|
||||
children = r.children
|
||||
except AttributeError:
|
||||
context_set |= ContextSet(compiled.create(self.evaluator, None))
|
||||
ctx = compiled.builtin_from_name(self.evaluator, 'None')
|
||||
context_set |= ContextSet(ctx)
|
||||
else:
|
||||
context_set |= self.eval_node(children[1])
|
||||
if check is flow_analysis.REACHABLE:
|
||||
@@ -157,7 +158,8 @@ class FunctionExecutionContext(TreeContext):
|
||||
def _eval_yield(self, yield_expr):
|
||||
if yield_expr.type == 'keyword':
|
||||
# `yield` just yields None.
|
||||
yield LazyKnownContext(compiled.create(self.evaluator, None))
|
||||
ctx = compiled.builtin_from_name(self.evaluator, 'None')
|
||||
yield LazyKnownContext(ctx)
|
||||
return
|
||||
|
||||
node = yield_expr.children[1]
|
||||
|
||||
@@ -95,7 +95,7 @@ class AbstractInstanceContext(Context):
|
||||
if isinstance(obj, AbstractInstanceContext):
|
||||
return self.execute_function_slots(names, obj, obj.class_context)
|
||||
else:
|
||||
none_obj = compiled.create(self.evaluator, None)
|
||||
none_obj = compiled.builtin_from_name(self.evaluator, 'None')
|
||||
return self.execute_function_slots(names, none_obj, obj)
|
||||
else:
|
||||
return ContextSet(self)
|
||||
|
||||
@@ -139,14 +139,14 @@ class ClassContext(use_metaclass(CachedMetaClass, TreeContext)):
|
||||
args = arguments.TreeArguments(self.evaluator, self, arglist)
|
||||
return [value for key, value in args.unpack() if key is None]
|
||||
else:
|
||||
return [LazyKnownContext(compiled.create(self.evaluator, object))]
|
||||
return [LazyKnownContext(compiled.builtin_from_name(self.evaluator, 'object'))]
|
||||
|
||||
def py__call__(self, params):
|
||||
from jedi.evaluate.context import TreeInstance
|
||||
return ContextSet(TreeInstance(self.evaluator, self.parent_context, self, params))
|
||||
|
||||
def py__class__(self):
|
||||
return compiled.create(self.evaluator, type)
|
||||
return compiled.builtin_from_name(self.evaluator, 'type')
|
||||
|
||||
def get_params(self):
|
||||
from jedi.evaluate.context import AnonymousInstance
|
||||
|
||||
@@ -25,7 +25,8 @@ class _ModuleAttributeName(AbstractNameDefinition):
|
||||
self.string_name = string_name
|
||||
|
||||
def infer(self):
|
||||
return compiled.create(self.parent_context.evaluator, str).execute_evaluated()
|
||||
ctx = compiled.builtin_from_name(self.parent_context.evaluator, 'str')
|
||||
return ctx.execute_evaluated()
|
||||
|
||||
|
||||
class ModuleName(ContextNameMixin, AbstractNameDefinition):
|
||||
|
||||
Reference in New Issue
Block a user