| 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 */ | 6 */ |
| 7 | 7 |
| 8 dart_library.library('dart_runtime/_types', null, /* Imports */[ | 8 dart_library.library('dart_runtime/_types', null, /* Imports */[ |
| 9 ], /* Lazy Imports */[ | 9 ], /* Lazy Imports */[ |
| 10 'dart/core', | 10 'dart/core', |
| 11 'dart_runtime/_classes', | 11 'dart_runtime/_classes', |
| 12 'dart_runtime/_rtti' | 12 'dart_runtime/_rtti' |
| 13 ], function(exports, core, classes, rtti) { | 13 ], function(exports, core, classes, rtti) { |
| 14 'use strict'; | 14 'use strict'; |
| 15 | 15 |
| 16 const getOwnPropertyNames = Object.getOwnPropertyNames; | 16 const getOwnPropertyNames = Object.getOwnPropertyNames; |
| 17 | 17 |
| 18 const assert = dart_utils.assert; | 18 const assert = dart_utils.assert; |
| 19 const copyProperties = dart_utils.copyProperties; | |
| 20 const safeGetOwnProperty = dart_utils.safeGetOwnProperty; | |
| 21 | 19 |
| 22 /** | 20 /** |
| 23 * Types in dart are represented at runtime as follows. | 21 * Types in dart are represented at runtime as follows. |
| 24 * - Normal nominal types, produced from classes, are represented | 22 * - Normal nominal types, produced from classes, are represented |
| 25 * at runtime by the JS class of which they are an instance. | 23 * at runtime by the JS class of which they are an instance. |
| 26 * If the type is the result of instantiating a generic class, | 24 * If the type is the result of instantiating a generic class, |
| 27 * then the "classes" module manages the association between the | 25 * then the "classes" module manages the association between the |
| 28 * instantiated class and the original class declaration | 26 * instantiated class and the original class declaration |
| 29 * and the type arguments with which it was instantiated. This | 27 * and the type arguments with which it was instantiated. This |
| 30 * assocation can be queried via the "classes" module". | 28 * assocation can be queried via the "classes" module". |
| (...skipping 26 matching lines...) Expand all Loading... |
| 57 | 55 |
| 58 class Void extends TypeRep { | 56 class Void extends TypeRep { |
| 59 toString() { return "void"; } | 57 toString() { return "void"; } |
| 60 } | 58 } |
| 61 | 59 |
| 62 let voidR = new Void(); | 60 let voidR = new Void(); |
| 63 exports.void = voidR; | 61 exports.void = voidR; |
| 64 | 62 |
| 65 class Bottom extends TypeRep { | 63 class Bottom extends TypeRep { |
| 66 toString() { return "bottom"; } | 64 toString() { return "bottom"; } |
| 67 }; | 65 } |
| 68 let bottomR = new Bottom(); | 66 let bottomR = new Bottom(); |
| 69 exports.bottom = bottomR; | 67 exports.bottom = bottomR; |
| 70 | 68 |
| 71 class JSObject extends TypeRep { | 69 class JSObject extends TypeRep { |
| 72 toString() { return "NativeJavaScriptObject"; } | 70 toString() { return "NativeJavaScriptObject"; } |
| 73 }; | 71 } |
| 74 let jsobjectR = new JSObject(); | 72 let jsobjectR = new JSObject(); |
| 75 exports.jsobject = jsobjectR; | 73 exports.jsobject = jsobjectR; |
| 76 | 74 |
| 77 class AbstractFunctionType extends TypeRep { | 75 class AbstractFunctionType extends TypeRep { |
| 78 constructor() { | 76 constructor() { |
| 79 super(); | 77 super(); |
| 80 this._stringValue = null; | 78 this._stringValue = null; |
| 81 } | 79 } |
| 82 | 80 |
| 83 toString() { return this.name; } | 81 toString() { return this.name; } |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 let typeArgs = classes.getGenericArgs(type); | 537 let typeArgs = classes.getGenericArgs(type); |
| 540 if (!typeArgs) return true; | 538 if (!typeArgs) return true; |
| 541 for (let t of typeArgs) { | 539 for (let t of typeArgs) { |
| 542 if (t != core.Object && t != dynamicR) return false; | 540 if (t != core.Object && t != dynamicR) return false; |
| 543 } | 541 } |
| 544 return true; | 542 return true; |
| 545 } | 543 } |
| 546 exports.isGroundType = isGroundType; | 544 exports.isGroundType = isGroundType; |
| 547 | 545 |
| 548 }); | 546 }); |
| OLD | NEW |