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
907773ea
Commit
907773ea
authored
Sep 17, 2012
by
Aaron Leung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updating the 'comparable' built-in.
parent
2bc7b366
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
10 deletions
+8
-10
functions.cpp
functions.cpp
+8
-10
No files found.
functions.cpp
View file @
907773ea
...
...
@@ -1012,7 +1012,7 @@ namespace Sass {
// unreachable
default:
{
throw_eval_error
(
"argument to
unit
must be numeric"
,
path
,
line
);
throw_eval_error
(
"argument to
'unit'
must be numeric"
,
path
,
line
);
}
break
;
}
// unreachable statement
...
...
@@ -1021,7 +1021,7 @@ namespace Sass {
extern
Signature
unitless_sig
=
"unitless($number)"
;
Node
unitless
(
const
Node
parameter_names
,
Environment
&
bindings
,
Node_Factory
&
new_Node
,
string
&
path
,
size_t
line
)
{
Node
val
(
bindings
[
parameter_names
[
0
].
token
()]
);
Node
val
(
arg
(
unitless_sig
,
path
,
line
,
parameter_names
,
bindings
,
0
,
Node
::
numeric
)
);
switch
(
val
.
type
())
{
case
Node
:
:
number
:
{
...
...
@@ -1033,8 +1033,9 @@ namespace Sass {
return
new_Node
(
Node
::
boolean
,
path
,
line
,
false
);
}
break
;
// unreachable
default:
{
throw_eval_error
(
"argument to
unitless
must be numeric"
,
path
,
line
);
throw_eval_error
(
"argument to
'unitless'
must be numeric"
,
path
,
line
);
}
break
;
}
// unreachable statement
...
...
@@ -1043,8 +1044,8 @@ namespace Sass {
extern
Signature
comparable_sig
=
"comparable($number-1, $number-2)"
;
Node
comparable
(
const
Node
parameter_names
,
Environment
&
bindings
,
Node_Factory
&
new_Node
,
string
&
path
,
size_t
line
)
{
Node
n1
(
bindings
[
parameter_names
[
0
].
token
()]
);
Node
n2
(
bindings
[
parameter_names
[
1
].
token
()]
);
Node
n1
(
arg
(
comparable_sig
,
path
,
line
,
parameter_names
,
bindings
,
0
,
Node
::
numeric
)
);
Node
n2
(
arg
(
comparable_sig
,
path
,
line
,
parameter_names
,
bindings
,
1
,
Node
::
numeric
)
);
Node
::
Type
t1
=
n1
.
type
();
Node
::
Type
t2
=
n2
.
type
();
if
((
t1
==
Node
::
number
&&
n2
.
is_numeric
())
||
...
...
@@ -1059,17 +1060,14 @@ namespace Sass {
string
u2
(
n2
.
unit
().
to_string
());
if
((
u1
==
"ex"
&&
u2
==
"ex"
)
||
(
u1
==
"em"
&&
u2
==
"em"
)
||
((
u1
==
"in"
||
u1
==
"cm"
||
u1
==
"mm"
||
u1
==
"pt"
||
u1
==
"pc"
)
&&
(
u2
==
"in"
||
u2
==
"cm"
||
u2
==
"mm"
||
u2
==
"pt"
||
u2
==
"pc"
)))
{
((
u1
==
"in"
||
u1
==
"cm"
||
u1
==
"mm"
||
u1
==
"pt"
||
u1
==
"pc"
||
u1
==
"px"
)
&&
(
u2
==
"in"
||
u2
==
"cm"
||
u2
==
"mm"
||
u2
==
"pt"
||
u2
==
"pc"
||
u2
==
"px"
)))
{
return
new_Node
(
Node
::
boolean
,
path
,
line
,
true
);
}
else
{
return
new_Node
(
Node
::
boolean
,
path
,
line
,
false
);
}
}
else
if
(
!
n1
.
is_numeric
()
&&
!
n2
.
is_numeric
())
{
throw_eval_error
(
"arguments to comparable must be numeric"
,
path
,
line
);
}
// default to false if we missed anything
return
new_Node
(
Node
::
boolean
,
path
,
line
,
false
);
}
...
...
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