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

Unified Diff: pkg/kernel/testcases/interpreter/function_expressions_test.dart

Issue 2997443002: Add support for function declarations and function expressions (Closed)
Patch Set: Remove environment location Created 3 years, 4 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
Index: pkg/kernel/testcases/interpreter/function_expressions_test.dart
diff --git a/pkg/kernel/testcases/interpreter/function_expressions_test.dart b/pkg/kernel/testcases/interpreter/function_expressions_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..e009f5f1f20a664a4ba322ccf41fc107afc69838
--- /dev/null
+++ b/pkg/kernel/testcases/interpreter/function_expressions_test.dart
@@ -0,0 +1,30 @@
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library function_expression_test;
+
+main() {
+ var f = (int m, int n) => print('${m++}$n');
+ var a1 = 3;
+ var a2 = 7;
+
+ f(a1, a2);
+
+ int foo(int f1, String f2) {
+ print('$f1, $f2');
+ a1++;
+ return a1;
+ }
+
+ var m = foo(1, 'test');
+ print(m);
+ print(a1);
+
+ int bar(int i) {
+ if (i < 0 || i == 0) return 0;
+ return bar(--i);
+ }
+
+ print(bar(5));
+}
« no previous file with comments | « pkg/kernel/lib/interpreter/interpreter.dart ('k') | pkg/kernel/testcases/interpreter/function_expressions_test.dart.expect » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698