Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: pkg/dev_compiler/lib/js/legacy/dart_library.js

Issue 2738103003: Fix custom formatter setup, take 2 (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 var dart_library; 7 var dart_library;
8 if (!dart_library) { 8 if (!dart_library) {
9 dart_library = 9 dart_library =
10 typeof module != "undefined" && module.exports || {}; 10 typeof module != "undefined" && module.exports || {};
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 console.warn('Already loaded ' + name); 146 console.warn('Already loaded ' + name);
147 return result; 147 return result;
148 } 148 }
149 result = new LibraryLoader(name, defaultValue, imports, loader); 149 result = new LibraryLoader(name, defaultValue, imports, loader);
150 libraries.set(name, result); 150 libraries.set(name, result);
151 return result; 151 return result;
152 } 152 }
153 dart_library.library = library; 153 dart_library.library = library;
154 154
155 function import_(libraryName) { 155 function import_(libraryName) {
156 bootstrap();
157 let loader = libraries.get(libraryName); 156 let loader = libraries.get(libraryName);
158 // TODO(vsm): A user might call this directly from JS (as we do in tests). 157 // TODO(vsm): A user might call this directly from JS (as we do in tests).
159 // We may want a different error type. 158 // We may want a different error type.
160 if (!loader) throwLibraryError('Library not found: ' + libraryName); 159 if (!loader) throwLibraryError('Library not found: ' + libraryName);
161 return loader.load(); 160 return loader.load();
162 } 161 }
163 dart_library.import = import_; 162 dart_library.import = import_;
164 163
165 var _currentIsolate = false; 164 var _currentIsolate = false;
166 165
167 function start(moduleName, libraryName) { 166 function start(moduleName, libraryName) {
168 if (libraryName == null) libraryName = moduleName; 167 if (libraryName == null) libraryName = moduleName;
169 let library = import_(moduleName)[libraryName]; 168 let library = import_(moduleName)[libraryName];
170 let dart_sdk = import_('dart_sdk'); 169 let dart_sdk = import_('dart_sdk');
171 170
172 // This import is only needed for chrome debugging. We should provide an 171 if (!_currentIsolate) {
173 // option to compile without it. 172 // This import is only needed for chrome debugging. We should provide an
174 dart_sdk._debugger.registerDevtoolsFormatter(); 173 // option to compile without it.
174 dart_sdk._debugger.registerDevtoolsFormatter();
175 175
176 if (!_currentIsolate) {
177 // Create isolate. 176 // Create isolate.
178 _currentIsolate = true; 177 _currentIsolate = true;
179 dart_sdk._isolate_helper.startRootIsolate(() => {}, []); 178 dart_sdk._isolate_helper.startRootIsolate(() => {}, []);
180 } 179 }
181 180
182 library.main(); 181 library.main();
183 } 182 }
184 dart_library.start = start; 183 dart_library.start = start;
185 184
186 let _bootstrapped = false;
187 function bootstrap() {
188 if (_bootstrapped) return;
189 _bootstrapped = true;
190 }
191
192 })(dart_library); 185 })(dart_library);
193 } 186 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698