Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
node-sass
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
楚学文
node-sass
Commits
7743908a
Commit
7743908a
authored
Apr 16, 2012
by
Aaron Leung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Checking for invalid inputs in color arithmetic.
parent
acdbeaa6
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
8 deletions
+12
-8
eval_apply.cpp
eval_apply.cpp
+7
-5
exceptional.scss
exceptional.scss
+3
-1
node_comparisons.cpp
node_comparisons.cpp
+2
-2
No files found.
eval_apply.cpp
View file @
7743908a
...
...
@@ -233,7 +233,6 @@ namespace Sass {
}
// TO DO: find a way to merge the following two clauses
else
if
(
lhs
.
type
==
Node
::
number
&&
rhs
.
type
==
Node
::
numeric_dimension
)
{
// TO DO: disallow division
Node
result
(
acc
.
line_number
,
operate
(
op
,
lnum
,
rnum
),
Token
::
make
(
rhs
.
content
.
dimension
.
unit
,
Prelexer
::
identifier
(
rhs
.
content
.
dimension
.
unit
)));
acc
.
content
.
children
->
pop_back
();
acc
.
content
.
children
->
push_back
(
result
);
...
...
@@ -256,12 +255,12 @@ namespace Sass {
// TO DO: find a way to merge the following two clauses
else
if
(
lhs
.
type
==
Node
::
number
&&
rhs
.
type
==
Node
::
numeric_color
)
{
if
(
op
!=
Node
::
sub
&&
op
!=
Node
::
div
)
{
// TO DO: check that alphas match
double
r
=
operate
(
op
,
lhs
.
content
.
numeric_value
,
rhs
[
0
].
content
.
numeric_value
);
double
g
=
operate
(
op
,
lhs
.
content
.
numeric_value
,
rhs
[
1
].
content
.
numeric_value
);
double
b
=
operate
(
op
,
lhs
.
content
.
numeric_value
,
rhs
[
2
].
content
.
numeric_value
);
double
a
=
rhs
[
3
].
content
.
numeric_value
;
acc
.
content
.
children
->
pop_back
();
acc
<<
Node
(
acc
.
line_number
,
r
,
g
,
b
);
acc
<<
Node
(
acc
.
line_number
,
r
,
g
,
b
,
a
);
}
// trying to handle weird edge cases ... not sure if it's worth it
else
if
(
op
==
Node
::
div
)
{
...
...
@@ -280,15 +279,18 @@ namespace Sass {
double
r
=
operate
(
op
,
lhs
[
0
].
content
.
numeric_value
,
rhs
.
content
.
numeric_value
);
double
g
=
operate
(
op
,
lhs
[
1
].
content
.
numeric_value
,
rhs
.
content
.
numeric_value
);
double
b
=
operate
(
op
,
lhs
[
2
].
content
.
numeric_value
,
rhs
.
content
.
numeric_value
);
double
a
=
lhs
[
3
].
content
.
numeric_value
;
acc
.
content
.
children
->
pop_back
();
acc
<<
Node
(
acc
.
line_number
,
r
,
g
,
b
);
acc
<<
Node
(
acc
.
line_number
,
r
,
g
,
b
,
a
);
}
else
if
(
lhs
.
type
==
Node
::
numeric_color
&&
rhs
.
type
==
Node
::
numeric_color
)
{
if
(
lhs
[
3
].
content
.
numeric_value
!=
rhs
[
3
].
content
.
numeric_value
)
eval_error
(
"alpha channels must be equal for "
+
lhs
.
to_string
(
""
)
+
" + "
+
rhs
.
to_string
(
""
),
lhs
.
line_number
,
lhs
.
file_name
);
double
r
=
operate
(
op
,
lhs
[
0
].
content
.
numeric_value
,
rhs
[
0
].
content
.
numeric_value
);
double
g
=
operate
(
op
,
lhs
[
1
].
content
.
numeric_value
,
rhs
[
1
].
content
.
numeric_value
);
double
b
=
operate
(
op
,
lhs
[
2
].
content
.
numeric_value
,
rhs
[
2
].
content
.
numeric_value
);
double
a
=
lhs
[
3
].
content
.
numeric_value
;
acc
.
content
.
children
->
pop_back
();
acc
<<
Node
(
acc
.
line_number
,
r
,
g
,
b
);
acc
<<
Node
(
acc
.
line_number
,
r
,
g
,
b
,
a
);
}
// else if (lhs.type == Node::concatenation) {
// lhs << rhs;
...
...
exceptional.scss
View file @
7743908a
...
...
@@ -25,5 +25,7 @@ div[hux ~= "hello"] {
frux
:
12
+
'hello'
;
blah
:
blah
;
hoo
:
blah
==
12
;
boo
:
12px
>=
3em
;
//moo: rgba(0,0,0,.5) + rgba(0,0,0,.6);
moo
:
rgba
(
0
,
0
,
0
,.
5
)
+
3
;
}
node_comparisons.cpp
View file @
7743908a
...
...
@@ -83,11 +83,11 @@ namespace Sass {
return
numeric_value
()
<
rhs
.
numeric_value
();
}
else
{
throw
Error
(
Error
::
evaluation
,
line_number
,
""
,
"incompatible units"
);
throw
Error
(
Error
::
evaluation
,
line_number
,
file_name
,
"incompatible units"
);
}
}
else
{
throw
Error
(
Error
::
evaluation
,
line_number
,
""
,
"incomparable types"
);
throw
Error
(
Error
::
evaluation
,
line_number
,
file_name
,
"incomparable types"
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment