Index: tests/language/function_syntax_test.dart |
diff --git a/tests/language/function_syntax_test.dart b/tests/language/function_syntax_test.dart |
index fc9d92568d0d86d5ac542e150bc1c7f8d0505233..c509b2dce94d4fe6f4a2980004c1d611d2d7b502 100644 |
--- a/tests/language/function_syntax_test.dart |
+++ b/tests/language/function_syntax_test.dart |
@@ -7,12 +7,11 @@ import "package:expect/expect.dart"; |
// Tests function statement and expression syntax. |
class FunctionSyntaxTest { |
- |
static void testMain |
/* //# 00: compile-time error |
-() |
+ () |
*/ //# 00: continued |
- { |
+ { |
testNestedFunctions(); |
testFunctionExpressions(); |
testPrecedence(); |
@@ -24,25 +23,34 @@ class FunctionSyntaxTest { |
static void testNestedFunctions |
/* //# 01: compile-time error |
-() |
+ () |
*/ //# 01: continued |
- { |
+ { |
// No types - braces. |
nb0 |
/* //# 02: compile-time error |
-() |
+ () |
*/ //# 02: continued |
- { return 42; } |
+ { |
+ return 42; |
+ } |
+ |
nb1 |
/* //# 03: compile-time error |
-(a) |
+ (a) |
*/ //# 03: continued |
- { return a; } |
+ { |
+ return a; |
+ } |
+ |
nb2 |
/* //# 04: compile-time error |
-(a, b) |
+ (a, b) |
*/ //# 04: continued |
- { return a + b; } |
+ { |
+ return a + b; |
+ } |
+ |
Expect.equals(42, nb0()); |
Expect.equals(87, nb1(87)); |
Expect.equals(1 + 2, nb2(1, 2)); |
@@ -50,19 +58,22 @@ class FunctionSyntaxTest { |
// No types - arrows. |
na0 |
/* //# 05: compile-time error |
-() |
+ () |
*/ //# 05: continued |
- => 42; |
+ => |
+ 42; |
na1 |
/* //# 06: compile-time error |
-(a) |
+ (a) |
*/ //# 06: continued |
- => a; |
+ => |
+ a; |
na2 |
/* //# 07: compile-time error |
-(a, b) |
+ (a, b) |
*/ //# 07: continued |
- => a + b; |
+ => |
+ a + b; |
Expect.equals(42, na0()); |
Expect.equals(87, na1(87)); |
Expect.equals(1 + 2, na2(1, 2)); |
@@ -70,19 +81,28 @@ class FunctionSyntaxTest { |
// Return type - braces. |
int rb0 |
/* //# 08: compile-time error |
-() |
+ () |
*/ //# 08: continued |
- { return 42; } |
+ { |
+ return 42; |
+ } |
+ |
int rb1 |
/* //# 09: compile-time error |
-(a) |
+ (a) |
*/ //# 09: continued |
- { return a; } |
+ { |
+ return a; |
+ } |
+ |
int rb2 |
/* //# 10: compile-time error |
-(a, b) |
+ (a, b) |
*/ //# 10: continued |
- { return a + b; } |
+ { |
+ return a + b; |
+ } |
+ |
Expect.equals(42, rb0()); |
Expect.equals(87, rb1(87)); |
Expect.equals(1 + 2, rb2(1, 2)); |
@@ -90,19 +110,22 @@ class FunctionSyntaxTest { |
// Return type - arrows. |
int ra0 |
/* //# 11: compile-time error |
-() |
+ () |
*/ //# 11: continued |
- => 42; |
+ => |
+ 42; |
int ra1 |
/* //# 12: compile-time error |
-(a) |
+ (a) |
*/ //# 12: continued |
- => a; |
+ => |
+ a; |
int ra2 |
/* //# 13: compile-time error |
-(a, b) |
+ (a, b) |
*/ //# 13: continued |
- => a + b; |
+ => |
+ a + b; |
Expect.equals(42, ra0()); |
Expect.equals(87, ra1(87)); |
Expect.equals(1 + 2, ra2(1, 2)); |
@@ -110,14 +133,20 @@ class FunctionSyntaxTest { |
// Fully typed - braces. |
int fb1 |
/* //# 14: compile-time error |
-(int a) |
+ (int a) |
*/ //# 14: continued |
- { return a; } |
+ { |
+ return a; |
+ } |
+ |
int fb2 |
/* //# 15: compile-time error |
-(int a, int b) |
+ (int a, int b) |
*/ //# 15: continued |
- { return a + b; } |
+ { |
+ return a + b; |
+ } |
+ |
Expect.equals(42, rb0()); |
Expect.equals(87, rb1(87)); |
Expect.equals(1 + 2, rb2(1, 2)); |
@@ -125,14 +154,16 @@ class FunctionSyntaxTest { |
// Fully typed - arrows. |
int fa1 |
/* //# 16: compile-time error |
-(int a) |
+ (int a) |
*/ //# 16: continued |
- => a; |
+ => |
+ a; |
int fa2 |
/* //# 17: compile-time error |
-(int a, int b) |
+ (int a, int b) |
*/ //# 17: continued |
- => a + b; |
+ => |
+ a + b; |
Expect.equals(42, ra0()); |
Expect.equals(87, ra1(87)); |
Expect.equals(1 + 2, ra2(1, 2)); |
@@ -140,285 +171,386 @@ class FunctionSyntaxTest { |
// Generic types - braces. |
List<int> gb0 |
/* //# 18: compile-time error |
-() |
+ () |
*/ //# 18: continued |
- { return [42]; } |
+ { |
+ return [42]; |
+ } |
+ |
List<int> gb1 |
/* //# 19: compile-time error |
-(List<int> a) |
+ (List<int> a) |
*/ //# 19: continued |
- { return a; } |
+ { |
+ return a; |
+ } |
+ |
Expect.equals(42, gb0()[0]); |
Expect.equals(87, gb1([87])[0]); |
// Generic types - arrows. |
List<int> ga0 |
/* //# 20: compile-time error |
-() |
+ () |
*/ //# 20: continued |
- => [42]; |
+ => |
+ [42]; |
List<int> ga1 |
/* //# 21: compile-time error |
-(List<int> a) |
+ (List<int> a) |
*/ //# 21: continued |
- => a; |
+ => |
+ a; |
Expect.equals(42, ga0()[0]); |
Expect.equals(87, ga1([87])[0]); |
} |
static void testFunctionExpressions |
/* //# 22: compile-time error |
-() |
+ () |
*/ //# 22: continued |
- { |
+ { |
eval0 |
/* //# 23: compile-time error |
-(fn) |
+ (fn) |
*/ //# 23: continued |
- => fn(); |
+ => |
+ fn(); |
eval1 |
/* //# 24: compile-time error |
-(fn, a) |
+ (fn, a) |
*/ //# 24: continued |
- => fn(a); |
+ => |
+ fn(a); |
eval2 |
/* //# 25: compile-time error |
-(fn, a, b) |
+ (fn, a, b) |
*/ //# 25: continued |
- => fn(a, b); |
+ => |
+ fn(a, b); |
// No types - braces. |
Expect.equals(42, eval0( |
/* //# 26: compile-time error |
-() |
+ () |
*/ //# 26: continued |
- { return 42; })); |
- Expect.equals(87, eval1( |
+ { |
+ return 42; |
+ })); |
+ Expect.equals( |
+ 87, |
+ eval1( |
/* //# 27: compile-time error |
-(a) |
+ (a) |
*/ //# 27: continued |
- { return a; }, 87)); |
- Expect.equals(1 + 2, eval2( |
+ { |
+ return a; |
+ }, 87)); |
+ Expect.equals( |
+ 1 + 2, |
+ eval2( |
/* //# 28: compile-time error |
-(a, b) |
+ (a, b) |
*/ //# 28: continued |
- { return a + b; }, 1, 2)); |
+ { |
+ return a + b; |
+ }, 1, 2)); |
Expect.equals(42, eval0( |
/* //# 29: compile-time error |
-() |
+ () |
*/ //# 29: continued |
- { return 42; })); |
- Expect.equals(87, eval1( |
+ { |
+ return 42; |
+ })); |
+ Expect.equals( |
+ 87, |
+ eval1( |
/* //# 30: compile-time error |
-(a) |
+ (a) |
*/ //# 30: continued |
- { return a; }, 87)); |
- Expect.equals(1 + 2, eval2( |
+ { |
+ return a; |
+ }, 87)); |
+ Expect.equals( |
+ 1 + 2, |
+ eval2( |
/* //# 31: compile-time error |
-(a, b) |
+ (a, b) |
*/ //# 31: continued |
- { return a + b; }, 1, 2)); |
+ { |
+ return a + b; |
+ }, 1, 2)); |
// No types - arrows. |
- Expect.equals(42, eval0( |
+ Expect.equals( |
+ 42, |
+ eval0( |
/* //# 32: compile-time error |
-() |
+ () |
*/ //# 32: continued |
- => 42)); |
- Expect.equals(87, eval1( |
+ => |
+ 42)); |
+ Expect.equals( |
+ 87, |
+ eval1( |
/* //# 33: compile-time error |
-(a) |
+ (a) |
*/ //# 33: continued |
- => a, 87)); |
- Expect.equals(1 + 2, eval2( |
+ => |
+ a, |
+ 87)); |
+ Expect.equals( |
+ 1 + 2, |
+ eval2( |
/* //# 34: compile-time error |
-(a, b) |
+ (a, b) |
*/ //# 34: continued |
- => a + b, 1, 2)); |
- Expect.equals(42, eval0( |
+ => |
+ a + b, |
+ 1, |
+ 2)); |
+ Expect.equals( |
+ 42, |
+ eval0( |
/* //# 35: compile-time error |
-() |
+ () |
*/ //# 35: continued |
- => 42)); |
- Expect.equals(87, eval1( |
+ => |
+ 42)); |
+ Expect.equals( |
+ 87, |
+ eval1( |
/* //# 36: compile-time error |
-(a) |
+ (a) |
*/ //# 36: continued |
- => a, 87)); |
- Expect.equals(1 + 2, eval2( |
+ => |
+ a, |
+ 87)); |
+ Expect.equals( |
+ 1 + 2, |
+ eval2( |
/* //# 37: compile-time error |
-(a, b) |
+ (a, b) |
*/ //# 37: continued |
- => a + b, 1, 2)); |
+ => |
+ a + b, |
+ 1, |
+ 2)); |
// Argument types - braces. |
Expect.equals(42, eval0( |
/* //# 44: compile-time error |
-() |
+ () |
*/ //# 44: continued |
- { return 42; })); |
- Expect.equals(87, eval1( |
+ { |
+ return 42; |
+ })); |
+ Expect.equals( |
+ 87, |
+ eval1( |
/* //# 45: compile-time error |
-(int a) |
+ (int a) |
*/ //# 45: continued |
- { return a; }, 87)); |
- Expect.equals(1 + 2, eval2( |
+ { |
+ return a; |
+ }, 87)); |
+ Expect.equals( |
+ 1 + 2, |
+ eval2( |
/* //# 46: compile-time error |
-(int a, int b) |
+ (int a, int b) |
*/ //# 46: continued |
- { return a + b; }, 1, 2)); |
+ { |
+ return a + b; |
+ }, 1, 2)); |
Expect.equals(42, eval0( |
/* //# 47: compile-time error |
-() |
+ () |
*/ //# 47: continued |
- { return 42; })); |
- Expect.equals(87, eval1( |
+ { |
+ return 42; |
+ })); |
+ Expect.equals( |
+ 87, |
+ eval1( |
/* //# 48: compile-time error |
-(int a) |
+ (int a) |
*/ //# 48: continued |
- { return a; }, 87)); |
- Expect.equals(1 + 2, eval2( |
+ { |
+ return a; |
+ }, 87)); |
+ Expect.equals( |
+ 1 + 2, |
+ eval2( |
/* //# 49: compile-time error |
-(int a, int b) |
+ (int a, int b) |
*/ //# 49: continued |
- { return a + b; }, 1, 2)); |
+ { |
+ return a + b; |
+ }, 1, 2)); |
// Argument types - arrows. |
- Expect.equals(42, eval0( |
+ Expect.equals( |
+ 42, |
+ eval0( |
/* //# 50: compile-time error |
-() |
+ () |
*/ //# 50: continued |
- => 42)); |
- Expect.equals(87, eval1( |
+ => |
+ 42)); |
+ Expect.equals( |
+ 87, |
+ eval1( |
/* //# 51: compile-time error |
-(int a) |
+ (int a) |
*/ //# 51: continued |
- => a, 87)); |
- Expect.equals(1 + 2, eval2( |
+ => |
+ a, |
+ 87)); |
+ Expect.equals( |
+ 1 + 2, |
+ eval2( |
/* //# 52: compile-time error |
-(int a, int b) |
+ (int a, int b) |
*/ //# 52: continued |
- => a + b, 1, 2)); |
- Expect.equals(42, eval0( |
+ => |
+ a + b, |
+ 1, |
+ 2)); |
+ Expect.equals( |
+ 42, |
+ eval0( |
/* //# 53: compile-time error |
-() |
+ () |
*/ //# 53: continued |
- => 42)); |
- Expect.equals(87, eval1( |
+ => |
+ 42)); |
+ Expect.equals( |
+ 87, |
+ eval1( |
/* //# 54: compile-time error |
-(int a) |
+ (int a) |
*/ //# 54: continued |
- => a, 87)); |
- Expect.equals(1 + 2, eval2( |
+ => |
+ a, |
+ 87)); |
+ Expect.equals( |
+ 1 + 2, |
+ eval2( |
/* //# 55: compile-time error |
-(int a, int b) |
+ (int a, int b) |
*/ //# 55: continued |
- => a + b, 1, 2)); |
- |
+ => |
+ a + b, |
+ 1, |
+ 2)); |
} |
static void testPrecedence |
/* //# 64: compile-time error |
-() |
+ () |
*/ //# 64: continued |
- { |
+ { |
expectEvaluatesTo |
/* //# 65: compile-time error |
-(value, fn) |
+ (value, fn) |
*/ //# 65: continued |
- { Expect.equals(value, fn()); } |
+ { |
+ Expect.equals(value, fn()); |
+ } |
// Assignment. |
var x; |
- expectEvaluatesTo(42, ()=> x = 42); |
+ expectEvaluatesTo(42, () => x = 42); |
Expect.equals(42, x); |
x = 1; |
- expectEvaluatesTo(100, ()=> x += 99); |
+ expectEvaluatesTo(100, () => x += 99); |
Expect.equals(100, x); |
x = 1; |
- expectEvaluatesTo(87, ()=> x *= 87); |
+ expectEvaluatesTo(87, () => x *= 87); |
Expect.equals(87, x); |
// Conditional. |
- expectEvaluatesTo(42, ()=> true ? 42 : 87); |
- expectEvaluatesTo(87, ()=> false ? 42 : 87); |
+ expectEvaluatesTo(42, () => true ? 42 : 87); |
+ expectEvaluatesTo(87, () => false ? 42 : 87); |
// Logical or. |
- expectEvaluatesTo(true, ()=> true || true); |
- expectEvaluatesTo(true, ()=> true || false); |
- expectEvaluatesTo(true, ()=> false || true); |
- expectEvaluatesTo(false, ()=> false || false); |
+ expectEvaluatesTo(true, () => true || true); |
+ expectEvaluatesTo(true, () => true || false); |
+ expectEvaluatesTo(true, () => false || true); |
+ expectEvaluatesTo(false, () => false || false); |
// Logical and. |
- expectEvaluatesTo(true, ()=> true && true); |
- expectEvaluatesTo(false, ()=> true && false); |
- expectEvaluatesTo(false, ()=> false && true); |
- expectEvaluatesTo(false, ()=> false && false); |
+ expectEvaluatesTo(true, () => true && true); |
+ expectEvaluatesTo(false, () => true && false); |
+ expectEvaluatesTo(false, () => false && true); |
+ expectEvaluatesTo(false, () => false && false); |
// Bitwise operations. |
- expectEvaluatesTo(3, ()=> 1 | 2); |
- expectEvaluatesTo(2, ()=> 3 ^ 1); |
- expectEvaluatesTo(1, ()=> 3 & 1); |
+ expectEvaluatesTo(3, () => 1 | 2); |
+ expectEvaluatesTo(2, () => 3 ^ 1); |
+ expectEvaluatesTo(1, () => 3 & 1); |
// Equality. |
- expectEvaluatesTo(true, ()=> 1 == 1); |
- expectEvaluatesTo(false, ()=> 1 != 1); |
- expectEvaluatesTo(true, ()=> identical(1, 1)); |
- expectEvaluatesTo(false, ()=> !identical(1, 1)); |
+ expectEvaluatesTo(true, () => 1 == 1); |
+ expectEvaluatesTo(false, () => 1 != 1); |
+ expectEvaluatesTo(true, () => identical(1, 1)); |
+ expectEvaluatesTo(false, () => !identical(1, 1)); |
// Relational. |
- expectEvaluatesTo(true, ()=> 1 <= 1); |
- expectEvaluatesTo(false, ()=> 1 < 1); |
- expectEvaluatesTo(false, ()=> 1 > 1); |
- expectEvaluatesTo(true, ()=> 1 >= 1); |
+ expectEvaluatesTo(true, () => 1 <= 1); |
+ expectEvaluatesTo(false, () => 1 < 1); |
+ expectEvaluatesTo(false, () => 1 > 1); |
+ expectEvaluatesTo(true, () => 1 >= 1); |
// Is. |
- expectEvaluatesTo(true, ()=> 1 is int); |
- expectEvaluatesTo(true, ()=> 1.0 is double); |
+ expectEvaluatesTo(true, () => 1 is int); |
+ expectEvaluatesTo(true, () => 1.0 is double); |
// Shift. |
- expectEvaluatesTo(2, ()=> 1 << 1); |
- expectEvaluatesTo(1, ()=> 2 >> 1); |
+ expectEvaluatesTo(2, () => 1 << 1); |
+ expectEvaluatesTo(1, () => 2 >> 1); |
// Additive. |
- expectEvaluatesTo(2, ()=> 1 + 1); |
- expectEvaluatesTo(1, ()=> 2 - 1); |
+ expectEvaluatesTo(2, () => 1 + 1); |
+ expectEvaluatesTo(1, () => 2 - 1); |
// Multiplicative. |
- expectEvaluatesTo(2, ()=> 1 * 2); |
- expectEvaluatesTo(2.0, ()=> 4 / 2); |
- expectEvaluatesTo(2, ()=> 4 ~/ 2); |
- expectEvaluatesTo(0, ()=> 4 % 2); |
+ expectEvaluatesTo(2, () => 1 * 2); |
+ expectEvaluatesTo(2.0, () => 4 / 2); |
+ expectEvaluatesTo(2, () => 4 ~/ 2); |
+ expectEvaluatesTo(0, () => 4 % 2); |
// Negate. |
- expectEvaluatesTo(false, ()=> !true); |
+ expectEvaluatesTo(false, () => !true); |
// Postfix / prefix. |
var y = 0; |
- expectEvaluatesTo(0, ()=> y++); |
- expectEvaluatesTo(2, ()=> ++y); |
- expectEvaluatesTo(1, ()=> --y); |
- expectEvaluatesTo(1, ()=> y--); |
+ expectEvaluatesTo(0, () => y++); |
+ expectEvaluatesTo(2, () => ++y); |
+ expectEvaluatesTo(1, () => --y); |
+ expectEvaluatesTo(1, () => y--); |
Expect.equals(0, y); |
// Selector. |
fn |
/* //# 66: compile-time error |
-() |
+ () |
*/ //# 66: continued |
- => 42; |
+ => |
+ 42; |
var list = [87]; |
- expectEvaluatesTo(42, ()=> fn()); |
- expectEvaluatesTo(1, ()=> list.length); |
- expectEvaluatesTo(87, ()=> list[0]); |
- expectEvaluatesTo(87, ()=> list.removeLast()); |
+ expectEvaluatesTo(42, () => fn()); |
+ expectEvaluatesTo(1, () => list.length); |
+ expectEvaluatesTo(87, () => list[0]); |
+ expectEvaluatesTo(87, () => list.removeLast()); |
} |
static void testInitializers |
/* //# 67: compile-time error |
-() |
+ () |
*/ //# 67: continued |
- { |
+ { |
Expect.equals(42, (new C.cb0().fn)()); |
Expect.equals(43, (new C.ca0().fn)()); |
Expect.equals(44, (new C.cb1().fn)()); |
@@ -449,103 +581,153 @@ class FunctionSyntaxTest { |
static void testFunctionParameter |
/* //# 68: compile-time error |
-() |
+ () |
*/ //# 68: continued |
- { |
+ { |
f0(fn()) => fn(); |
- Expect.equals(42, f0(()=> 42)); |
+ Expect.equals(42, f0(() => 42)); |
f1(int fn()) => fn(); |
- Expect.equals(87, f1(()=> 87)); |
+ Expect.equals(87, f1(() => 87)); |
f2(fn(a)) => fn(42); |
- Expect.equals(43, f2((a)=> a + 1)); |
+ Expect.equals(43, f2((a) => a + 1)); |
f3(fn(int a)) => fn(42); |
- Expect.equals(44, f3((int a)=> a + 2)); |
+ Expect.equals(44, f3((int a) => a + 2)); |
} |
static void testFunctionIdentifierExpression |
/* //# 69: compile-time error |
-() |
+ () |
*/ //# 69: continued |
- { |
- Expect.equals(87, ( |
+ { |
+ Expect.equals( |
+ 87, |
+ ( |
/* //# 70: compile-time error |
-() |
+ () |
*/ //# 70: continued |
- => 87)()); |
+ => |
+ 87)()); |
} |
static void testFunctionIdentifierStatement |
/* //# 71: compile-time error |
-() |
+ () |
*/ //# 71: continued |
- { |
+ { |
function |
/* //# 72: compile-time error |
-() |
+ () |
*/ //# 72: continued |
- => 42; |
+ => |
+ 42; |
Expect.equals(42, function()); |
Expect.equals(true, function is Function); |
} |
- |
} |
- |
class C { |
- |
- C.cb0() : fn = (() { return 42; }) { } |
- C.ca0() : fn = (() => 43) { } |
- |
- C.cb1() : fn = wrap(() { return 44; }) { } |
- C.ca1() : fn = wrap(()=> 45) { } |
- |
- C.cb2() : fn = [() { return 46; }][0] { } |
- C.ca2() : fn = [() => 47][0] { } |
- |
- C.cb3() : fn = {'x': () { return 48; }}['x'] { } |
- C.ca3() : fn = {'x': () => 49}['x'] { } |
- |
- C.nb0() : fn = (() { return 52; }) { } |
- C.na0() : fn = (() => 53) { } |
- |
- C.nb1() : fn = wrap(() { return 54; }) { } |
- C.na1() : fn = wrap(()=> 55) { } |
- |
- C.nb2() : fn = [() { return 56; }][0] { } |
- C.na2() : fn = [() => 57][0] { } |
- |
- C.nb3() : fn = {'x': () { return 58; }}['x'] { } |
- C.na3() : fn = {'x': () => 59}['x'] { } |
- |
- C.rb0() : fn = (() { return 62; }) { } |
- C.ra0() : fn = (() => 63) { } |
- |
- C.rb1() : fn = wrap(() { return 64; }) { } |
- C.ra1() : fn = wrap(()=> 65) { } |
- |
- C.rb2() : fn = [() { return 66; }][0] { } |
- C.ra2() : fn = [() => 67][0] { } |
- |
- C.rb3() : fn = {'x': () { return 68; }}['x'] { } |
- C.ra3() : fn = {'x': () => 69}['x'] { } |
+ C.cb0() |
+ : fn = (() { |
+ return 42; |
+ }) {} |
+ C.ca0() : fn = (() => 43) {} |
+ |
+ C.cb1() |
+ : fn = wrap(() { |
+ return 44; |
+ }) {} |
+ C.ca1() : fn = wrap(() => 45) {} |
+ |
+ C.cb2() |
+ : fn = [ |
+ () { |
+ return 46; |
+ } |
+ ][0] {} |
+ C.ca2() : fn = [() => 47][0] {} |
+ |
+ C.cb3() |
+ : fn = { |
+ 'x': () { |
+ return 48; |
+ } |
+ }['x'] {} |
+ C.ca3() : fn = {'x': () => 49}['x'] {} |
+ |
+ C.nb0() |
+ : fn = (() { |
+ return 52; |
+ }) {} |
+ C.na0() : fn = (() => 53) {} |
+ |
+ C.nb1() |
+ : fn = wrap(() { |
+ return 54; |
+ }) {} |
+ C.na1() : fn = wrap(() => 55) {} |
+ |
+ C.nb2() |
+ : fn = [ |
+ () { |
+ return 56; |
+ } |
+ ][0] {} |
+ C.na2() : fn = [() => 57][0] {} |
+ |
+ C.nb3() |
+ : fn = { |
+ 'x': () { |
+ return 58; |
+ } |
+ }['x'] {} |
+ C.na3() : fn = {'x': () => 59}['x'] {} |
+ |
+ C.rb0() |
+ : fn = (() { |
+ return 62; |
+ }) {} |
+ C.ra0() : fn = (() => 63) {} |
+ |
+ C.rb1() |
+ : fn = wrap(() { |
+ return 64; |
+ }) {} |
+ C.ra1() : fn = wrap(() => 65) {} |
+ |
+ C.rb2() |
+ : fn = [ |
+ () { |
+ return 66; |
+ } |
+ ][0] {} |
+ C.ra2() : fn = [() => 67][0] {} |
+ |
+ C.rb3() |
+ : fn = { |
+ 'x': () { |
+ return 68; |
+ } |
+ }['x'] {} |
+ C.ra3() : fn = {'x': () => 69}['x'] {} |
static wrap |
/* //# 73: compile-time error |
-(fn) |
+ (fn) |
*/ //# 73: continued |
- { return fn; } |
+ { |
+ return fn; |
+ } |
final fn; |
- |
} |
main |
/* //# 74: compile-time error |
-() |
+ () |
*/ //# 74: continued |
- { |
+{ |
FunctionSyntaxTest.testMain(); |
} |