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 file defines the module loader for the dart runtime. | 5 /* This file defines the module loader for the dart runtime. |
6 */ | 6 */ |
7 | 7 |
8 var dart_library = | 8 var dart_library = |
9 typeof module != "undefined" && module.exports || {}; | 9 typeof module != "undefined" && module.exports || {}; |
10 | 10 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 } | 100 } |
101 dart_library.start = start; | 101 dart_library.start = start; |
102 | 102 |
103 let _bootstrapped = false; | 103 let _bootstrapped = false; |
104 function bootstrap() { | 104 function bootstrap() { |
105 if (_bootstrapped) return; | 105 if (_bootstrapped) return; |
106 _bootstrapped = true; | 106 _bootstrapped = true; |
107 | 107 |
108 // Force import of core. | 108 // Force import of core. |
109 var dart_sdk = import_('dart_sdk'); | 109 var dart_sdk = import_('dart_sdk'); |
110 var core = dart_sdk.core; | |
111 | |
112 // TODO(jmesserly): this can't be right. | |
113 // See: https://github.com/dart-lang/dev_compiler/issues/488 | |
114 core.Object.toString = function() { | |
115 // Interface types are represented by the corresponding constructor | |
116 // function. This ensures that Dart interface types print properly. | |
117 return this.name; | |
118 } | |
119 | 110 |
120 // TODO(vsm): DOM facades? | 111 // TODO(vsm): DOM facades? |
121 // See: https://github.com/dart-lang/dev_compiler/issues/173 | 112 // See: https://github.com/dart-lang/dev_compiler/issues/173 |
122 if (typeof NodeList !== "undefined") { | 113 if (typeof NodeList !== "undefined") { |
123 NodeList.prototype.get = function(i) { return this[i]; }; | 114 NodeList.prototype.get = function(i) { return this[i]; }; |
124 NamedNodeMap.prototype.get = function(i) { return this[i]; }; | 115 NamedNodeMap.prototype.get = function(i) { return this[i]; }; |
125 DOMTokenList.prototype.get = function(i) { return this[i]; }; | 116 DOMTokenList.prototype.get = function(i) { return this[i]; }; |
126 HTMLCollection.prototype.get = function(i) { return this[i]; }; | 117 HTMLCollection.prototype.get = function(i) { return this[i]; }; |
127 } | 118 } |
128 | 119 |
129 // This import is only needed for chrome debugging. We should provide an | 120 // This import is only needed for chrome debugging. We should provide an |
130 // option to compile without it. | 121 // option to compile without it. |
131 dart_sdk._debugger.registerDevtoolsFormatter(); | 122 dart_sdk._debugger.registerDevtoolsFormatter(); |
132 } | 123 } |
133 | 124 |
134 })(dart_library); | 125 })(dart_library); |
OLD | NEW |