forked from OSchip/llvm-project
[lit] Avoid use of iterator .next() method.
llvm-svn: 187858
This commit is contained in:
parent
a3ef2f2dd8
commit
3a90aebd3a
|
@ -174,16 +174,15 @@ class ShParser:
|
|||
self.tokens = ShLexer(data, win32Escapes = win32Escapes).lex()
|
||||
|
||||
def lex(self):
|
||||
try:
|
||||
return self.tokens.next()
|
||||
except StopIteration:
|
||||
return None
|
||||
for item in self.tokens:
|
||||
return item
|
||||
return None
|
||||
|
||||
def look(self):
|
||||
next = self.lex()
|
||||
if next is not None:
|
||||
self.tokens = itertools.chain([next], self.tokens)
|
||||
return next
|
||||
token = self.lex()
|
||||
if token is not None:
|
||||
self.tokens = itertools.chain([token], self.tokens)
|
||||
return token
|
||||
|
||||
def parse_command(self):
|
||||
tok = self.lex()
|
||||
|
|
|
@ -94,10 +94,9 @@ class TestProvider:
|
|||
if self.canceled:
|
||||
self.lock.release()
|
||||
return None
|
||||
|
||||
try:
|
||||
item = self.iter.next()
|
||||
except StopIteration:
|
||||
for item in self.iter:
|
||||
break
|
||||
else:
|
||||
item = None
|
||||
self.lock.release()
|
||||
return item
|
||||
|
|
Loading…
Reference in New Issue