| 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 var dart, _js_helper; | 5 var dart, _js_helper; |
| 6 (function (dart) { | 6 (function (dart) { |
| 7 'use strict'; | 7 'use strict'; |
| 8 | 8 |
| 9 let defineProperty = Object.defineProperty; | 9 let defineProperty = Object.defineProperty; |
| 10 let getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; | 10 let getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 var desc = getOwnPropertyDescriptor(obj, name); | 227 var desc = getOwnPropertyDescriptor(obj, name); |
| 228 if (desc) return desc.value; | 228 if (desc) return desc.value; |
| 229 } | 229 } |
| 230 | 230 |
| 231 function isClassSubType(t1, t2) { | 231 function isClassSubType(t1, t2) { |
| 232 // We support Dart's covariant generics with the caveat that we do not | 232 // We support Dart's covariant generics with the caveat that we do not |
| 233 // substitute bottom for dynamic in subtyping rules. | 233 // substitute bottom for dynamic in subtyping rules. |
| 234 // I.e., given T1, ..., Tn where at least one Ti != dynamic we disallow: | 234 // I.e., given T1, ..., Tn where at least one Ti != dynamic we disallow: |
| 235 // - S !<: S<T1, ..., Tn> | 235 // - S !<: S<T1, ..., Tn> |
| 236 // - S<dynamic, ..., dynamic> !<: S<T1, ..., Tn> | 236 // - S<dynamic, ..., dynamic> !<: S<T1, ..., Tn> |
| 237 t1 = canonicalType(t1); |
| 238 assert(t2 == canonicalType(t2)); |
| 237 if (t1 == t2) return true; | 239 if (t1 == t2) return true; |
| 238 | 240 |
| 239 if (t1 == core.Object) return false; | 241 if (t1 == core.Object) return false; |
| 240 | 242 |
| 241 // If t1 is a JS Object, we may not hit core.Object. | 243 // If t1 is a JS Object, we may not hit core.Object. |
| 242 if (t1 == null) return t2 == core.Object || t2 == dart.dynamic; | 244 if (t1 == null) return t2 == core.Object || t2 == dart.dynamic; |
| 243 | 245 |
| 244 // Check if t1 and t2 have the same raw type. If so, check covariance on | 246 // Check if t1 and t2 have the same raw type. If so, check covariance on |
| 245 // type parameters. | 247 // type parameters. |
| 246 let raw1 = safeGetOwnProperty(t1, dart.originalDeclaration); | 248 let raw1 = safeGetOwnProperty(t1, dart.originalDeclaration); |
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 754 // TODO(vsm): How should we encode the runtime type? | 756 // TODO(vsm): How should we encode the runtime type? |
| 755 dart.runtimeType = Symbol('runtimeType'); | 757 dart.runtimeType = Symbol('runtimeType'); |
| 756 | 758 |
| 757 dart.JsSymbol = Symbol; | 759 dart.JsSymbol = Symbol; |
| 758 | 760 |
| 759 // TODO(jmesserly): hack to bootstrap the SDK | 761 // TODO(jmesserly): hack to bootstrap the SDK |
| 760 _js_helper = _js_helper || {}; | 762 _js_helper = _js_helper || {}; |
| 761 _js_helper.checkNum = notNull; | 763 _js_helper.checkNum = notNull; |
| 762 | 764 |
| 763 })(dart || (dart = {})); | 765 })(dart || (dart = {})); |
| OLD | NEW |