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
2bc7b366
Commit
2bc7b366
authored
Sep 17, 2012
by
Aaron Leung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Converting 'unit' builtin.
parent
a187103d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
functions.cpp
functions.cpp
+6
-4
No files found.
functions.cpp
View file @
2bc7b366
...
@@ -878,17 +878,18 @@ namespace Sass {
...
@@ -878,17 +878,18 @@ namespace Sass {
size_t
size
=
0
;
size_t
size
=
0
;
if
(
l1
.
type
()
!=
Node
::
nil
)
size
+=
l1
.
size
();
if
(
l1
.
type
()
!=
Node
::
nil
)
size
+=
l1
.
size
();
if
(
l2
.
type
()
!=
Node
::
nil
)
size
+=
l2
.
size
();
if
(
l2
.
type
()
!=
Node
::
nil
)
size
+=
l2
.
size
();
// figure out the result type in advance
// figure out the result type in advance
Node
::
Type
rtype
=
Node
::
space_list
;
Node
::
Type
rtype
=
Node
::
space_list
;
string
sep
(
bindings
[
parameter_names
[
2
].
token
()].
token
().
unquote
());
string
sep
(
bindings
[
parameter_names
[
2
].
token
()].
token
().
unquote
());
if
(
sep
==
"comma"
)
rtype
=
Node
::
comma_list
;
if
(
sep
==
"comma"
)
rtype
=
Node
::
comma_list
;
else
if
(
sep
==
"space"
)
rtype
=
Node
::
space_list
;
else
if
(
sep
==
"space"
)
rtype
=
Node
::
space_list
;
else
if
(
sep
==
"auto"
)
rtype
=
l1
.
type
();
else
if
(
sep
==
"auto"
)
rtype
=
l1
.
type
();
else
{
else
{
throw_eval_error
(
"third argument to
join
must be 'space', 'comma', or 'auto'"
,
path
,
line
);
throw_eval_error
(
"third argument to
'join'
must be 'space', 'comma', or 'auto'"
,
path
,
line
);
}
}
if
(
rtype
==
Node
::
nil
)
rtype
=
l2
.
type
();
if
(
rtype
==
Node
::
nil
)
rtype
=
l2
.
type
();
// accumulate the result
// accumulate the result
Node
lr
(
new_Node
(
rtype
,
path
,
line
,
size
));
Node
lr
(
new_Node
(
rtype
,
path
,
line
,
size
));
if
(
l1
.
type
()
!=
Node
::
nil
)
lr
+=
l1
;
if
(
l1
.
type
()
!=
Node
::
nil
)
lr
+=
l1
;
...
@@ -917,7 +918,7 @@ namespace Sass {
...
@@ -917,7 +918,7 @@ namespace Sass {
if
(
sep_string
==
"comma"
)
sep_type
=
Node
::
comma_list
;
if
(
sep_string
==
"comma"
)
sep_type
=
Node
::
comma_list
;
else
if
(
sep_string
==
"space"
)
sep_type
=
Node
::
space_list
;
else
if
(
sep_string
==
"space"
)
sep_type
=
Node
::
space_list
;
else
if
(
sep_string
==
"auto"
)
sep_type
=
list
.
type
();
else
if
(
sep_string
==
"auto"
)
sep_type
=
list
.
type
();
else
throw_eval_error
(
"third argument to
append
must be 'space', 'comma', or 'auto'"
,
path
,
line
);
else
throw_eval_error
(
"third argument to
'append'
must be 'space', 'comma', or 'auto'"
,
path
,
line
);
Node
new_list
(
new_Node
(
sep_type
,
path
,
line
,
list
.
size
()
+
1
));
Node
new_list
(
new_Node
(
sep_type
,
path
,
line
,
list
.
size
()
+
1
));
new_list
+=
list
;
new_list
+=
list
;
...
@@ -997,7 +998,7 @@ namespace Sass {
...
@@ -997,7 +998,7 @@ namespace Sass {
extern
Signature
unit_sig
=
"unit($number)"
;
extern
Signature
unit_sig
=
"unit($number)"
;
Node
unit
(
const
Node
parameter_names
,
Environment
&
bindings
,
Node_Factory
&
new_Node
,
string
&
path
,
size_t
line
)
{
Node
unit
(
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
(
unit_sig
,
path
,
line
,
parameter_names
,
bindings
,
0
,
Node
::
numeric
)
);
switch
(
val
.
type
())
switch
(
val
.
type
())
{
{
case
Node
:
:
number
:
{
case
Node
:
:
number
:
{
...
@@ -1009,6 +1010,7 @@ namespace Sass {
...
@@ -1009,6 +1010,7 @@ namespace Sass {
return
new_Node
(
Node
::
string_constant
,
path
,
line
,
val
.
unit
());
return
new_Node
(
Node
::
string_constant
,
path
,
line
,
val
.
unit
());
}
break
;
}
break
;
// unreachable
default:
{
default:
{
throw_eval_error
(
"argument to unit must be numeric"
,
path
,
line
);
throw_eval_error
(
"argument to unit must be numeric"
,
path
,
line
);
}
break
;
}
break
;
...
...
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