From a50446a0ca396890ed324d194183c32ab2a0f521 Mon Sep 17 00:00:00 2001 From: Jeremy Ashkenas Date: Thu, 17 Dec 2009 23:45:24 -0500 Subject: [PATCH] finally got the function/object/variable assignment indentation straightened out, I think --- lib/coffee_script/grammar.y | 2 +- lib/coffee_script/nodes.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/coffee_script/grammar.y b/lib/coffee_script/grammar.y index a13b9d16..661a02ee 100644 --- a/lib/coffee_script/grammar.y +++ b/lib/coffee_script/grammar.y @@ -28,7 +28,7 @@ prechigh right DELETE right RETURN THROW FOR WHILE left UNLESS - nonassoc IF + left IF nonassoc "." preclow diff --git a/lib/coffee_script/nodes.rb b/lib/coffee_script/nodes.rb index 0ad5f949..75424e0b 100644 --- a/lib/coffee_script/nodes.rb +++ b/lib/coffee_script/nodes.rb @@ -220,7 +220,7 @@ module CoffeeScript name = @variable.compile(indent, scope) if @variable.respond_to?(:compile) last = @variable.respond_to?(:last) ? @variable.last : name opts = opts.merge({:assign => name, :last_assign => last}) - value = @value.compile(indent + TAB, scope, opts) + value = @value.compile(indent, scope, opts) return "#{@variable}: #{value}" if @context == :object return "#{name} = #{value}" if @variable.properties? defined = scope.find(name) @@ -296,7 +296,7 @@ module CoffeeScript end def compile(indent, scope, opts={}) - props = @properties.map {|p| indent + TAB + p.compile(indent, scope) }.join(",\n") + props = @properties.map {|p| indent + TAB + p.compile(indent + TAB, scope) }.join(",\n") "{\n#{props}\n#{indent}}" end end