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

Unified Diff: pkg/analyzer2dart/test/sexpr_data.dart

Issue 702453002: Support for-in in analyzer2dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 6 years, 1 month 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
Index: pkg/analyzer2dart/test/sexpr_data.dart
diff --git a/pkg/analyzer2dart/test/sexpr_data.dart b/pkg/analyzer2dart/test/sexpr_data.dart
index b5d6e935d682722b956b23c2ed84ad7234e79b4e..a8cb90eb07341b948ff9f0d337a139062f11904a 100644
--- a/pkg/analyzer2dart/test/sexpr_data.dart
+++ b/pkg/analyzer2dart/test/sexpr_data.dart
@@ -1045,4 +1045,95 @@ main() {
(InvokeContinuation k0 v0))
'''),
]),
+
+ const Group('For in loop', const <TestSpec>[
+// TODO(johnniwinther): Add tests for `i` as top-level, static and instance
+// fields.
+ const TestSpec('''
+main(a) {
+ for (var i in a) {
+ print(i);
+ }
+}
+''', '''
+(FunctionDefinition main (a return)
+ (LetCont (k0 v0)
+ (LetCont* (k1 v1)
+ (LetCont (k2 v2)
+ (LetCont (k3)
+ (LetPrim v3 (Constant NullConstant))
+ (InvokeContinuation return v3))
+ (LetCont (k4)
+ (LetPrim v4 (Constant NullConstant))
+ (LetCont (k5 v5)
+ (LetCont (k6 v6)
+ (InvokeContinuation* k1 v1))
+ (InvokeStatic print v5 k6))
+ (InvokeMethod v0 current k5))
+ (Branch (IsTrue v2) k4 k3))
+ (InvokeMethod v0 moveNext k2))
+ (InvokeContinuation k1 a))
+ (InvokeMethod a iterator k0))
+'''),
+
+ const TestSpec('''
+main(a) {
+ for (var i in a) {
+ print(i);
+ i = 0;
+ print(i);
+ }
+}
+''', '''
+(FunctionDefinition main (a return)
+ (LetCont (k0 v0)
+ (LetCont* (k1 v1)
+ (LetCont (k2 v2)
+ (LetCont (k3)
+ (LetPrim v3 (Constant NullConstant))
+ (InvokeContinuation return v3))
+ (LetCont (k4)
+ (LetPrim v4 (Constant NullConstant))
+ (LetCont (k5 v5)
+ (LetCont (k6 v6)
+ (LetPrim v7 (Constant IntConstant(0)))
+ (LetCont (k7 v8)
+ (InvokeContinuation* k1 v1))
+ (InvokeStatic print v7 k7))
+ (InvokeStatic print v5 k6))
+ (InvokeMethod v0 current k5))
+ (Branch (IsTrue v2) k4 k3))
+ (InvokeMethod v0 moveNext k2))
+ (InvokeContinuation k1 a))
+ (InvokeMethod a iterator k0))
+'''),
+
+ const TestSpec('''
+main(a) {
+ var i;
+ for (i in a) {
+ print(i);
+ }
+}
+''', '''
+(FunctionDefinition main (a return)
+ (LetPrim v0 (Constant NullConstant))
+ (LetCont (k0 v1)
+ (LetCont* (k1 v2 v3)
+ (LetCont (k2 v4)
+ (LetCont (k3)
+ (LetPrim v5 (Constant NullConstant))
+ (InvokeContinuation return v5))
+ (LetCont (k4)
+ (LetCont (k5 v6)
+ (LetCont (k6 v7)
+ (InvokeContinuation* k1 v2 v6))
+ (InvokeStatic print v6 k6))
+ (InvokeMethod v1 current k5))
+ (Branch (IsTrue v4) k4 k3))
+ (InvokeMethod v1 moveNext k2))
+ (InvokeContinuation k1 a v0))
+ (InvokeMethod a iterator k0))
+'''),
+ ]),
];
« no previous file with comments | « pkg/analyzer2dart/test/end2end_data.dart ('k') | sdk/lib/_internal/compiler/implementation/cps_ir/cps_ir_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698