Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(965)

Unified Diff: pkg/analyzer2dart/lib/src/converted_world.dart

Issue 609783002: Support static field access in analyzer2dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer2dart/lib/src/closed_world.dart ('k') | pkg/analyzer2dart/lib/src/cps_generator.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer2dart/lib/src/converted_world.dart
diff --git a/pkg/analyzer2dart/lib/src/converted_world.dart b/pkg/analyzer2dart/lib/src/converted_world.dart
index 82a7ccb8c0757d90044c49930c7ff6f27ec011d0..842997aa8f7394d2cd32bf77d06032d046aabd31 100644
--- a/pkg/analyzer2dart/lib/src/converted_world.dart
+++ b/pkg/analyzer2dart/lib/src/converted_world.dart
@@ -32,6 +32,8 @@ class _ConvertedWorldImpl implements ConvertedWorld {
_ConvertedWorldImpl(this.mainFunction);
+ // TODO(johnniwinther): Add all used libraries and all SDK libraries to the
+ // set of libraries in the converted world.
Iterable<dart2js.LibraryElement> get libraries => [mainFunction.library];
Iterable<dart2js.AstElement> get resolvedElements => executableElements.keys;
@@ -45,13 +47,29 @@ ConvertedWorld convertWorld(ClosedWorld closedWorld) {
ElementConverter converter = new ElementConverter();
_ConvertedWorldImpl convertedWorld = new _ConvertedWorldImpl(
converter.convertElement(closedWorld.mainFunction));
- closedWorld.executableElements.forEach(
- (analyzer.ExecutableElement analyzerElement, AstNode node) {
+
+ void convert(analyzer.Element analyzerElement, AstNode node) {
+ // Skip conversion of SDK sources since we don't generate code for it
+ // anyway.
+ if (analyzerElement.source.isInSystemLibrary) return;
+
dart2js.AstElement dart2jsElement =
converter.convertElement(analyzerElement);
- CpsGeneratingVisitor visitor = new CpsGeneratingVisitor(converter);
- convertedWorld.executableElements[dart2jsElement] = node.accept(visitor);
- });
+ CpsGeneratingVisitor visitor =
+ new CpsGeneratingVisitor(converter, analyzerElement);
+ ir.Node cpsNode = node.accept(visitor);
+ if (cpsNode != null) {
+ convertedWorld.executableElements[dart2jsElement] = cpsNode;
+ } else {
+ visitor.giveUp(node,
+ 'No CPS node generated for $analyzerElement (${node.runtimeType}).');
+ }
+ }
+
+ closedWorld.executableElements.forEach(convert);
+ closedWorld.variables.forEach(convert);
+ closedWorld.fields.forEach(convert);
+
return convertedWorld;
}
« no previous file with comments | « pkg/analyzer2dart/lib/src/closed_world.dart ('k') | pkg/analyzer2dart/lib/src/cps_generator.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698