1
0
forked from VimPlug/jedi

Use ExprStmt pretty much everywhere where it should be used.

ExprStmt is now really a normal statement. All the other statements are from now on considered legacy code. As a side effect this increases the parser pickling version.
This commit is contained in:
Dave Halter
2014-09-06 11:04:49 +02:00
parent cb84bc0829
commit 5a3ee02399
6 changed files with 13 additions and 13 deletions

View File

@@ -332,7 +332,7 @@ class BaseDefinition(object):
# Functions, classes and modules are already fixed definitions, we
# cannot follow them anymore.
return [self]
stmt_or_imp = self._definition.get_parent_until((pr.Statement, pr.Import))
stmt_or_imp = self._definition.get_parent_until((pr.ExprStmt, pr.Import))
call_path = call_path_for_name_part(stmt_or_imp, self._definition)
names = self._evaluator.goto(stmt_or_imp, call_path)
return [Definition(self._evaluator, n) for n in names]
@@ -352,7 +352,7 @@ class BaseDefinition(object):
elif isinstance(stripped, pr.Class):
stripped = er.Class(self._evaluator, stripped)
if stripped.isinstance(pr.Statement):
if stripped.isinstance(pr.ExprStmt):
return self._evaluator.eval_statement(stripped)
elif stripped.isinstance(pr.Import):
return imports.follow_imports(self._evaluator, [stripped])
@@ -606,7 +606,7 @@ class Definition(use_metaclass(CachedMetaClass, BaseDefinition)):
return None
elif isinstance(d, pr.Param):
name = d.get_name()
elif isinstance(d, pr.Statement):
elif isinstance(d, pr.ExprStmt):
try:
expression_list = d.assignment_details[0][0]
name = expression_list[0].name.names[-1]