mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-20 07:15:31 +00:00
8015674: CodeGenerator.initSymbols mutates a list
Reviewed-by: jlaskey, lagergren
This commit is contained in:
parent
9617ee41ca
commit
102a06fdef
@ -456,17 +456,18 @@ final class CodeGenerator extends NodeOperatorVisitor<CodeGeneratorLexicalContex
|
||||
}
|
||||
|
||||
private void initSymbols(final LinkedList<Symbol> symbols, final Type type) {
|
||||
if (symbols.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
method.loadUndefined(type);
|
||||
while (!symbols.isEmpty()) {
|
||||
final Symbol symbol = symbols.removeFirst();
|
||||
if (!symbols.isEmpty()) {
|
||||
method.dup();
|
||||
}
|
||||
method.store(symbol);
|
||||
final Iterator<Symbol> it = symbols.iterator();
|
||||
if(it.hasNext()) {
|
||||
method.loadUndefined(type);
|
||||
boolean hasNext;
|
||||
do {
|
||||
final Symbol symbol = it.next();
|
||||
hasNext = it.hasNext();
|
||||
if(hasNext) {
|
||||
method.dup();
|
||||
}
|
||||
method.store(symbol);
|
||||
} while(hasNext);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user