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

Unified Diff: sdk/lib/_internal/compiler/implementation/inferrer/type_graph_inferrer.dart

Issue 25719002: Use selectors instead of names to know if a call site returns the element of a list. This fixes the… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 2 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
« no previous file with comments | « no previous file | tests/language/list_tracer_call_last_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/inferrer/type_graph_inferrer.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/inferrer/type_graph_inferrer.dart (revision 28140)
+++ sdk/lib/_internal/compiler/implementation/inferrer/type_graph_inferrer.dart (working copy)
@@ -24,22 +24,22 @@
* A set of selector names that [List] implements, that we know return
* their element type.
*/
-Set<String> returnsElementTypeSet = new Set<String>.from(
- const <String>[
- 'first',
- 'last',
- 'single',
- 'singleWhere',
- 'elementAt',
- '[]',
- 'removeAt',
- 'removeLast'
+Set<Selector> returnsElementTypeSet = new Set<Selector>.from(
+ <Selector>[
+ new Selector.getter(const SourceString('first'), null),
+ new Selector.getter(const SourceString('last'), null),
+ new Selector.getter(const SourceString('single'), null),
+ new Selector.call(const SourceString('singleWhere'), null, 1),
+ new Selector.call(const SourceString('elementAt'), null, 1),
+ new Selector.index(),
+ new Selector.call(const SourceString('removeAt'), null, 1),
+ new Selector.call(const SourceString('removeLast'), null, 0)
]);
bool returnsElementType(Selector selector) {
return (selector.mask != null)
&& selector.mask.isContainer
- && returnsElementTypeSet.contains(selector.name.slowToString());
+ && returnsElementTypeSet.contains(selector.asUntyped);
}
class TypeInformationSystem extends TypeSystem<TypeInformation> {
« no previous file with comments | « no previous file | tests/language/list_tracer_call_last_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698