Inline useless temp var in ForTranslator.
Also fix formatting. Adapted from https://github.com/develar/kotlin/commit/a9e0a42fb1347fa8e21c86b5a073ef8a7c873da0.
This commit is contained in:
+2
-3
@@ -22,7 +22,6 @@ import com.google.dart.compiler.backend.js.ast.JsName;
|
|||||||
import com.google.dart.compiler.backend.js.ast.JsStatement;
|
import com.google.dart.compiler.backend.js.ast.JsStatement;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.jet.lang.psi.JetForExpression;
|
import org.jetbrains.jet.lang.psi.JetForExpression;
|
||||||
import org.jetbrains.jet.lang.psi.JetParameter;
|
|
||||||
import org.jetbrains.k2js.translate.context.TranslationContext;
|
import org.jetbrains.k2js.translate.context.TranslationContext;
|
||||||
import org.jetbrains.k2js.translate.general.AbstractTranslator;
|
import org.jetbrains.k2js.translate.general.AbstractTranslator;
|
||||||
import org.jetbrains.k2js.translate.general.Translation;
|
import org.jetbrains.k2js.translate.general.Translation;
|
||||||
@@ -64,14 +63,14 @@ public abstract class ForTranslator extends AbstractTranslator {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private JsName declareParameter() {
|
private JsName declareParameter() {
|
||||||
JetParameter loopParameter = getLoopParameter(expression);
|
return context().getNameForElement(getLoopParameter(expression));
|
||||||
return context().getNameForElement(loopParameter);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
protected JsStatement translateOriginalBodyExpression() {
|
protected JsStatement translateOriginalBodyExpression() {
|
||||||
return Translation.translateAsStatement(getLoopBody(expression), context());
|
return Translation.translateAsStatement(getLoopBody(expression), context());
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
protected JsStatement translateBody(JsExpression itemValue) {
|
protected JsStatement translateBody(JsExpression itemValue) {
|
||||||
JsStatement currentVar = newVar(parameterName, itemValue);
|
JsStatement currentVar = newVar(parameterName, itemValue);
|
||||||
|
|||||||
Reference in New Issue
Block a user