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

Side by Side Diff: pkg/compiler/lib/src/inferrer/inferrer_visitor.dart

Issue 1583623002: dart2js inferrer: don't infer widened type when unreachable (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: reformat Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | pkg/compiler/lib/src/inferrer/type_graph_nodes.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library inferrer_visitor; 5 library inferrer_visitor;
6 6
7 import 'dart:collection' show IterableMixin; 7 import 'dart:collection' show IterableMixin;
8 8
9 import '../common.dart'; 9 import '../common.dart';
10 import '../compiler.dart' show Compiler; 10 import '../compiler.dart' show Compiler;
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 named.forEach((name, type) { 307 named.forEach((name, type) {
308 if (other.named[name] != type) return false; 308 if (other.named[name] != type) return false;
309 }); 309 });
310 return true; 310 return true;
311 } 311 }
312 312
313 int get hashCode => throw new UnsupportedError('ArgumentsTypes.hashCode'); 313 int get hashCode => throw new UnsupportedError('ArgumentsTypes.hashCode');
314 314
315 bool hasNoArguments() => positional.isEmpty && named.isEmpty; 315 bool hasNoArguments() => positional.isEmpty && named.isEmpty;
316 316
317 bool hasOnePositionalArgumentThatMatches(bool f(T type)) {
318 return named.isEmpty && positional.length == 1 && f(positional[0]);
319 }
320
321 void forEach(void f(T type)) { 317 void forEach(void f(T type)) {
322 positional.forEach(f); 318 positional.forEach(f);
323 named.values.forEach(f); 319 named.values.forEach(f);
324 } 320 }
325 321
326 bool every(bool f(T type)) { 322 bool every(bool f(T type)) {
327 return positional.every(f) && named.values.every(f); 323 return positional.every(f) && named.values.every(f);
328 } 324 }
329 325
330 bool contains(T type) { 326 bool contains(T type) {
(...skipping 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after
1487 return type; 1483 return type;
1488 } 1484 }
1489 1485
1490 T visitCascade(Cascade node) { 1486 T visitCascade(Cascade node) {
1491 // Ignore the result of the cascade send and return the type of the cascade 1487 // Ignore the result of the cascade send and return the type of the cascade
1492 // receiver. 1488 // receiver.
1493 visit(node.expression); 1489 visit(node.expression);
1494 return cascadeReceiverStack.removeLast(); 1490 return cascadeReceiverStack.removeLast();
1495 } 1491 }
1496 } 1492 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/inferrer/type_graph_nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698