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
a187103d
Commit
a187103d
authored
Sep 17, 2012
by
Aaron Leung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Converting the 'nth' builtin to the new arg-checking system.
parent
d47e4cd9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
9 deletions
+3
-9
functions.cpp
functions.cpp
+3
-9
No files found.
functions.cpp
View file @
a187103d
...
@@ -847,10 +847,6 @@ namespace Sass {
...
@@ -847,10 +847,6 @@ namespace Sass {
extern
Signature
nth_sig
=
"nth($list, $n)"
;
extern
Signature
nth_sig
=
"nth($list, $n)"
;
Node
nth
(
const
Node
parameter_names
,
Environment
&
bindings
,
Node_Factory
&
new_Node
,
string
&
path
,
size_t
line
)
{
Node
nth
(
const
Node
parameter_names
,
Environment
&
bindings
,
Node_Factory
&
new_Node
,
string
&
path
,
size_t
line
)
{
Node
l
(
bindings
[
parameter_names
[
0
].
token
()]);
Node
l
(
bindings
[
parameter_names
[
0
].
token
()]);
Node
n
(
bindings
[
parameter_names
[
1
].
token
()]);
if
(
n
.
type
()
!=
Node
::
number
)
{
throw_eval_error
(
"second argument to nth must be a number"
,
path
,
line
);
}
if
(
l
.
type
()
==
Node
::
nil
)
{
if
(
l
.
type
()
==
Node
::
nil
)
{
throw_eval_error
(
"cannot index into an empty list"
,
path
,
line
);
throw_eval_error
(
"cannot index into an empty list"
,
path
,
line
);
}
}
...
@@ -858,11 +854,9 @@ namespace Sass {
...
@@ -858,11 +854,9 @@ namespace Sass {
if
(
l
.
type
()
!=
Node
::
space_list
&&
l
.
type
()
!=
Node
::
comma_list
)
{
if
(
l
.
type
()
!=
Node
::
space_list
&&
l
.
type
()
!=
Node
::
comma_list
)
{
l
=
new_Node
(
Node
::
space_list
,
path
,
line
,
1
)
<<
l
;
l
=
new_Node
(
Node
::
space_list
,
path
,
line
,
1
)
<<
l
;
}
}
double
n_prim
=
n
.
numeric_value
();
// just truncate the index if it's not an integer ... more permissive than Ruby Sass
if
(
n_prim
<
1
||
n_prim
>
l
.
size
())
{
size_t
n
=
std
::
floor
(
arg
(
nth_sig
,
path
,
line
,
parameter_names
,
bindings
,
1
,
1
,
l
.
size
()).
numeric_value
());
throw_eval_error
(
"out of range index for nth"
,
path
,
line
);
return
l
[
n
-
1
];
}
return
l
[
n_prim
-
1
];
}
}
extern
Signature
join_sig
=
"join($list1, $list2, $separator: auto)"
;
extern
Signature
join_sig
=
"join($list1, $list2, $separator: auto)"
;
...
...
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