OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 dart_types; | 5 library dart_types; |
6 | 6 |
7 import 'dart:math' show min; | 7 import 'dart:math' show min; |
8 | 8 |
9 import 'core_types.dart'; | 9 import 'core_types.dart'; |
10 import 'dart2jslib.dart' show Compiler, invariant, Script, Message; | 10 import 'dart2jslib.dart' show Compiler, invariant, Script, Message; |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 bool get isEnumType => element.isEnumClass; | 468 bool get isEnumType => element.isEnumClass; |
469 | 469 |
470 InterfaceType createInstantiation(List<DartType> newTypeArguments) { | 470 InterfaceType createInstantiation(List<DartType> newTypeArguments) { |
471 return new InterfaceType(element, newTypeArguments); | 471 return new InterfaceType(element, newTypeArguments); |
472 } | 472 } |
473 | 473 |
474 /** | 474 /** |
475 * Returns the type as an instance of class [other], if possible, null | 475 * Returns the type as an instance of class [other], if possible, null |
476 * otherwise. | 476 * otherwise. |
477 */ | 477 */ |
478 DartType asInstanceOf(ClassElement other) { | 478 InterfaceType asInstanceOf(ClassElement other) { |
479 other = other.declaration; | 479 other = other.declaration; |
480 if (element == other) return this; | 480 if (element == other) return this; |
481 InterfaceType supertype = element.asInstanceOf(other); | 481 InterfaceType supertype = element.asInstanceOf(other); |
482 if (supertype != null) { | 482 if (supertype != null) { |
483 List<DartType> arguments = Types.substTypes(supertype.typeArguments, | 483 List<DartType> arguments = Types.substTypes(supertype.typeArguments, |
484 typeArguments, | 484 typeArguments, |
485 element.typeVariables); | 485 element.typeVariables); |
486 return new InterfaceType(supertype.element, arguments); | 486 return new InterfaceType(supertype.element, arguments); |
487 } | 487 } |
488 return null; | 488 return null; |
(...skipping 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1816 } | 1816 } |
1817 namedParameterTypes[index].accept(this, namedParameters[index]); | 1817 namedParameterTypes[index].accept(this, namedParameters[index]); |
1818 needsComma = true; | 1818 needsComma = true; |
1819 } | 1819 } |
1820 sb.write('}'); | 1820 sb.write('}'); |
1821 } | 1821 } |
1822 sb.write(')'); | 1822 sb.write(')'); |
1823 } | 1823 } |
1824 } | 1824 } |
1825 | 1825 |
OLD | NEW |