diff --git a/jedi/parser/pytree.py b/jedi/parser/pytree.py index 76b55807..4d912fc7 100644 --- a/jedi/parser/pytree.py +++ b/jedi/parser/pytree.py @@ -47,7 +47,7 @@ del python_grammar_no_print_statement.keywords["print"] from jedi.parser import representation as pr _ast_mapping = { - #'simple_stmt': pr.ExprStmt, + 'simple_stmt': pr.ExprStmt, 'classdef': pr.Class, 'funcdef': pr.Function, 'file_input': pr.SubModule, diff --git a/jedi/parser/representation.py b/jedi/parser/representation.py index a2ae8407..1fd9f6ba 100644 --- a/jedi/parser/representation.py +++ b/jedi/parser/representation.py @@ -987,8 +987,7 @@ class Statement(Simple, DocstringMixin): __slots__ = ('_token_list', '_set_vars', 'as_names', '_expression_list', '_assignment_details', '_names_are_set_vars', '_doc_token') - def __init__(self, module, token_list, start_pos, end_pos, parent=None, - as_names=(), names_are_set_vars=False, set_name_parents=True): + def __init__old(self, children, parent=None,): super(Statement, self).__init__(module, start_pos, end_pos, parent) self._token_list = token_list self._names_are_set_vars = names_are_set_vars @@ -1005,29 +1004,6 @@ class Statement(Simple, DocstringMixin): # This will help to adapt a better new AST. self.expression_list() - @property - def end_pos(self): - return self._token_list[-1].end_pos - - def get_code(self, new_line=True): - def assemble(command_list, assignment=None): - pieces = [c.get_code() if isinstance(c, Simple) else c.string - if isinstance(c, tokenize.Token) else unicode(c) - for c in command_list] - if assignment is None: - return ''.join(pieces) - return '%s %s ' % (''.join(pieces), assignment) - - code = ''.join(assemble(*a) for a in self.assignment_details) - code += assemble(self.expression_list()) - if self._doc_token: - code += '\n"""%s"""' % self.raw_doc - - if new_line: - return code + '\n' - else: - return code - def get_defined_names(self): """Get the names for the statement.""" if self._set_vars is None: