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

Side by Side Diff: lib/src/codegen/js_module_item_order.dart

Issue 1310943005: fix `dynamic` type literal (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 3 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 | test/browser/language_tests.js » ('j') | 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 import 'dart:collection' show HashMap; 5 import 'dart:collection' show HashMap;
6 import 'package:analyzer/src/generated/ast.dart'; 6 import 'package:analyzer/src/generated/ast.dart';
7 import 'package:analyzer/src/generated/element.dart'; 7 import 'package:analyzer/src/generated/element.dart';
8 import 'package:dev_compiler/src/compiler.dart' show corelibOrder; 8 import 'package:dev_compiler/src/compiler.dart' show corelibOrder;
9 9
10 typedef void ModuleItemEmitter(AstNode item); 10 typedef void ModuleItemEmitter(AstNode item);
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 for (var current in _topLevelElements) { 173 for (var current in _topLevelElements) {
174 // TODO(jmesserly): if we want to log what triggered laziness, this is 174 // TODO(jmesserly): if we want to log what triggered laziness, this is
175 // the place to do so. 175 // the place to do so.
176 _loaded[current] = false; 176 _loaded[current] = false;
177 } 177 }
178 } 178 }
179 179
180 bool libraryIsLoaded(LibraryElement library) { 180 bool libraryIsLoaded(LibraryElement library) {
181 assert(library != _currentLibrary); 181 assert(library != _currentLibrary);
182 182
183 // DynamicElementImpl has no library.
184 if (library == null) return true;
185
183 // The SDK is a special case: we optimize the order to prevent laziness. 186 // The SDK is a special case: we optimize the order to prevent laziness.
184 if (_isDartUri(library)) { 187 if (_isDartUri(library)) {
185 // SDK is loaded before non-SDK libraries 188 // SDK is loaded before non-SDK libraries
186 if (!_isDartUri(_currentLibrary)) return true; 189 if (!_isDartUri(_currentLibrary)) return true;
187 190
188 // Compute the order of both SDK libraries. If unknown, assume it's after. 191 // Compute the order of both SDK libraries. If unknown, assume it's after.
189 var order = corelibOrder.indexOf(library.name); 192 var order = corelibOrder.indexOf(library.name);
190 if (order == -1) order = corelibOrder.length; 193 if (order == -1) order = corelibOrder.length;
191 194
192 var currentOrder = corelibOrder.indexOf(_currentLibrary.name); 195 var currentOrder = corelibOrder.indexOf(_currentLibrary.name);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 } 228 }
226 return _libraryCycleMemo[library] = result; 229 return _libraryCycleMemo[library] = result;
227 } 230 }
228 231
229 /// Returns whether this is a library imported with 'dart:' URI. 232 /// Returns whether this is a library imported with 'dart:' URI.
230 /// 233 ///
231 /// This is similar to [LibraryElement.isInSdk], but checking the URI instead 234 /// This is similar to [LibraryElement.isInSdk], but checking the URI instead
232 /// of the library naming convention, because the URI is reliable. 235 /// of the library naming convention, because the URI is reliable.
233 static bool _isDartUri(LibraryElement e) => e.source.uri.scheme == 'dart'; 236 static bool _isDartUri(LibraryElement e) => e.source.uri.scheme == 'dart';
234 } 237 }
OLDNEW
« no previous file with comments | « no previous file | test/browser/language_tests.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698