Skip to content

Commit

Permalink
Change parameter 'silent' => 'instrumented'
Browse files Browse the repository at this point in the history
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 <[email protected]>
Commit-Queue: Dmitry Stefantsov <[email protected]>
Reviewed-by: Dmitry Stefantsov <[email protected]>
  • Loading branch information
Kevin Millikin authored and [email protected] committed Oct 24, 2018
1 parent e4e82da commit 5c90602
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 28 deletions.
8 changes: 4 additions & 4 deletions pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -511,8 +511,8 @@ class InferenceVistor extends BodyVisitor1<void, DartType> {
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(
Expand Down Expand Up @@ -956,8 +956,8 @@ class InferenceVistor extends BodyVisitor1<void, DartType> {

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,
Expand Down
6 changes: 3 additions & 3 deletions pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down
40 changes: 19 additions & 21 deletions pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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',
Expand Down Expand Up @@ -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) {
Expand All @@ -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;
Expand All @@ -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));
}
Expand All @@ -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;
}
Expand All @@ -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) {
Expand All @@ -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));
Expand All @@ -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;
}
Expand All @@ -919,18 +919,18 @@ 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,
errorTemplate: templateUndefinedSetter,
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));
Expand All @@ -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;
}
Expand Down Expand Up @@ -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 &&
Expand Down

0 comments on commit 5c90602

Please sign in to comment.