JS backend: added @Nullable to JsNameRef#getName and added assertion to get more information for reproduce #EA-66032
This commit is contained in:
@@ -7,6 +7,7 @@ package com.google.dart.compiler.backend.js.ast;
|
||||
import com.google.dart.compiler.common.Symbol;
|
||||
import com.google.dart.compiler.util.AstUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Represents a JavaScript expression that references a name.
|
||||
@@ -43,6 +44,7 @@ public final class JsNameRef extends JsExpressionImpl implements HasName {
|
||||
return (name == null) ? ident : name.getIdent();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public JsName getName() {
|
||||
return name;
|
||||
|
||||
@@ -248,9 +248,10 @@ public final class TranslationUtils {
|
||||
|
||||
JsExpression thenExpression = ensureNotNull.getThenExpression();
|
||||
if (thenExpression instanceof JsNameRef) {
|
||||
// associate (cache) ensureNotNull expression to new TemporaryConstVariable with same name.
|
||||
context.associateExpressionToLazyValue(ensureNotNull,
|
||||
new TemporaryConstVariable(((JsNameRef) thenExpression).getName(), ensureNotNull));
|
||||
JsName name = ((JsNameRef) thenExpression).getName();
|
||||
assert name != null : "Unexpected state: getName() returned null for `" +thenExpression + "`, ensureNotNull: "+ ensureNotNull;
|
||||
// associate(cache) ensureNotNull expression to new TemporaryConstVariable with same name.
|
||||
context.associateExpressionToLazyValue(ensureNotNull, new TemporaryConstVariable(name, ensureNotNull));
|
||||
}
|
||||
|
||||
return ensureNotNull;
|
||||
|
||||
Reference in New Issue
Block a user