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