sass 3.3.0.alpha.149 → 3.3.0.alpha.162
Sign up to get free protection for your applications and to get access to all the features.
- data/REVISION +1 -1
- data/VERSION +1 -1
- data/VERSION_DATE +1 -1
- data/lib/sass/css.rb +1 -1
- data/lib/sass/engine.rb +4 -4
- data/lib/sass/environment.rb +1 -1
- data/lib/sass/exec.rb +1 -1
- data/lib/sass/media.rb +15 -15
- data/lib/sass/script.rb +32 -7
- data/lib/sass/script/css_lexer.rb +2 -2
- data/lib/sass/script/css_parser.rb +1 -1
- data/lib/sass/script/functions.rb +246 -232
- data/lib/sass/script/lexer.rb +24 -32
- data/lib/sass/script/parser.rb +84 -65
- data/lib/sass/script/tree.rb +14 -0
- data/lib/sass/script/tree/funcall.rb +242 -0
- data/lib/sass/script/{interpolation.rb → tree/interpolation.rb} +30 -13
- data/lib/sass/script/tree/list_literal.rb +65 -0
- data/lib/sass/script/tree/literal.rb +46 -0
- data/lib/sass/script/{node.rb → tree/node.rb} +10 -10
- data/lib/sass/script/{operation.rb → tree/operation.rb} +16 -27
- data/lib/sass/script/{string_interpolation.rb → tree/string_interpolation.rb} +4 -4
- data/lib/sass/script/{unary_operation.rb → tree/unary_operation.rb} +7 -8
- data/lib/sass/script/tree/variable.rb +56 -0
- data/lib/sass/script/value.rb +10 -0
- data/lib/sass/script/{arg_list.rb → value/arg_list.rb} +5 -20
- data/lib/sass/script/value/base.rb +222 -0
- data/lib/sass/script/{bool.rb → value/bool.rb} +2 -2
- data/lib/sass/script/{color.rb → value/color.rb} +22 -20
- data/lib/sass/script/{list.rb → value/list.rb} +15 -28
- data/lib/sass/script/{null.rb → value/null.rb} +3 -3
- data/lib/sass/script/{number.rb → value/number.rb} +19 -19
- data/lib/sass/script/{string.rb → value/string.rb} +7 -7
- data/lib/sass/scss/parser.rb +14 -4
- data/lib/sass/selector.rb +26 -26
- data/lib/sass/selector/abstract_sequence.rb +1 -1
- data/lib/sass/selector/simple.rb +6 -7
- data/lib/sass/source/position.rb +13 -0
- data/lib/sass/supports.rb +4 -4
- data/lib/sass/tree/comment_node.rb +3 -3
- data/lib/sass/tree/css_import_node.rb +7 -7
- data/lib/sass/tree/debug_node.rb +2 -2
- data/lib/sass/tree/directive_node.rb +2 -2
- data/lib/sass/tree/each_node.rb +2 -2
- data/lib/sass/tree/extend_node.rb +4 -4
- data/lib/sass/tree/for_node.rb +4 -4
- data/lib/sass/tree/function_node.rb +4 -4
- data/lib/sass/tree/media_node.rb +3 -3
- data/lib/sass/tree/mixin_def_node.rb +4 -4
- data/lib/sass/tree/mixin_node.rb +6 -6
- data/lib/sass/tree/prop_node.rb +23 -15
- data/lib/sass/tree/return_node.rb +2 -2
- data/lib/sass/tree/rule_node.rb +3 -3
- data/lib/sass/tree/variable_node.rb +2 -2
- data/lib/sass/tree/visitors/convert.rb +2 -2
- data/lib/sass/tree/visitors/deep_copy.rb +5 -5
- data/lib/sass/tree/visitors/perform.rb +7 -7
- data/lib/sass/tree/visitors/set_options.rb +6 -6
- data/lib/sass/tree/visitors/to_css.rb +1 -1
- data/lib/sass/tree/warn_node.rb +2 -2
- data/lib/sass/tree/while_node.rb +2 -2
- data/lib/sass/util.rb +2 -2
- data/test/sass/engine_test.rb +6 -6
- data/test/sass/functions_test.rb +20 -20
- data/test/sass/plugin_test.rb +2 -2
- data/test/sass/script_test.rb +38 -29
- data/test/test_helper.rb +1 -1
- metadata +23 -19
- data/lib/sass/script/funcall.rb +0 -238
- data/lib/sass/script/literal.rb +0 -221
- data/lib/sass/script/variable.rb +0 -58
@@ -71,7 +71,7 @@ module Sass
|
|
71
71
|
#
|
72
72
|
# @return [String]
|
73
73
|
def to_s
|
74
|
-
to_a.map {|e| e.is_a?(Sass::Script::Node) ? "\#{#{e.to_sass}}" : e}.join
|
74
|
+
to_a.map {|e| e.is_a?(Sass::Script::Tree::Node) ? "\#{#{e.to_sass}}" : e}.join
|
75
75
|
end
|
76
76
|
|
77
77
|
# Returns the specificity of the selector as an integer. The base is given
|
data/lib/sass/selector/simple.rb
CHANGED
@@ -14,13 +14,12 @@ module Sass
|
|
14
14
|
# @return [String, nil]
|
15
15
|
attr_accessor :filename
|
16
16
|
|
17
|
-
# Returns a representation of the node
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
# this will be the string representation of this node.
|
17
|
+
# Returns a representation of the node as an array of strings and
|
18
|
+
# potentially {Sass::Script::Tree::Node}s (if there's interpolation in the
|
19
|
+
# selector). When the interpolation is resolved and the strings are joined
|
20
|
+
# together, this will be the string representation of this node.
|
22
21
|
#
|
23
|
-
# @return [Array<String, Sass::Script::Node>]
|
22
|
+
# @return [Array<String, Sass::Script::Tree::Node>]
|
24
23
|
def to_a
|
25
24
|
Sass::Util.abstract(self)
|
26
25
|
end
|
@@ -30,7 +29,7 @@ module Sass
|
|
30
29
|
#
|
31
30
|
# @return [String]
|
32
31
|
def inspect
|
33
|
-
to_a.map {|e| e.is_a?(Sass::Script::Node) ? "\#{#{e.to_sass}}" : e}.join
|
32
|
+
to_a.map {|e| e.is_a?(Sass::Script::Tree::Node) ? "\#{#{e.to_sass}}" : e}.join
|
34
33
|
end
|
35
34
|
|
36
35
|
# @see \{#inspect}
|
data/lib/sass/source/position.rb
CHANGED
@@ -22,5 +22,18 @@ module Sass::Source
|
|
22
22
|
def inspect
|
23
23
|
"#{line.inspect}:#{offset.inspect}"
|
24
24
|
end
|
25
|
+
|
26
|
+
# @param str [String] The string to move through.
|
27
|
+
# @return [Position] The source position after proceeding forward through
|
28
|
+
# `str`.
|
29
|
+
def after(str)
|
30
|
+
newlines = str.count("\n")
|
31
|
+
Position.new(line + newlines,
|
32
|
+
if newlines == 0
|
33
|
+
offset + str.length
|
34
|
+
else
|
35
|
+
str.length - str.rindex("\n") - 1
|
36
|
+
end)
|
37
|
+
end
|
25
38
|
end
|
26
39
|
end
|
data/lib/sass/supports.rb
CHANGED
@@ -135,7 +135,7 @@ module Sass::Supports
|
|
135
135
|
class Declaration < Condition
|
136
136
|
# The feature name.
|
137
137
|
#
|
138
|
-
# @param [Sass::Script::Node]
|
138
|
+
# @param [Sass::Script::Tree::Node]
|
139
139
|
attr_accessor :name
|
140
140
|
|
141
141
|
# The name of the feature after any SassScript has been resolved.
|
@@ -146,7 +146,7 @@ module Sass::Supports
|
|
146
146
|
|
147
147
|
# The feature value.
|
148
148
|
#
|
149
|
-
# @param [Sass::Script::Node]
|
149
|
+
# @param [Sass::Script::Tree::Node]
|
150
150
|
attr_accessor :value
|
151
151
|
|
152
152
|
# The value of the feature after any SassScript has been resolved.
|
@@ -190,7 +190,7 @@ module Sass::Supports
|
|
190
190
|
class Interpolation < Condition
|
191
191
|
# The SassScript expression in the interpolation.
|
192
192
|
#
|
193
|
-
# @param [Sass::Script::Node]
|
193
|
+
# @param [Sass::Script::Tree::Node]
|
194
194
|
attr_accessor :value
|
195
195
|
|
196
196
|
# The value of the expression after it's been resolved.
|
@@ -205,7 +205,7 @@ module Sass::Supports
|
|
205
205
|
|
206
206
|
def perform(env)
|
207
207
|
val = value.perform(env)
|
208
|
-
@resolved_value = val.is_a?(Sass::Script::String) ? val.value : val.to_s
|
208
|
+
@resolved_value = val.is_a?(Sass::Script::Value::String) ? val.value : val.to_s
|
209
209
|
end
|
210
210
|
|
211
211
|
def to_css
|
@@ -6,10 +6,10 @@ module Sass::Tree
|
|
6
6
|
# @see Sass::Tree
|
7
7
|
class CommentNode < Node
|
8
8
|
# The text of the comment, not including `/*` and `*/`.
|
9
|
-
# Interspersed with {Sass::Script::Node}s representing `#{}`-interpolation
|
9
|
+
# Interspersed with {Sass::Script::Tree::Node}s representing `#{}`-interpolation
|
10
10
|
# if this is a loud comment.
|
11
11
|
#
|
12
|
-
# @return [Array<String, Sass::Script::Node>]
|
12
|
+
# @return [Array<String, Sass::Script::Tree::Node>]
|
13
13
|
attr_accessor :value
|
14
14
|
|
15
15
|
# The text of the comment
|
@@ -26,7 +26,7 @@ module Sass::Tree
|
|
26
26
|
# @return [Symbol]
|
27
27
|
attr_accessor :type
|
28
28
|
|
29
|
-
# @param value [Array<String, Sass::Script::Node>] See \{#value}
|
29
|
+
# @param value [Array<String, Sass::Script::Tree::Node>] See \{#value}
|
30
30
|
# @param type [Symbol] See \{#type}
|
31
31
|
def initialize(value, type)
|
32
32
|
@value = Sass::Util.with_extracted_values(value) {|str| normalize_indentation str}
|
@@ -6,7 +6,7 @@ module Sass::Tree
|
|
6
6
|
# The URI being imported, either as a plain string or an interpolated
|
7
7
|
# script string.
|
8
8
|
#
|
9
|
-
# @return [String, Sass::Script::Node]
|
9
|
+
# @return [String, Sass::Script::Tree::Node]
|
10
10
|
attr_accessor :uri
|
11
11
|
|
12
12
|
# The text of the URI being imported after any interpolated SassScript has
|
@@ -15,11 +15,11 @@ module Sass::Tree
|
|
15
15
|
# @return [String]
|
16
16
|
attr_accessor :resolved_uri
|
17
17
|
|
18
|
-
# The media query for this rule, interspersed with
|
19
|
-
# representing `#{}`-interpolation. Any adjacent
|
20
|
-
# together.
|
18
|
+
# The media query for this rule, interspersed with
|
19
|
+
# {Sass::Script::Tree::Node}s representing `#{}`-interpolation. Any adjacent
|
20
|
+
# strings will be merged together.
|
21
21
|
#
|
22
|
-
# @return [Array<String, Sass::Script::Node>]
|
22
|
+
# @return [Array<String, Sass::Script::Tree::Node>]
|
23
23
|
attr_accessor :query
|
24
24
|
|
25
25
|
# The media query for this rule, without any unresolved interpolation. It's
|
@@ -28,8 +28,8 @@ module Sass::Tree
|
|
28
28
|
# @return [Sass::Media::QueryList]
|
29
29
|
attr_accessor :resolved_query
|
30
30
|
|
31
|
-
# @param uri [String, Sass::Script::Node] See \{#uri}
|
32
|
-
# @param query [Array<String, Sass::Script::Node>] See \{#query}
|
31
|
+
# @param uri [String, Sass::Script::Tree::Node] See \{#uri}
|
32
|
+
# @param query [Array<String, Sass::Script::Tree::Node>] See \{#query}
|
33
33
|
def initialize(uri, query = [])
|
34
34
|
@uri = uri
|
35
35
|
@query = query
|
data/lib/sass/tree/debug_node.rb
CHANGED
@@ -5,10 +5,10 @@ module Sass
|
|
5
5
|
# @see Sass::Tree
|
6
6
|
class DebugNode < Node
|
7
7
|
# The expression to print.
|
8
|
-
# @return [Script::Node]
|
8
|
+
# @return [Script::Tree::Node]
|
9
9
|
attr_accessor :expr
|
10
10
|
|
11
|
-
# @param expr [Script::Node] The expression to print
|
11
|
+
# @param expr [Script::Tree::Node] The expression to print
|
12
12
|
def initialize(expr)
|
13
13
|
@expr = expr
|
14
14
|
super()
|
@@ -11,7 +11,7 @@ module Sass::Tree
|
|
11
11
|
class DirectiveNode < Node
|
12
12
|
# The text of the directive, `@` and all, with interpolation included.
|
13
13
|
#
|
14
|
-
# @return [Array<String, Sass::Script::Node>]
|
14
|
+
# @return [Array<String, Sass::Script::Tree::Node>]
|
15
15
|
attr_accessor :value
|
16
16
|
|
17
17
|
# The text of the directive after any interpolated SassScript has been resolved.
|
@@ -20,7 +20,7 @@ module Sass::Tree
|
|
20
20
|
# @return [String]
|
21
21
|
attr_accessor :resolved_value
|
22
22
|
|
23
|
-
# @param value [Array<String, Sass::Script::Node>] See \{#value}
|
23
|
+
# @param value [Array<String, Sass::Script::Tree::Node>] See \{#value}
|
24
24
|
def initialize(value)
|
25
25
|
@value = value
|
26
26
|
super()
|
data/lib/sass/tree/each_node.rb
CHANGED
@@ -10,11 +10,11 @@ module Sass::Tree
|
|
10
10
|
attr_reader :var
|
11
11
|
|
12
12
|
# The parse tree for the list.
|
13
|
-
# @param [Script::Node]
|
13
|
+
# @param [Script::Tree::Node]
|
14
14
|
attr_accessor :list
|
15
15
|
|
16
16
|
# @param var [String] The name of the loop variable
|
17
|
-
# @param list [Script::Node] The parse tree for the list
|
17
|
+
# @param list [Script::Tree::Node] The parse tree for the list
|
18
18
|
def initialize(var, list)
|
19
19
|
@var = var
|
20
20
|
@list = list
|
@@ -11,10 +11,10 @@ module Sass::Tree
|
|
11
11
|
# @return [Selector::CommaSequence]
|
12
12
|
attr_accessor :resolved_selector
|
13
13
|
|
14
|
-
# The CSS selector to extend, interspersed with {Sass::Script::Node}s
|
14
|
+
# The CSS selector to extend, interspersed with {Sass::Script::Tree::Node}s
|
15
15
|
# representing `#{}`-interpolation.
|
16
16
|
#
|
17
|
-
# @return [Array<String, Sass::Script::Node>]
|
17
|
+
# @return [Array<String, Sass::Script::Tree::Node>]
|
18
18
|
attr_accessor :selector
|
19
19
|
|
20
20
|
# The extended selector source range.
|
@@ -27,9 +27,9 @@ module Sass::Tree
|
|
27
27
|
# @return [Boolean]
|
28
28
|
def optional?; @optional; end
|
29
29
|
|
30
|
-
# @param selector [Array<String, Sass::Script::Node>]
|
30
|
+
# @param selector [Array<String, Sass::Script::Tree::Node>]
|
31
31
|
# The CSS selector to extend,
|
32
|
-
# interspersed with {Sass::Script::Node}s
|
32
|
+
# interspersed with {Sass::Script::Tree::Node}s
|
33
33
|
# representing `#{}`-interpolation.
|
34
34
|
# @param optional [Boolean] See \{#optional}
|
35
35
|
# @param selector_source_range [Sass::Source::Range] The extended selector source range.
|
data/lib/sass/tree/for_node.rb
CHANGED
@@ -10,11 +10,11 @@ module Sass::Tree
|
|
10
10
|
attr_reader :var
|
11
11
|
|
12
12
|
# The parse tree for the initial expression.
|
13
|
-
# @return [Script::Node]
|
13
|
+
# @return [Script::Tree::Node]
|
14
14
|
attr_accessor :from
|
15
15
|
|
16
16
|
# The parse tree for the final expression.
|
17
|
-
# @return [Script::Node]
|
17
|
+
# @return [Script::Tree::Node]
|
18
18
|
attr_accessor :to
|
19
19
|
|
20
20
|
# Whether to include `to` in the loop or stop just before.
|
@@ -22,8 +22,8 @@ module Sass::Tree
|
|
22
22
|
attr_reader :exclusive
|
23
23
|
|
24
24
|
# @param var [String] See \{#var}
|
25
|
-
# @param from [Script::Node] See \{#from}
|
26
|
-
# @param to [Script::Node] See \{#to}
|
25
|
+
# @param from [Script::Tree::Node] See \{#from}
|
26
|
+
# @param to [Script::Tree::Node] See \{#to}
|
27
27
|
# @param exclusive [Boolean] See \{#exclusive}
|
28
28
|
def initialize(var, from, to, exclusive)
|
29
29
|
@var = var
|
@@ -12,17 +12,17 @@ module Sass
|
|
12
12
|
# containing the variable for argument and the parse tree for
|
13
13
|
# the default value of the argument
|
14
14
|
#
|
15
|
-
# @return [Array<Script::Node>]
|
15
|
+
# @return [Array<Script::Tree::Node>]
|
16
16
|
attr_accessor :args
|
17
17
|
|
18
18
|
# The splat argument for this function, if one exists.
|
19
19
|
#
|
20
|
-
# @return [Script::Node?]
|
20
|
+
# @return [Script::Tree::Node?]
|
21
21
|
attr_accessor :splat
|
22
22
|
|
23
23
|
# @param name [String] The function name
|
24
|
-
# @param args [Array<(Script::Node, Script::Node)>] The arguments for the function.
|
25
|
-
# @param splat [Script::Node] See \{#splat}
|
24
|
+
# @param args [Array<(Script::Tree::Node, Script::Tree::Node)>] The arguments for the function.
|
25
|
+
# @param splat [Script::Tree::Node] See \{#splat}
|
26
26
|
def initialize(name, args, splat)
|
27
27
|
@name = name
|
28
28
|
@args = args
|
data/lib/sass/tree/media_node.rb
CHANGED
@@ -8,11 +8,11 @@ module Sass::Tree
|
|
8
8
|
class MediaNode < DirectiveNode
|
9
9
|
# TODO: parse and cache the query immediately if it has no dynamic elements
|
10
10
|
|
11
|
-
# The media query for this rule, interspersed with {Sass::Script::Node}s
|
11
|
+
# The media query for this rule, interspersed with {Sass::Script::Tree::Node}s
|
12
12
|
# representing `#{}`-interpolation. Any adjacent strings will be merged
|
13
13
|
# together.
|
14
14
|
#
|
15
|
-
# @return [Array<String, Sass::Script::Node>]
|
15
|
+
# @return [Array<String, Sass::Script::Tree::Node>]
|
16
16
|
attr_accessor :query
|
17
17
|
|
18
18
|
# The media query for this rule, without any unresolved interpolation. It's
|
@@ -27,7 +27,7 @@ module Sass::Tree
|
|
27
27
|
# @see RuleNode#group_end
|
28
28
|
attr_accessor :group_end
|
29
29
|
|
30
|
-
# @param query [Array<String, Sass::Script::Node>] See \{#query}
|
30
|
+
# @param query [Array<String, Sass::Script::Tree::Node>] See \{#query}
|
31
31
|
def initialize(query)
|
32
32
|
@query = query
|
33
33
|
@tabs = 0
|
@@ -12,12 +12,12 @@ module Sass
|
|
12
12
|
# Each element is a tuple containing the variable for argument
|
13
13
|
# and the parse tree for the default value of the argument.
|
14
14
|
#
|
15
|
-
# @return [Array<(Script::Node, Script::Node)>]
|
15
|
+
# @return [Array<(Script::Tree::Node, Script::Tree::Node)>]
|
16
16
|
attr_accessor :args
|
17
17
|
|
18
18
|
# The splat argument for this mixin, if one exists.
|
19
19
|
#
|
20
|
-
# @return [Script::Node?]
|
20
|
+
# @return [Script::Tree::Node?]
|
21
21
|
attr_accessor :splat
|
22
22
|
|
23
23
|
# Whether the mixin uses `@content`. Set during the nesting check phase.
|
@@ -25,8 +25,8 @@ module Sass
|
|
25
25
|
attr_accessor :has_content
|
26
26
|
|
27
27
|
# @param name [String] The mixin name
|
28
|
-
# @param args [Array<(Script::Node, Script::Node)>] See \{#args}
|
29
|
-
# @param splat [Script::Node] See \{#splat}
|
28
|
+
# @param args [Array<(Script::Tree::Node, Script::Tree::Node)>] See \{#args}
|
29
|
+
# @param splat [Script::Tree::Node] See \{#splat}
|
30
30
|
def initialize(name, args, splat)
|
31
31
|
@name = name
|
32
32
|
@args = args
|
data/lib/sass/tree/mixin_node.rb
CHANGED
@@ -12,22 +12,22 @@ module Sass::Tree
|
|
12
12
|
attr_reader :name
|
13
13
|
|
14
14
|
# The arguments to the mixin.
|
15
|
-
# @return [Array<Script::Node>]
|
15
|
+
# @return [Array<Script::Tree::Node>]
|
16
16
|
attr_accessor :args
|
17
17
|
|
18
18
|
# A hash from keyword argument names to values.
|
19
|
-
# @return [{String => Script::Node}]
|
19
|
+
# @return [{String => Script::Tree::Node}]
|
20
20
|
attr_accessor :keywords
|
21
21
|
|
22
22
|
# The splat argument for this mixin, if one exists.
|
23
23
|
#
|
24
|
-
# @return [Script::Node?]
|
24
|
+
# @return [Script::Tree::Node?]
|
25
25
|
attr_accessor :splat
|
26
26
|
|
27
27
|
# @param name [String] The name of the mixin
|
28
|
-
# @param args [Array<Script::Node>] See \{#args}
|
29
|
-
# @param splat [Script::Node] See \{#splat}
|
30
|
-
# @param keywords [{String => Script::Node}] See \{#keywords}
|
28
|
+
# @param args [Array<Script::Tree::Node>] See \{#args}
|
29
|
+
# @param splat [Script::Tree::Node] See \{#splat}
|
30
|
+
# @param keywords [{String => Script::Tree::Node}] See \{#keywords}
|
31
31
|
def initialize(name, args, keywords, splat)
|
32
32
|
@name = name
|
33
33
|
@args = args
|
data/lib/sass/tree/prop_node.rb
CHANGED
@@ -4,11 +4,11 @@ module Sass::Tree
|
|
4
4
|
# @see Sass::Tree
|
5
5
|
class PropNode < Node
|
6
6
|
# The name of the property,
|
7
|
-
# interspersed with {Sass::Script::Node}s
|
7
|
+
# interspersed with {Sass::Script::Tree::Node}s
|
8
8
|
# representing `#{}`-interpolation.
|
9
9
|
# Any adjacent strings will be merged together.
|
10
10
|
#
|
11
|
-
# @return [Array<String, Sass::Script::Node>]
|
11
|
+
# @return [Array<String, Sass::Script::Tree::Node>]
|
12
12
|
attr_accessor :name
|
13
13
|
|
14
14
|
# The name of the property
|
@@ -20,7 +20,7 @@ module Sass::Tree
|
|
20
20
|
|
21
21
|
# The value of the property.
|
22
22
|
#
|
23
|
-
# @return [Sass::Script::Node]
|
23
|
+
# @return [Sass::Script::Tree::Node]
|
24
24
|
attr_accessor :value
|
25
25
|
|
26
26
|
# The value of the property
|
@@ -52,8 +52,8 @@ module Sass::Tree
|
|
52
52
|
# @return [Sass::Source::Range]
|
53
53
|
attr_accessor :value_source_range
|
54
54
|
|
55
|
-
# @param name [Array<String, Sass::Script::Node>] See \{#name}
|
56
|
-
# @param value [Sass::Script::Node] See \{#value}
|
55
|
+
# @param name [Array<String, Sass::Script::Tree::Node>] See \{#name}
|
56
|
+
# @param value [Sass::Script::Tree::Node] See \{#value}
|
57
57
|
# @param prop_syntax [Symbol] `:new` if this property uses `a: b`-style syntax,
|
58
58
|
# `:old` if it uses `:a b`-style syntax
|
59
59
|
def initialize(name, value, prop_syntax)
|
@@ -80,7 +80,13 @@ module Sass::Tree
|
|
80
80
|
#
|
81
81
|
# @return [String] The message
|
82
82
|
def pseudo_class_selector_message
|
83
|
-
|
83
|
+
if @prop_syntax == :new ||
|
84
|
+
!value.is_a?(Sass::Script::Tree::Literal) ||
|
85
|
+
!value.value.is_a?(Sass::Script::Value::String) ||
|
86
|
+
!value.value.value.empty?
|
87
|
+
return ""
|
88
|
+
end
|
89
|
+
|
84
90
|
"\nIf #{declaration.dump} should be a selector, use \"\\#{declaration}\" instead."
|
85
91
|
end
|
86
92
|
|
@@ -127,34 +133,36 @@ module Sass::Tree
|
|
127
133
|
private
|
128
134
|
|
129
135
|
def val_to_sass_comma(node, opts)
|
130
|
-
return node unless node.is_a?(Sass::Script::Operation)
|
136
|
+
return node unless node.is_a?(Sass::Script::Tree::Operation)
|
131
137
|
return val_to_sass_concat(node, opts) unless node.operator == :comma
|
132
138
|
|
133
|
-
Sass::Script::Operation.new(
|
139
|
+
Sass::Script::Tree::Operation.new(
|
134
140
|
val_to_sass_concat(node.operand1, opts),
|
135
141
|
val_to_sass_comma(node.operand2, opts),
|
136
142
|
node.operator)
|
137
143
|
end
|
138
144
|
|
139
145
|
def val_to_sass_concat(node, opts)
|
140
|
-
return node unless node.is_a?(Sass::Script::Operation)
|
146
|
+
return node unless node.is_a?(Sass::Script::Tree::Operation)
|
141
147
|
return val_to_sass_div(node, opts) unless node.operator == :space
|
142
148
|
|
143
|
-
Sass::Script::Operation.new(
|
149
|
+
Sass::Script::Tree::Operation.new(
|
144
150
|
val_to_sass_div(node.operand1, opts),
|
145
151
|
val_to_sass_concat(node.operand2, opts),
|
146
152
|
node.operator)
|
147
153
|
end
|
148
154
|
|
149
155
|
def val_to_sass_div(node, opts)
|
150
|
-
unless node.is_a?(Sass::Script::Operation) && node.operator == :div &&
|
151
|
-
node.operand1.is_a?(Sass::Script::
|
152
|
-
node.
|
153
|
-
|
156
|
+
unless node.is_a?(Sass::Script::Tree::Operation) && node.operator == :div &&
|
157
|
+
node.operand1.is_a?(Sass::Script::Tree::Literal) &&
|
158
|
+
node.operand1.value.is_a?(Sass::Script::Value::Number) &&
|
159
|
+
node.operand2.is_a?(Sass::Script::Tree::Literal) &&
|
160
|
+
node.operand2.value.is_a?(Sass::Script::Value::Number) &&
|
161
|
+
(!node.operand1.value.original || !node.operand2.value.original)
|
154
162
|
return node
|
155
163
|
end
|
156
164
|
|
157
|
-
Sass::Script::String.new("(#{node.to_sass(opts)})")
|
165
|
+
Sass::Script::Value::String.new("(#{node.to_sass(opts)})")
|
158
166
|
end
|
159
167
|
|
160
168
|
end
|
@@ -5,10 +5,10 @@ module Sass
|
|
5
5
|
# @see Sass::Tree
|
6
6
|
class ReturnNode < Node
|
7
7
|
# The expression to return.
|
8
|
-
# @type [Script::Node]
|
8
|
+
# @type [Script::Tree::Node]
|
9
9
|
attr_accessor :expr
|
10
10
|
|
11
|
-
# @param expr [Script::Node] The expression to return
|
11
|
+
# @param expr [Script::Tree::Node] The expression to return
|
12
12
|
def initialize(expr)
|
13
13
|
@expr = expr
|
14
14
|
super()
|