OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 /// This library defines the representation of runtime types. | 5 /// This library defines the representation of runtime types. |
6 part of dart._runtime; | 6 part of dart._runtime; |
7 | 7 |
8 /// The Symbol for storing type arguments on a specialized generic type. | 8 /// The Symbol for storing type arguments on a specialized generic type. |
9 final _mixins = JS('', 'Symbol("mixins")'); | 9 final _mixins = JS('', 'Symbol("mixins")'); |
10 @JSExportName('implements') | 10 @JSExportName('implements') |
(...skipping 20 matching lines...) Expand all Loading... |
31 /// Function types are represented in one of two ways: | 31 /// Function types are represented in one of two ways: |
32 /// - As an instance of FunctionType. These are eagerly computed. | 32 /// - As an instance of FunctionType. These are eagerly computed. |
33 /// - As an instance of TypeDef. The TypeDef representation lazily | 33 /// - As an instance of TypeDef. The TypeDef representation lazily |
34 /// computes an instance of FunctionType, and delegates to that instance. | 34 /// computes an instance of FunctionType, and delegates to that instance. |
35 /// | 35 /// |
36 /// All types satisfy the following interface: | 36 /// All types satisfy the following interface: |
37 /// get String name; | 37 /// get String name; |
38 /// String toString(); | 38 /// String toString(); |
39 /// | 39 /// |
40 /// | 40 /// |
| 41 final _TypeRepBase = JS('', '$LazyTagged(() => $Type)'); |
41 final TypeRep = JS('', ''' | 42 final TypeRep = JS('', ''' |
42 class TypeRep extends $LazyTagged(() => $Type) { | 43 class TypeRep extends $_TypeRepBase { |
43 get name() {return this.toString();} | 44 get name() {return this.toString();} |
44 } | 45 } |
45 '''); | 46 '''); |
46 | 47 |
47 final Dynamic = JS('', ''' | 48 final Dynamic = JS('', ''' |
48 class Dynamic extends $TypeRep { | 49 class Dynamic extends $TypeRep { |
49 toString() { return "dynamic"; } | 50 toString() { return "dynamic"; } |
50 } | 51 } |
51 '''); | 52 '''); |
52 @JSExportName('dynamic') | 53 @JSExportName('dynamic') |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 return true; | 537 return true; |
537 } | 538 } |
538 | 539 |
539 let typeArgs = $getGenericArgs($type); | 540 let typeArgs = $getGenericArgs($type); |
540 if (!typeArgs) return true; | 541 if (!typeArgs) return true; |
541 for (let t of typeArgs) { | 542 for (let t of typeArgs) { |
542 if (t != $Object && t != $dynamicR) return false; | 543 if (t != $Object && t != $dynamicR) return false; |
543 } | 544 } |
544 return true; | 545 return true; |
545 })()'''); | 546 })()'''); |
OLD | NEW |