| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 /** The entry point for the command-line version analyzer2dart. */ | 5 /** The entry point for the command-line version analyzer2dart. */ |
| 6 library analyzer2dart.cmdline; | 6 library analyzer2dart.cmdline; |
| 7 | 7 |
| 8 import 'package:analyzer/analyzer.dart'; | 8 import 'package:analyzer/analyzer.dart'; |
| 9 import 'package:analyzer/src/generated/element.dart'; | 9 import 'package:analyzer/src/generated/element.dart'; |
| 10 import 'package:analyzer/src/generated/sdk.dart'; |
| 11 import 'package:analyzer/src/generated/sdk_io.dart'; |
| 10 import 'package:analyzer/src/generated/source_io.dart'; | 12 import 'package:analyzer/src/generated/source_io.dart'; |
| 11 | 13 |
| 12 import '../lib/src/closed_world.dart'; | 14 import '../lib/src/closed_world.dart'; |
| 13 import '../lib/src/driver.dart'; | 15 import '../lib/src/driver.dart'; |
| 14 | 16 |
| 15 void main(List<String> args) { | 17 void main(List<String> args) { |
| 16 // TODO(paulberry): hacky | 18 // TODO(paulberry): hacky |
| 17 String path = args[0]; | 19 String path = args[0]; |
| 18 | 20 |
| 19 Driver analyzer2Dart = new Driver(); | 21 DartSdk sdk = DirectoryBasedDartSdk.defaultSdk; |
| 22 Driver analyzer2Dart = new Driver(sdk); |
| 20 | 23 |
| 21 // Tell the analysis server about the root | 24 // Tell the analysis server about the root |
| 22 Source source = analyzer2Dart.setRealRoot(path); | 25 Source source = analyzer2Dart.setRealRoot(path); |
| 23 | 26 |
| 24 // Get the library element associated with the source. | 27 // Get the library element associated with the source. |
| 25 FunctionElement entryPointElement = analyzer2Dart.resolveEntryPoint(source); | 28 FunctionElement entryPointElement = analyzer2Dart.resolveEntryPoint(source); |
| 26 | 29 |
| 27 // TODO(brianwilkerson,paulberry,johnniwinther): Perform tree-growing by | 30 // TODO(brianwilkerson,paulberry,johnniwinther): Perform tree-growing by |
| 28 // visiting the ast and feeding the dependencies into a work queue (enqueuer). | 31 // visiting the ast and feeding the dependencies into a work queue (enqueuer). |
| 29 ClosedWorld world = analyzer2Dart.computeWorld(entryPointElement); | 32 ClosedWorld world = analyzer2Dart.computeWorld(entryPointElement); |
| 30 | 33 |
| 31 // TODO(brianwilkerson,paulberry,johnniwinther): Convert the ast into cps by | 34 // TODO(brianwilkerson,paulberry,johnniwinther): Convert the ast into cps by |
| 32 // visiting the ast and invoking the ir builder. | 35 // visiting the ast and invoking the ir builder. |
| 33 new CpsGeneratingVisitor(); | 36 new CpsGeneratingVisitor(); |
| 34 | 37 |
| 35 // TODO(johnniwinther): Convert the analyzer element model into the dart2js | 38 // TODO(johnniwinther): Convert the analyzer element model into the dart2js |
| 36 // element model to fit the needs of the cps encoding above. | 39 // element model to fit the needs of the cps encoding above. |
| 37 | 40 |
| 38 // TODO(johnniwinther): Feed the cps ir into the new dart2dart backend to | 41 // TODO(johnniwinther): Feed the cps ir into the new dart2dart backend to |
| 39 // generate dart file(s). | 42 // generate dart file(s). |
| 40 } | 43 } |
| 41 | 44 |
| 42 class CpsGeneratingVisitor extends RecursiveAstVisitor { | 45 class CpsGeneratingVisitor extends RecursiveAstVisitor { |
| 43 // TODO(johnniwinther) | 46 // TODO(johnniwinther) |
| 44 } | 47 } |
| OLD | NEW |