PSI getter fixed: left-hand side of a binary expression can now be null
EA-35976 - IAE: FqNameUnsafe.validateFqName
This commit is contained in:
+4
-1
@@ -23,6 +23,7 @@ import com.google.dart.compiler.backend.js.ast.JsLiteral;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.descriptors.FunctionDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.JetBinaryExpression;
|
||||
import org.jetbrains.jet.lang.psi.JetExpression;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
import org.jetbrains.jet.lang.types.expressions.OperatorConventions;
|
||||
import org.jetbrains.jet.lexer.JetTokens;
|
||||
@@ -69,7 +70,9 @@ public final class EqualsIntrinsic implements BinaryOperationIntrinsic {
|
||||
}
|
||||
|
||||
private static boolean canUseSimpleEquals(@NotNull JetBinaryExpression expression, @NotNull TranslationContext context) {
|
||||
Name typeName = JsDescriptorUtils.getNameIfStandardType(expression.getLeft(), context);
|
||||
JetExpression left = expression.getLeft();
|
||||
assert left != null : "No left-hand side: " + expression.getText();
|
||||
Name typeName = JsDescriptorUtils.getNameIfStandardType(left, context);
|
||||
return typeName != null && NamePredicate.PRIMITIVE_NUMBERS.apply(typeName);
|
||||
}
|
||||
}
|
||||
|
||||
+4
-1
@@ -19,6 +19,7 @@ package org.jetbrains.k2js.translate.operation;
|
||||
import com.google.dart.compiler.backend.js.ast.JsExpression;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.psi.JetBinaryExpression;
|
||||
import org.jetbrains.jet.lang.psi.JetExpression;
|
||||
import org.jetbrains.jet.lang.types.expressions.OperatorConventions;
|
||||
import org.jetbrains.jet.lexer.JetToken;
|
||||
import org.jetbrains.k2js.translate.context.TranslationContext;
|
||||
@@ -61,7 +62,9 @@ public abstract class AssignmentTranslator extends AbstractTranslator {
|
||||
super(context);
|
||||
this.expression = expression;
|
||||
this.isVariableReassignment = isVariableReassignment(context.bindingContext(), expression);
|
||||
this.accessTranslator = AccessTranslationUtils.getAccessTranslator(expression.getLeft(), context());
|
||||
JetExpression left = expression.getLeft();
|
||||
assert left != null : "No left-hand side: " + expression.getText();
|
||||
this.accessTranslator = AccessTranslationUtils.getAccessTranslator(left, context());
|
||||
this.right = translateRightExpression(context(), expression);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,7 +153,9 @@ public final class TranslationUtils {
|
||||
@NotNull
|
||||
public static JsExpression translateLeftExpression(@NotNull TranslationContext context,
|
||||
@NotNull JetBinaryExpression expression) {
|
||||
return Translation.translateAsExpression(expression.getLeft(), context);
|
||||
JetExpression left = expression.getLeft();
|
||||
assert left != null : "Binary expression should have a left expression: " + expression.getText();
|
||||
return Translation.translateAsExpression(left, context);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
Reference in New Issue
Block a user