| OLD | NEW |
| 1 #!/usr/bin/env dart | 1 #!/usr/bin/env dart |
| 2 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 2 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 3 // for details. All rights reserved. Use of this source code is governed by a | 3 // for details. All rights reserved. Use of this source code is governed by a |
| 4 // BSD-style license that can be found in the LICENSE file. | 4 // BSD-style license that can be found in the LICENSE file. |
| 5 | 5 |
| 6 /// Resolves this library and everything it transitively imports and generates | 6 /// Resolves this library and everything it transitively imports and generates |
| 7 /// errors in all of those libraries. Does this in an infinite loop, starting | 7 /// errors in all of those libraries. Does this in an infinite loop, starting |
| 8 /// from scratch each time, to show how VM warm-up affects things and to make | 8 /// from scratch each time, to show how VM warm-up affects things and to make |
| 9 /// it easier to connect to this with observatory. | 9 /// it easier to connect to this with observatory. |
| 10 import 'dart:io'; | 10 import 'dart:io'; |
| 11 | 11 |
| 12 import 'package:path/path.dart' as p; | |
| 13 | |
| 14 import 'package:analyzer/dart/element/element.dart'; | 12 import 'package:analyzer/dart/element/element.dart'; |
| 15 import 'package:analyzer/src/generated/engine.dart'; | 13 import 'package:analyzer/src/generated/engine.dart'; |
| 16 import 'package:analyzer/src/generated/java_io.dart'; | 14 import 'package:analyzer/src/generated/java_io.dart'; |
| 17 import 'package:analyzer/src/generated/sdk_io.dart' show DirectoryBasedDartSdk; | 15 import 'package:analyzer/src/generated/sdk_io.dart' show DirectoryBasedDartSdk; |
| 18 import 'package:analyzer/src/generated/source.dart'; | 16 import 'package:analyzer/src/generated/source.dart'; |
| 19 import 'package:analyzer/src/generated/source_io.dart'; | 17 import 'package:analyzer/src/generated/source_io.dart'; |
| 18 import 'package:path/path.dart' as p; |
| 20 | 19 |
| 21 void main(List<String> args) { | 20 void main(List<String> args) { |
| 22 JavaSystemIO.setProperty( | 21 JavaSystemIO.setProperty( |
| 23 "com.google.dart.sdk", | 22 "com.google.dart.sdk", |
| 24 p.normalize( | 23 p.normalize( |
| 25 p.join(p.dirname(p.fromUri(Platform.script)), "../../../sdk"))); | 24 p.join(p.dirname(p.fromUri(Platform.script)), "../../../sdk"))); |
| 26 | 25 |
| 27 // Assumes you have run "pub get" in the analyzer directory itself and uses | 26 // Assumes you have run "pub get" in the analyzer directory itself and uses |
| 28 // that "packages" directory as its package root. | 27 // that "packages" directory as its package root. |
| 29 var packageRoot = | 28 var packageRoot = |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 void find(LibraryElement lib) { | 79 void find(LibraryElement lib) { |
| 81 if (seen.contains(lib)) return; | 80 if (seen.contains(lib)) return; |
| 82 seen.add(lib); | 81 seen.add(lib); |
| 83 results.add(lib); | 82 results.add(lib); |
| 84 lib.importedLibraries.forEach(find); | 83 lib.importedLibraries.forEach(find); |
| 85 lib.exportedLibraries.forEach(find); | 84 lib.exportedLibraries.forEach(find); |
| 86 } | 85 } |
| 87 find(start); | 86 find(start); |
| 88 return results; | 87 return results; |
| 89 } | 88 } |
| OLD | NEW |