mirror of
https://github.com/davidhalter/jedi.git
synced 2026-02-12 14:01:41 +08:00
Remove NamePart from existance and rename it to Name.
This commit is contained in:
@@ -113,7 +113,7 @@ class Parser(object):
|
||||
:return: tuple of Name, next_token
|
||||
"""
|
||||
def append(tok):
|
||||
names.append(pr.NamePart(self.module, tok.string, None, tok.start_pos))
|
||||
names.append(pr.Name(self.module, tok.string, None, tok.start_pos))
|
||||
self.module.temp_used_names.append(tok.string)
|
||||
|
||||
names = []
|
||||
@@ -139,7 +139,7 @@ class Parser(object):
|
||||
self.module.temp_used_names.append(tok.string)
|
||||
if tok.type != tokenize.NAME:
|
||||
return None, tok
|
||||
return pr.NamePart(self.module, tok.string, None, tok.start_pos), next(self._gen)
|
||||
return pr.Name(self.module, tok.string, None, tok.start_pos), next(self._gen)
|
||||
|
||||
def _parse_import_list(self):
|
||||
"""
|
||||
@@ -595,7 +595,7 @@ class Parser(object):
|
||||
self._scope.add_statement(kw)
|
||||
if stmt is not None and tok_str == 'global':
|
||||
for t in stmt._token_list:
|
||||
if isinstance(t, pr.NamePart):
|
||||
if isinstance(t, pr.Name):
|
||||
# Add the global to the top module, it counts there.
|
||||
self.module.add_global(t)
|
||||
# decorator
|
||||
|
||||
@@ -485,7 +485,7 @@ class SubModule(Scope, Module):
|
||||
string = re.sub('\.[a-z]+-\d{2}[mud]{0,3}$', '', r.group(1))
|
||||
# Positions are not real, but a module starts at (1, 0)
|
||||
p = (1, 0)
|
||||
return NamePart(self, string, self.use_as_parent, p)
|
||||
return Name(self, string, self.use_as_parent, p)
|
||||
|
||||
@property
|
||||
def has_explicit_absolute_import(self):
|
||||
@@ -1240,7 +1240,7 @@ class Statement(Simple, DocstringMixin):
|
||||
continue
|
||||
|
||||
is_literal = token_type in (tokenize.STRING, tokenize.NUMBER)
|
||||
if is_literal or isinstance(tok, NamePart):
|
||||
if is_literal or isinstance(tok, Name):
|
||||
cls = Literal if is_literal else Call
|
||||
|
||||
call = cls(self._sub_module, tok_str, tok.start_pos, tok.end_pos, self)
|
||||
@@ -1522,7 +1522,7 @@ class Array(StatementElement):
|
||||
return "<%s: %s%s>" % (type(self).__name__, typ, self.values)
|
||||
|
||||
|
||||
class NamePart(object):
|
||||
class Name(object):
|
||||
"""
|
||||
A string. Sometimes it is important to know if the string belongs to a name
|
||||
or not.
|
||||
|
||||
Reference in New Issue
Block a user