generateAstMapByCompilation function
Future<Map>
generateAstMapByCompilation(
- CompilationUnit compilationUnit,
- String path, {
- String? sourcePath,
})
Implementation
Future<Map> generateAstMapByCompilation(CompilationUnit compilationUnit, String path, {String? sourcePath}) async {
try {
//遍历AST
var astData = compilationUnit.accept(
CustomAstVisitor(sourcePath, await File(path).readAsString()));
return Future.value(astData);
} catch (e) {
stdout.writeln('Visit dart ast error: ${e.toString()}');
}
return Future.value();
}