diff --git a/jedi/parsing_representation.py b/jedi/parsing_representation.py index a75abcbf..de7eaf3e 100644 --- a/jedi/parsing_representation.py +++ b/jedi/parsing_representation.py @@ -812,7 +812,7 @@ class Statement(Simple): tok = None first = True for i, tok_temp in token_iterator: - if isinstance(tok_temp, (Base)): + if isinstance(tok_temp, Base): # the token is a Name, which has already been parsed tok = tok_temp if first: @@ -851,10 +851,10 @@ class Statement(Simple): is_chain = False brackets = {'(': Array.TUPLE, '[': Array.LIST, '{': Array.SET} closing_brackets = ')', '}', ']' + start = 0 token_iterator = enumerate(self.token_list) for i, tok_temp in token_iterator: - #print 'tok', tok_temp, result if isinstance(tok_temp, Base): # the token is a Name, which has already been parsed tok = tok_temp @@ -868,6 +868,7 @@ class Statement(Simple): self._assignment_details.append((result, tok)) result = [] is_chain = False + start = i + 1 continue elif tok == 'as': # just ignore as next(token_iterator, None) @@ -897,20 +898,20 @@ class Statement(Simple): else: arr.parent = self result.append(arr) - #print(tok, result) elif tok == '.': if result and isinstance(result[-1], Call): is_chain = True elif tok == ',': # implies a tuple # rewrite `result`, because now the whole thing is a tuple - add_el, t = parse_array_el(enumerate(result)) + add_el, t = parse_array_el(enumerate(self.token_list[start:i])) arr, break_tok = parse_array(token_iterator, Array.TUPLE, - start_pos, add_el) + add_el.start_pos, add_el) result = [arr] if is_assignment(break_tok): self._assignment_details.append((result, break_tok)) result = [] is_chain = False + start = i + 1 else: if tok != '\n': result.append(tok) diff --git a/jedi/recursion.py b/jedi/recursion.py index cdb1eff8..09d2e937 100644 --- a/jedi/recursion.py +++ b/jedi/recursion.py @@ -37,7 +37,7 @@ class RecursionDecorator(object): check = self._check_recursion() if check: debug.warning('catched stmt recursion: %s against %s @%s' - % (stmt, stmt.start_pos, check.stmt)) + % (stmt, check.stmt, stmt.start_pos)) self.pop_stmt() return True return False