OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |