Disable type inference: Don't generate shadow wrappers

Change-Id: Ibab49c3614f5e54fe15bdcb135f25db7070d84ca
Reviewed-on: https://dart-review.googlesource.com/c/86342
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
This commit is contained in:
Peter von der Ahé 2018-12-17 14:33:49 +00:00 committed by commit-bot@chromium.org
parent f504d61c96
commit 472bf29904
3 changed files with 11 additions and 1 deletions

View file

@ -274,6 +274,7 @@ abstract class BodyBuilder extends ScopeListener<JumpTarget>
bool get legacyMode => library.loader.target.legacyMode;
@override
bool get disableTypeInference => library.disableTypeInference;
bool get inConstructor {
@ -4859,12 +4860,14 @@ abstract class BodyBuilder extends ScopeListener<JumpTarget>
@override
Expression wrapSyntheticExpression(Expression desugared, int charOffset) {
if (disableTypeInference) return desugared;
return shadow.SyntheticWrapper.wrapSyntheticExpression(desugared)
..fileOffset = charOffset;
}
@override
Expression desugarSyntheticExpression(Expression node) {
if (disableTypeInference) return node;
shadow.SyntheticExpressionJudgment shadowNode = node;
return shadowNode.desugared;
}
@ -4872,6 +4875,7 @@ abstract class BodyBuilder extends ScopeListener<JumpTarget>
@override
Expression wrapInvalidConstructorInvocation(Expression desugared,
Member constructor, Arguments arguments, int charOffset) {
if (disableTypeInference) return desugared;
return shadow.SyntheticWrapper.wrapInvalidConstructorInvocation(
desugared, constructor, arguments)
..fileOffset = charOffset;
@ -4880,6 +4884,7 @@ abstract class BodyBuilder extends ScopeListener<JumpTarget>
@override
Expression wrapInvalidWrite(
Expression desugared, Expression expression, int charOffset) {
if (disableTypeInference) return desugared;
return shadow.SyntheticWrapper.wrapInvalidWrite(desugared, expression)
..fileOffset = charOffset;
}
@ -4887,6 +4892,7 @@ abstract class BodyBuilder extends ScopeListener<JumpTarget>
@override
Expression wrapUnresolvedTargetInvocation(
Expression desugared, Arguments arguments, int charOffset) {
if (disableTypeInference) return desugared;
return shadow.SyntheticWrapper.wrapUnresolvedTargetInvocation(
desugared, arguments)
..fileOffset = charOffset;
@ -4895,6 +4901,7 @@ abstract class BodyBuilder extends ScopeListener<JumpTarget>
@override
Expression wrapUnresolvedVariableAssignment(
Expression desugared, bool isCompound, Expression rhs, int charOffset) {
if (disableTypeInference) return desugared;
return shadow.SyntheticWrapper.wrapUnresolvedVariableAssignment(
desugared, isCompound, rhs)
..fileOffset = charOffset;

View file

@ -57,6 +57,8 @@ abstract class ExpressionGeneratorHelper implements InferenceHelper {
Forest get forest;
bool get disableTypeInference;
Constructor lookupConstructor(Name name, {bool isSuper});
Expression toValue(node);

View file

@ -284,7 +284,7 @@ abstract class KernelExpressionGenerator implements ExpressionGenerator {
Expression _finish(
Expression body, ComplexAssignmentJudgment complexAssignment) {
if (complexAssignment != null) {
if (!helper.disableTypeInference && complexAssignment != null) {
complexAssignment.desugared = body;
return complexAssignment;
} else {
@ -578,6 +578,7 @@ class KernelNullAwarePropertyAccessGenerator extends KernelGenerator
..fileOffset = offset;
if (complexAssignment != null) {
body = makeLet(receiver, nullAwareGuard);
if (helper.disableTypeInference) return body;
shadow.PropertyAssignmentJudgment kernelPropertyAssign =
complexAssignment;
kernelPropertyAssign.nullAwareGuard = nullAwareGuard;