Browse files

Merge branch 'stable'

* stable:
  Bump version for release.
  Clear out options before cache and restore them afterwards.
  Bump version for release.

Conflicts:
	VERSION
  • Loading branch information...
2 parents e513f85 + 2f94776 commit bf9eafb0036f01dc23350e0dc1db29b7e5ddf463 @chriseppstein chriseppstein committed Jul 2, 2011
View
6 doc-src/SASS_CHANGELOG.md
@@ -3,6 +3,12 @@
* Table of contents
{:toc}
+## 3.1.4
+
+* Sass no longer unnecessarily caches the sass options hash.
+ This allows objects that cannot be marshaled to be placed into the
+ options hash.
+
## 3.1.3
* Sass now logs message thru a logger object which can be changed to
View
13 lib/sass/cache_stores/base.rb
@@ -42,15 +42,20 @@ def _retrieve(key, version, sha)
raise "#{self.class} must implement #_retrieve."
end
- # Store a {Sass::Tree::RootNode}.
+ # Store an object to the Sass Cache.
#
# @param key [String] The key to store it under.
# @param sha [String] The checksum for the contents that are being stored.
# @param obj [Object] The object to cache.
- def store(key, sha, root)
- _store(key, Sass::VERSION, sha, Marshal.dump(root))
+ def store(key, sha, obj)
+ temp = obj.before_sass_cache_store if obj.respond_to?(:before_sass_cache_store)
+ begin
+ _store(key, Sass::VERSION, sha, Marshal.dump(obj))
+ ensure
+ obj.after_sass_cache_store(temp) if obj.respond_to?(:after_sass_cache_store)
+ end
rescue TypeError, LoadError => e
- Sass::Util.sass_warn "Warning. Error encountered while saving cache #{path_to(key)}: #{e}"
+ Sass::Util.sass_warn "Warning. Error encountered while saving a #{obj.class.name} to cache #{path_to(key)}: #{e}"
end
# Retrieve a {Sass::Tree::RootNode}.
View
5 lib/sass/tree/debug_node.rb
@@ -8,6 +8,11 @@ class DebugNode < Node
# @return [Script::Node]
attr_reader :expr
+ # Returns sub nodes that are not tree children.
+ def subnodes
+ Array(expr)
+ end
+
# @param expr [Script::Node] The expression to print
def initialize(expr)
@expr = expr
View
6 lib/sass/tree/each_node.rb
@@ -20,5 +20,11 @@ def initialize(var, list)
@list = list
super()
end
+
+ # Returns sub nodes that are not tree children.
+ def subnodes
+ Array(list)
+ end
+
end
end
View
5 lib/sass/tree/for_node.rb
@@ -32,5 +32,10 @@ def initialize(var, from, to, exclusive)
@exclusive = exclusive
super()
end
+
+ # Returns sub nodes that are not tree children.
+ def subnodes
+ Array(from) + Array(to)
+ end
end
end
View
5 lib/sass/tree/function_node.rb
@@ -22,6 +22,11 @@ def initialize(name, args)
@args = args
super()
end
+
+ # Returns sub nodes that are not tree children.
+ def subnodes
+ Array(args)
+ end
end
end
end
View
5 lib/sass/tree/if_node.rb
@@ -61,5 +61,10 @@ def deep_copy
node.else = self.else.deep_copy if self.else
node
end
+
+ # Returns sub nodes that are not tree children.
+ def subnodes
+ Array(expr) + Array(self.else)
+ end
end
end
View
5 lib/sass/tree/mixin_def_node.rb
@@ -22,6 +22,11 @@ def initialize(name, args)
@args = args
super()
end
+
+ # Returns sub nodes that are not tree children.
+ def subnodes
+ Array(args)
+ end
end
end
end
View
5 lib/sass/tree/mixin_node.rb
@@ -28,5 +28,10 @@ def initialize(name, args, keywords)
@keywords = keywords
super()
end
+
+ # Returns sub nodes that are not tree children.
+ def subnodes
+ Array(args) + (keywords||{}).values
+ end
end
end
View
13 lib/sass/tree/node.rb
@@ -66,6 +66,9 @@ def initialize
# @see #options
def options=(options)
children.each {|c| c.options = options}
+ if respond_to?(:subnodes)
+ subnodes.each {|n| n.options = options if n.respond_to?(:options=)}
+ end
@options = options
end
@@ -190,6 +193,16 @@ def deep_copy
node
end
+ def before_sass_cache_store
+ o = self.options
+ self.options = {}
+ return o
+ end
+
+ def after_sass_cache_store(o)
+ self.options = o
+ end
+
protected
# @see Sass::Shared.balance
View
5 lib/sass/tree/prop_node.rb
@@ -55,6 +55,11 @@ def initialize(name, value, prop_syntax)
super()
end
+ # Returns sub nodes that are not tree children.
+ def subnodes
+ Array(name).select{|n| n.is_a?(Sass::Script::Node)} + [value]
+ end
+
# Compares the names and values of two properties.
#
# @param other [Object] The object to compare with
View
5 lib/sass/tree/return_node.rb
@@ -13,6 +13,11 @@ def initialize(expr)
@expr = expr
super()
end
+
+ # Returns sub nodes that are not tree children.
+ def subnodes
+ Array(expr)
+ end
end
end
end
View
5 lib/sass/tree/rule_node.rb
@@ -115,6 +115,11 @@ def debug_info
:line => self.line}
end
+ # Returns sub nodes that are not tree children.
+ def subnodes
+ rule.select{|r| r.is_a?(Sass::Script::Node)}
+ end
+
private
def try_to_parse_non_interpolated_rules
View
6 lib/sass/tree/variable_node.rb
@@ -25,6 +25,12 @@ def initialize(name, expr, guarded)
@guarded = guarded
super()
end
+
+ # Returns sub nodes that are not tree children.
+ def subnodes
+ Array(expr)
+ end
+
end
end
end
View
6 lib/sass/tree/warn_node.rb
@@ -13,6 +13,12 @@ def initialize(expr)
@expr = expr
super()
end
+
+ # Returns sub nodes that are not tree children.
+ def subnodes
+ Array(expr)
+ end
+
end
end
end
View
6 lib/sass/tree/while_node.rb
@@ -14,5 +14,11 @@ def initialize(expr)
@expr = expr
super()
end
+
+ # Returns sub nodes that are not tree children.
+ def subnodes
+ Array(expr)
+ end
+
end
end

0 comments on commit bf9eafb

Please sign in to comment.