From 5c9060283bd9b6629fa23cb58c9bc416ecdae0b9 Mon Sep 17 00:00:00 2001 From: Kevin Millikin Date: Wed, 24 Oct 2018 08:45:40 +0000 Subject: [PATCH] Change parameter 'silent' => 'instrumented' This requires flipping the default value from false to true. I can never remember what "silent" entails. It sounds like it might suppress some error reporting, but what it actually does is suppress the instrumentation used for checking comments in the test input files. Hopefully this name is more obvious. Change-Id: I922c7107eae32a5d4206aaa6d4507310289ca64d Reviewed-on: https://dart-review.googlesource.com/c/81261 Auto-Submit: Kevin Millikin Commit-Queue: Dmitry Stefantsov Reviewed-by: Dmitry Stefantsov --- .../src/fasta/kernel/inference_visitor.dart | 8 ++-- .../src/fasta/kernel/kernel_shadow_ast.dart | 6 +-- .../fasta/type_inference/type_inferrer.dart | 40 +++++++++---------- 3 files changed, 26 insertions(+), 28 deletions(-) diff --git a/pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart b/pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart index 02dfd9d90b21e..be9f4451cf65a 100644 --- a/pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart +++ b/pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart @@ -511,8 +511,8 @@ class InferenceVistor extends BodyVisitor1 { InvocationExpression read = node.read; DartType readType; if (read != null) { - var readMember = - inferrer.findMethodInvocationMember(receiverType, read, silent: true); + var readMember = inferrer.findMethodInvocationMember(receiverType, read, + instrumented: false); var calleeFunctionType = inferrer.getCalleeFunctionType( inferrer.getCalleeType(readMember, receiverType), false); inferrer.ensureAssignable( @@ -956,8 +956,8 @@ class InferenceVistor extends BodyVisitor1 { DartType readType; if (node.read != null) { - var readMember = - inferrer.findPropertyGetMember(receiverType, node.read, silent: true); + var readMember = inferrer.findPropertyGetMember(receiverType, node.read, + instrumented: false); readType = inferrer.getCalleeType(readMember, receiverType); inferrer.handlePropertyGetContravariance( node.receiver, diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart index 07bc40e064958..80afd413a4c9b 100644 --- a/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart +++ b/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart @@ -425,8 +425,8 @@ abstract class ComplexAssignmentJudgment extends SyntheticExpressionJudgment { DartType combinedType; if (combiner != null) { bool isOverloadedArithmeticOperator = false; - combinerMember = - inferrer.findMethodInvocationMember(readType, combiner, silent: true); + combinerMember = inferrer.findMethodInvocationMember(readType, combiner, + instrumented: false); if (combinerMember is Procedure) { isOverloadedArithmeticOperator = inferrer.typeSchemaEnvironment .isOverloadedArithmeticOperatorAndType(combinerMember, readType); @@ -485,7 +485,7 @@ abstract class ComplexAssignmentJudgment extends SyntheticExpressionJudgment { MethodInvocation equalsInvocation = nullAwareCombiner.condition; inferrer.findMethodInvocationMember( greatestClosure(inferrer.coreTypes, writeContext), equalsInvocation, - silent: true); + instrumented: false); // Note: the case of readType=null only happens for erroneous code. combinedType = readType == null ? rhsType diff --git a/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart b/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart index 0e60ad410953b..5b2dfa6af1f1e 100644 --- a/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart +++ b/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart @@ -774,7 +774,7 @@ abstract class TypeInferrerImpl extends TypeInferrer { Expression expression, Expression receiver, bool setter: false, - bool silent: false}) { + bool instrumented: true}) { assert(receiverType != null && isKnown(receiverType)); // Our non-strong golden files currently don't include interface @@ -792,7 +792,7 @@ abstract class TypeInferrerImpl extends TypeInferrer { ? receiverType.classNode : coreTypes.objectClass; Member interfaceMember = _getInterfaceMember(classNode, name, setter); - if (!silent && + if (instrumented && receiverType != const DynamicType() && interfaceMember != null) { instrumentation?.record(uri, fileOffset, 'target', @@ -830,7 +830,7 @@ abstract class TypeInferrerImpl extends TypeInferrer { /// [methodInvocation]. Object findMethodInvocationMember( DartType receiverType, InvocationExpression methodInvocation, - {bool silent: false}) { + {bool instrumented: true}) { // TODO(paulberry): could we add getters to InvocationExpression to make // these is-checks unnecessary? if (methodInvocation is MethodInvocation) { @@ -839,7 +839,7 @@ abstract class TypeInferrerImpl extends TypeInferrer { errorTemplate: templateUndefinedMethod, expression: methodInvocation, receiver: methodInvocation.receiver, - silent: silent); + instrumented: instrumented); if (receiverType == const DynamicType() && interfaceMember is Procedure) { var arguments = methodInvocation.arguments; var signature = interfaceMember.function; @@ -854,7 +854,7 @@ abstract class TypeInferrerImpl extends TypeInferrer { return null; } } - if (instrumentation != null && !silent) { + if (instrumented && instrumentation != null) { instrumentation.record(uri, methodInvocation.fileOffset, 'target', new InstrumentationValueForMember(interfaceMember)); } @@ -867,7 +867,7 @@ abstract class TypeInferrerImpl extends TypeInferrer { assert(receiverType != const DynamicType()); var interfaceMember = findInterfaceMember( receiverType, methodInvocation.name, methodInvocation.fileOffset, - silent: silent); + instrumented: instrumented); if (strongMode && interfaceMember is Member) { methodInvocation.interfaceTarget = interfaceMember; } @@ -881,7 +881,7 @@ abstract class TypeInferrerImpl extends TypeInferrer { /// Finds a member of [receiverType] called [name], and if it is found, /// reports it through instrumentation and records it in [propertyGet]. Object findPropertyGetMember(DartType receiverType, Expression propertyGet, - {bool silent: false}) { + {bool instrumented: true}) { // TODO(paulberry): could we add a common base class to PropertyGet and // SuperPropertyGet to make these is-checks unnecessary? if (propertyGet is PropertyGet) { @@ -890,10 +890,10 @@ abstract class TypeInferrerImpl extends TypeInferrer { errorTemplate: templateUndefinedGetter, expression: propertyGet, receiver: propertyGet.receiver, - silent: silent); + instrumented: instrumented); if (strongMode && interfaceMember is Member) { - if (instrumentation != null && - !silent && + if (instrumented && + instrumentation != null && receiverType == const DynamicType()) { instrumentation.record(uri, propertyGet.fileOffset, 'target', new InstrumentationValueForMember(interfaceMember)); @@ -905,7 +905,7 @@ abstract class TypeInferrerImpl extends TypeInferrer { assert(receiverType != const DynamicType()); var interfaceMember = findInterfaceMember( receiverType, propertyGet.name, propertyGet.fileOffset, - silent: silent); + instrumented: instrumented); if (strongMode && interfaceMember is Member) { propertyGet.interfaceTarget = interfaceMember; } @@ -919,7 +919,7 @@ abstract class TypeInferrerImpl extends TypeInferrer { /// Finds a member of [receiverType] called [name], and if it is found, /// reports it through instrumentation and records it in [propertySet]. Object findPropertySetMember(DartType receiverType, Expression propertySet, - {bool silent: false}) { + {bool instrumented: true}) { if (propertySet is PropertySet) { var interfaceMember = findInterfaceMember( receiverType, propertySet.name, propertySet.fileOffset, @@ -927,10 +927,10 @@ abstract class TypeInferrerImpl extends TypeInferrer { expression: propertySet, receiver: propertySet.receiver, setter: true, - silent: silent); + instrumented: instrumented); if (strongMode && interfaceMember is Member) { - if (instrumentation != null && - !silent && + if (instrumented && + instrumentation != null && receiverType == const DynamicType()) { instrumentation.record(uri, propertySet.fileOffset, 'target', new InstrumentationValueForMember(interfaceMember)); @@ -942,7 +942,7 @@ abstract class TypeInferrerImpl extends TypeInferrer { assert(receiverType != const DynamicType()); var interfaceMember = findInterfaceMember( receiverType, propertySet.name, propertySet.fileOffset, - setter: true, silent: silent); + setter: true, instrumented: instrumented); if (strongMode && interfaceMember is Member) { propertySet.interfaceTarget = interfaceMember; } @@ -1592,17 +1592,15 @@ abstract class TypeInferrerImpl extends TypeInferrer { if (strongMode) { receiverVariable?.type = receiverType; } - bool isOverloadedArithmeticOperator = false; if (desugaredInvocation != null) { interfaceMember = findMethodInvocationMember(receiverType, desugaredInvocation); methodName = desugaredInvocation.name; arguments = desugaredInvocation.arguments; } - if (interfaceMember is Procedure) { - isOverloadedArithmeticOperator = typeSchemaEnvironment - .isOverloadedArithmeticOperatorAndType(interfaceMember, receiverType); - } + bool isOverloadedArithmeticOperator = interfaceMember is Procedure && + typeSchemaEnvironment.isOverloadedArithmeticOperatorAndType( + interfaceMember, receiverType); var calleeType = getCalleeType(interfaceMember, receiverType); var functionType = getCalleeFunctionType(calleeType, !isImplicitCall); if (interfaceMember != null &&