| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 library dart2js.compiler_base; | 5 library dart2js.compiler_base; |
| 6 | 6 |
| 7 import 'dart:async' show Future; | 7 import 'dart:async' show Future; |
| 8 | 8 |
| 9 import '../compiler_new.dart' as api; | 9 import '../compiler_new.dart' as api; |
| 10 import 'closure.dart' as closureMapping show ClosureTask; | 10 import 'closure.dart' as closureMapping show ClosureTask; |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 | 205 |
| 206 backend = createBackend(); | 206 backend = createBackend(); |
| 207 enqueuer = backend.makeEnqueuer(); | 207 enqueuer = backend.makeEnqueuer(); |
| 208 | 208 |
| 209 tasks = [ | 209 tasks = [ |
| 210 dietParser = new DietParserTask(idGenerator, backend, reporter, measurer), | 210 dietParser = new DietParserTask(idGenerator, backend, reporter, measurer), |
| 211 scanner = createScannerTask(), | 211 scanner = createScannerTask(), |
| 212 serialization = new SerializationTask(this), | 212 serialization = new SerializationTask(this), |
| 213 patchParser = new PatchParserTask(this), | 213 patchParser = new PatchParserTask(this), |
| 214 libraryLoader = new LibraryLoaderTask( | 214 libraryLoader = new LibraryLoaderTask( |
| 215 options.loadFromDill, | |
| 216 resolvedUriTranslator, | 215 resolvedUriTranslator, |
| 217 options.compileOnly | 216 options.compileOnly |
| 218 ? new _NoScriptLoader(this) | 217 ? new _NoScriptLoader(this) |
| 219 : new _ScriptLoader(this), | 218 : new _ScriptLoader(this), |
| 220 new _ElementScanner(scanner), | 219 new _ElementScanner(scanner), |
| 221 serialization, | 220 serialization, |
| 222 resolvePatchUri, | 221 resolvePatchUri, |
| 223 patchParser, | 222 patchParser, |
| 224 environment, | 223 environment, |
| 225 reporter, | 224 reporter, |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 !link.isEmpty; | 341 !link.isEmpty; |
| 343 link = link.tail) { | 342 link = link.tail) { |
| 344 Uri uri = link.head; | 343 Uri uri = link.head; |
| 345 if (!currentCodeLocation.inSameLocation(uri)) { | 344 if (!currentCodeLocation.inSameLocation(uri)) { |
| 346 currentCodeLocation = | 345 currentCodeLocation = |
| 347 options.verbose ? new UriLocation(uri) : new CodeLocation(uri); | 346 options.verbose ? new UriLocation(uri) : new CodeLocation(uri); |
| 348 compactImportChain = compactImportChain.prepend(currentCodeLocation); | 347 compactImportChain = compactImportChain.prepend(currentCodeLocation); |
| 349 } | 348 } |
| 350 } | 349 } |
| 351 String importChain = compactImportChain.map((CodeLocation codeLocation) { | 350 String importChain = compactImportChain.map((CodeLocation codeLocation) { |
| 352 return codeLocation.relativize( | 351 return codeLocation |
| 353 (loadedLibraries.rootLibrary as LibraryElement).canonicalUri); | 352 .relativize(loadedLibraries.rootLibrary.canonicalUri); |
| 354 }).join(' => '); | 353 }).join(' => '); |
| 355 | 354 |
| 356 if (!importChains.contains(importChain)) { | 355 if (!importChains.contains(importChain)) { |
| 357 if (importChains.length > compactChainLimit) { | 356 if (importChains.length > compactChainLimit) { |
| 358 importChains.add('...'); | 357 importChains.add('...'); |
| 359 return false; | 358 return false; |
| 360 } else { | 359 } else { |
| 361 importChains.add(importChain); | 360 importChains.add(importChain); |
| 362 } | 361 } |
| 363 } | 362 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 375 | 374 |
| 376 /// This method is called when all new libraries loaded through | 375 /// This method is called when all new libraries loaded through |
| 377 /// [LibraryLoader.loadLibrary] has been loaded and their imports/exports | 376 /// [LibraryLoader.loadLibrary] has been loaded and their imports/exports |
| 378 /// have been computed. | 377 /// have been computed. |
| 379 /// | 378 /// |
| 380 /// [loadedLibraries] contains the newly loaded libraries. | 379 /// [loadedLibraries] contains the newly loaded libraries. |
| 381 /// | 380 /// |
| 382 /// The method returns a [Future] allowing for the loading of additional | 381 /// The method returns a [Future] allowing for the loading of additional |
| 383 /// libraries. | 382 /// libraries. |
| 384 LoadedLibraries processLoadedLibraries(LoadedLibraries loadedLibraries) { | 383 LoadedLibraries processLoadedLibraries(LoadedLibraries loadedLibraries) { |
| 385 loadedLibraries.forEachLibrary((LibraryEntity library) { | 384 loadedLibraries.forEachLibrary((LibraryElement library) { |
| 386 backend.setAnnotations(library); | 385 backend.setAnnotations(library); |
| 387 }); | 386 }); |
| 388 | 387 |
| 389 for (Uri uri in resolvedUriTranslator.disallowedLibraryUris) { | 388 for (Uri uri in resolvedUriTranslator.disallowedLibraryUris) { |
| 390 if (loadedLibraries.containsLibrary(uri)) { | 389 if (loadedLibraries.containsLibrary(uri)) { |
| 391 Set<String> importChains = computeImportChainsFor(loadedLibraries, uri); | 390 Set<String> importChains = computeImportChainsFor(loadedLibraries, uri); |
| 392 reporter.reportInfo( | 391 reporter.reportInfo( |
| 393 NO_LOCATION_SPANNABLE, MessageKind.DISALLOWED_LIBRARY_IMPORT, { | 392 NO_LOCATION_SPANNABLE, MessageKind.DISALLOWED_LIBRARY_IMPORT, { |
| 394 'uri': uri, | 393 'uri': uri, |
| 395 'importChain': importChains | 394 'importChain': importChains |
| (...skipping 1571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1967 if (library != null && library.isSynthesized) { | 1966 if (library != null && library.isSynthesized) { |
| 1968 return null; | 1967 return null; |
| 1969 } | 1968 } |
| 1970 if (library == null && required) { | 1969 if (library == null && required) { |
| 1971 throw new SpannableAssertionFailure( | 1970 throw new SpannableAssertionFailure( |
| 1972 library, "The library '${uri}' was not found."); | 1971 library, "The library '${uri}' was not found."); |
| 1973 } | 1972 } |
| 1974 return library; | 1973 return library; |
| 1975 } | 1974 } |
| 1976 } | 1975 } |
| OLD | NEW |