mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-09 23:34:45 +08:00
floats are working now too, the whole thing seems to be pretty solid.
This commit is contained in:
16
evaluate.py
16
evaluate.py
@@ -72,16 +72,18 @@ class Execution(Exec):
|
||||
if get_returns:
|
||||
ret = scope.returns
|
||||
for s in ret:
|
||||
for stmt in follow_statement(s):
|
||||
stmts += remove_executions(stmt)
|
||||
#for stmt in follow_statement(s):
|
||||
# stmts += remove_executions(stmt)
|
||||
stmts += follow_statement(s)
|
||||
else:
|
||||
stmts.append(scope)
|
||||
return stmts
|
||||
|
||||
# check cache
|
||||
try:
|
||||
debug.dbg('hit function cache', self.base)
|
||||
return Execution.cache[self.base]
|
||||
ex = Execution.cache[self.base]
|
||||
debug.dbg('hit function cache', self.base, ex)
|
||||
return ex
|
||||
except KeyError:
|
||||
# cache is not only here as a cache, but also to prevent an
|
||||
# endless recursion.
|
||||
@@ -206,14 +208,16 @@ def follow_call(scope, call):
|
||||
path = call.generate_call_list()
|
||||
|
||||
current = next(path)
|
||||
print 'call', scope, call, current
|
||||
if isinstance(current, parsing.Array):
|
||||
result = [current]
|
||||
else:
|
||||
# TODO add better care for int/unicode, now str/float are just used
|
||||
# instead
|
||||
if current.type == parsing.Call.STRING:
|
||||
not_name_part = not isinstance(current, parsing.NamePart)
|
||||
if not_name_part and current.type == parsing.Call.STRING:
|
||||
scopes = get_scopes_for_name(builtin.Builtin.scope, 'str')
|
||||
elif current.type == parsing.Call.NUMBER:
|
||||
elif not_name_part and current.type == parsing.Call.NUMBER:
|
||||
scopes = get_scopes_for_name(builtin.Builtin.scope, 'float')
|
||||
else:
|
||||
scopes = get_scopes_for_name(scope, current, search_global=True)
|
||||
|
||||
@@ -82,9 +82,10 @@ class FileWithCursor(modules.File):
|
||||
break
|
||||
elif tok in close_brackets:
|
||||
level += 1
|
||||
elif token_type in [tokenize.NAME, tokenize.STRING,
|
||||
tokenize.NUMBER]:
|
||||
elif token_type in [tokenize.NAME, tokenize.STRING]:
|
||||
force_point = True
|
||||
elif token_type == tokenize.NUMBER:
|
||||
pass
|
||||
else:
|
||||
#print 'break', token_type, tok
|
||||
break
|
||||
|
||||
@@ -608,7 +608,7 @@ class Statement(Simple):
|
||||
"behaviour. Please submit a bug" % level)
|
||||
|
||||
self.assignment_calls = top
|
||||
print 'top', top.values
|
||||
print 'top', top.values, top.values[0][0].name, repr(top.values[0][0].name)
|
||||
return top
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user