Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1208)

Unified Diff: pkg/front_end/lib/src/fasta/type_inference/type_schema_environment.dart

Issue 2942623004: Fuse top level type inference with dependency generation. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/front_end/lib/src/fasta/type_inference/type_schema_environment.dart
diff --git a/pkg/front_end/lib/src/fasta/type_inference/type_schema_environment.dart b/pkg/front_end/lib/src/fasta/type_inference/type_schema_environment.dart
index 4c3d53ae8e53c8d184bdf70bcac52627e4e986cd..4336d919eaca55405599ca5ea3f1f6d53c9cc72e 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/type_schema_environment.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/type_schema_environment.dart
@@ -402,14 +402,22 @@ class TypeSchemaEnvironment extends TypeEnvironment {
/// True if [member] is a binary operator that returns an `int` if both
/// operands are `int`, and otherwise returns `double`.
///
+ /// Note that this behavior depends on the receiver type, so we can only make
+ /// this determination if we know the type of the receiver.
+ ///
/// This is a case of type-based overloading, which in Dart is only supported
/// by giving special treatment to certain arithmetic operators.
- bool isOverloadedArithmeticOperator(Procedure member) {
+ bool isOverloadedArithmeticOperatorAndType(
+ Procedure member, DartType receiverType) {
// TODO(paulberry): this matches what is defined in the spec. It would be
// nice if we could change kernel to match the spec and not have to
// override.
if (member.name.name == 'remainder') return false;
- return super.isOverloadedArithmeticOperator(member);
+ if (!(receiverType is InterfaceType &&
+ identical(receiverType.classNode, coreTypes.intClass))) {
+ return false;
+ }
+ return isOverloadedArithmeticOperator(member);
}
@override

Powered by Google App Engine
This is Rietveld 408576698