From 89dfa1fd7a36b22d41f500f71573fa3676fec61e Mon Sep 17 00:00:00 2001 From: gfxmonk Date: Sun, 14 Mar 2010 11:44:24 +1100 Subject: [PATCH 1/2] added code to illustrate an issue with break statements --- test/test_break.coffee | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 test/test_break.coffee diff --git a/test/test_break.coffee b/test/test_break.coffee new file mode 100644 index 00000000..028d41a2 --- /dev/null +++ b/test/test_break.coffee @@ -0,0 +1,8 @@ +a: [1,2,3] +call_with_lambda: (l) -> null +for i in a + a: call_with_lambda(->) + if i == 2 + puts "i = 2" + else + break From 3c3e7f666b251a17896c879e6fad5d68838b95e0 Mon Sep 17 00:00:00 2001 From: gfxmonk Date: Sun, 14 Mar 2010 12:58:16 +1100 Subject: [PATCH 2/2] added another "invalid break" example, with code not on the top-level --- test/test_break_2.coffee | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 test/test_break_2.coffee diff --git a/test/test_break_2.coffee b/test/test_break_2.coffee new file mode 100644 index 00000000..0568693e --- /dev/null +++ b/test/test_break_2.coffee @@ -0,0 +1,14 @@ +some_func: (input) -> + takes_lambda: (l) -> null + for i in [1,2] + arbitraty_var: takes_lambda(->) + if input == 1 + return 1 + else + break + + return 2 + +ok some_func(1) is 1 +ok some_func(2) is 2 +