More comments.
This commit is contained in:
parent
f897342296
commit
a088d367f7
|
@ -269,14 +269,14 @@ public final class EChain extends AExpression {
|
|||
*/
|
||||
@Override
|
||||
void write(MethodWriter writer) {
|
||||
// For the case where the chain represents a String concatenation
|
||||
// we must first write debug information, and then depending on the
|
||||
// Java version write a StringBuilder or track types going onto the
|
||||
// stack. This must be done before the links in the chain are read
|
||||
// because we need the StringBuilder to be placed on the stack
|
||||
// ahead of any potential concatenation arguments.
|
||||
if (cat) {
|
||||
writer.writeDebugInfo(location);
|
||||
|
||||
// For the case where the chain represents a String concatenation
|
||||
// we must, depending on the Java version, write a StringBuilder or
|
||||
// track types going onto the stack. This must be done before the
|
||||
// links in the chain are read because we need the StringBuilder to
|
||||
// be placed on the stack ahead of any potential concatenation arguments.
|
||||
if (cat) {
|
||||
writer.writeNewStrings();
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.painless.node;
|
||||
|
||||
public class SDefEach {
|
||||
}
|
|
@ -88,6 +88,9 @@ public class SEach extends AStatement {
|
|||
Type itr = Definition.getType("Iterator");
|
||||
|
||||
variable = variables.addVariable(location, type, name, true, false);
|
||||
|
||||
// We must store the iterator as a variable for securing a slot on the stack, and
|
||||
// also add the location offset to make the name unique in case of nested for each loops.
|
||||
iterator = variables.addVariable(location, itr, "#itr" + location.getOffset(), true, false);
|
||||
|
||||
method = expression.actual.struct.methods.get(new MethodKey("iterator", 0));
|
||||
|
|
Loading…
Reference in New Issue