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

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

Issue 661593004: Support local variables in analyzer2dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 6 years, 2 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 | « no previous file | pkg/analyzer2dart/lib/src/element_converter.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer2dart/lib/src/cps_generator.dart
diff --git a/pkg/analyzer2dart/lib/src/cps_generator.dart b/pkg/analyzer2dart/lib/src/cps_generator.dart
index ca4b66f5c9909cbf873cb97b75f4ae6ee81c88f5..c0f2b8cd28368d6254ca34b084a1acdd58d82514 100644
--- a/pkg/analyzer2dart/lib/src/cps_generator.dart
+++ b/pkg/analyzer2dart/lib/src/cps_generator.dart
@@ -40,7 +40,7 @@ class CpsGeneratingVisitor extends SemanticVisitor<ir.Node> {
// Visit the body directly to avoid processing the signature as expressions.
node.functionExpression.body.accept(this);
return irBuilder.buildFunctionDefinition(
- converter.convertElement(function), const [], const []);
+ converter.convertElement(function), const []);
}
@override
@@ -121,6 +121,18 @@ class CpsGeneratingVisitor extends SemanticVisitor<ir.Node> {
return handleLocalAccess(node, semantics);
}
+ @override
+ visitVariableDeclaration(VariableDeclaration node) {
+ // TODO(johnniwinther): Handle constant local variables.
+ ir.Node initialValue;
+ if (node.initializer != null) {
+ initialValue = node.initializer.accept(this);
+ }
+ irBuilder.declareLocalVariable(
+ converter.convertElement(node.element),
+ initialValue: initialValue);
+ }
+
ir.Primitive handleLocalAccess(AstNode node, AccessSemantics semantics) {
analyzer.Element element = semantics.element;
dart2js.Element target = converter.convertElement(element);
« no previous file with comments | « no previous file | pkg/analyzer2dart/lib/src/element_converter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698