From c5c841f2fc0f4d66f592b8a0a9389b3a44f16597 Mon Sep 17 00:00:00 2001 From: Jeremy Ashkenas Date: Tue, 2 Feb 2010 10:39:44 -0500 Subject: [PATCH] fixing bug with mixed dot and soak accessors --- lib/coffee_script/nodes.rb | 4 +++- test/fixtures/execution/test_existence.coffee | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/coffee_script/nodes.rb b/lib/coffee_script/nodes.rb index 3822e543..7e759b7c 100644 --- a/lib/coffee_script/nodes.rb +++ b/lib/coffee_script/nodes.rb @@ -386,7 +386,9 @@ module CoffeeScript parts[-1] << "#{SOAK}#{baseline += prop.compile(o)}" end else - parts << prop.compile(o) + part = prop.compile(o) + baseline += part + parts << part end end @last = parts.last diff --git a/test/fixtures/execution/test_existence.coffee b/test/fixtures/execution/test_existence.coffee index 253a8bf2..2d4c5593 100644 --- a/test/fixtures/execution/test_existence.coffee +++ b/test/fixtures/execution/test_existence.coffee @@ -41,6 +41,8 @@ obj: { print obj?.prop is "hello" +print obj.prop?.length is 5 + print obj?.prop?.non?.existent?.property is undefined