diff --git a/parsing.py b/parsing.py index 96ebac7c..9d97f94c 100644 --- a/parsing.py +++ b/parsing.py @@ -800,7 +800,6 @@ class Array(Call): one array. """ self.values.append([]) - self.keys.append(None) def add_to_current_field(self, tok): """ Adds a token to the latest field (in content). """ @@ -813,12 +812,10 @@ class Array(Call): def add_dictionary_key(self): """ Only used for dictionaries, automatically adds the tokens added by now - from the values to keys. + from the values to keys, because the parser works this way. """ self.type = Array.DICT - c = self._counter - self.keys[c] = self.values[c] - self.values[c] = [] + self.keys.append(self.values.pop()) def get_only_subelement(self): """ diff --git a/test/completion/types.py b/test/completion/types.py index b754816f..5e43c0df 100644 --- a/test/completion/types.py +++ b/test/completion/types.py @@ -32,6 +32,9 @@ list().app #? ['append'] [].append +arr2 = [1,2,3] +#? ['append'] +arr2.app # ----------------- # dicts @@ -47,6 +50,12 @@ dic2.p #? ['popitem'] {}.popitem +dic2 = {'asdf': 3} +#? ['popitem'] +dic2.popitem + +#? ['real'] +dic2['asdf'].real # ----------------- # set