analysis 0.0.1-alpha.3
analysis: ^0.0.1-alpha.3 copied to clipboard
A set of utility classes to make common use cases of using the Dart analyzer.
analysis #
A set of utility classes to make common use cases of using the Dart analyzer
package simpler and without needing intimate knowledge of the internals.
SourceResolver #
Creating a resolver. #
// Create a default source resolver.
new SourceResolver();
// Create a source resolver with custom Dart package roots.
new SourceResolver(['/generated-files'])
Resolving a file to it's absolute location. #
// Example output: ~/git/analysis/packages/analysis/src/resolver.dart
sourceResolver.find(Uri.parse('package:analysis/src/resolver.dart'));
Finding the package location #
// Example output: package:analysis/src/resolver.dart
sourceResolver.resolve('~/git/analysis/packages/analysis/src/resolver.dart');
SourceVisitor #
Creating a visitor. #
// Create a default source crawler.
new SourceVisitor();
Crawl a file for libraries. #
// Example output: [
// new Library(..., 'package:analysis/src/test_data/test_data.dart'),
// new Library(..., 'dart:collection'),
// new Library(..., 'package:analysis/src/test_data/test_import.dart')
// ]
var uri = Uri.parse('package:analysis/src/test_data/test_data.dart');
sourceVisitor.visit(uri: uri)
SourceCrawler #
Similar to SourceVisitor; recursively searches into imports of the visited
file, and returns an iterable of every library parsed.
// Example output: [
// Library(name: foo.bar),
// Library(name: foo.baz)
// ]
sourceCrawler.crawl('package:foo/foo.dart')
