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
ca5286a7
Commit
ca5286a7
authored
May 24, 2012
by
Aaron Leung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding/refactoring some helper methods.
parent
b19c9594
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
2 deletions
+38
-2
context.cpp
context.cpp
+2
-0
functions.cpp
functions.cpp
+1
-2
node.cpp
node.cpp
+17
-0
node.hpp
node.hpp
+18
-0
No files found.
context.cpp
View file @
ca5286a7
#include "context.hpp"
#include <iostream>
#include <unistd.h>
#include "prelexer.hpp"
using
std
::
cerr
;
using
std
::
endl
;
namespace
Sass
{
...
...
functions.cpp
View file @
ca5286a7
...
...
@@ -644,7 +644,6 @@ namespace Sass {
return
new_Node
(
Node
::
boolean
,
val
.
path
(),
val
.
line
(),
false
);
}
}
}
}
node.cpp
View file @
ca5286a7
...
...
@@ -9,6 +9,23 @@ namespace Sass {
// Node method implementations
// ------------------------------------------------------------------------
void
Node
::
flatten
()
{
if
(
type
()
!=
block
&&
type
()
!=
expansion
&&
type
()
!=
root
)
return
;
for
(
size_t
i
=
0
,
S
=
size
();
i
<
S
;
++
i
)
{
if
(
at
(
i
).
type
()
==
expansion
)
{
Node
expn
(
at
(
i
));
if
(
expn
.
has_expansions
())
expn
.
flatten
();
ip_
->
has_statements
|=
expn
.
has_statements
();
ip_
->
has_blocks
|=
expn
.
has_blocks
();
ip_
->
has_expansions
|=
expn
.
has_expansions
();
// leave the expansion node here and skip it during emission
insert
(
begin
()
+
i
,
expn
.
begin
(),
expn
.
end
());
}
}
}
bool
Node
::
operator
==
(
Node
rhs
)
const
{
Type
t
=
type
();
...
...
node.hpp
View file @
ca5286a7
...
...
@@ -177,10 +177,18 @@ namespace Sass {
Node
&
operator
<<
(
Node
n
);
Node
&
operator
+=
(
Node
n
);
vector
<
Node
>::
iterator
begin
();
vector
<
Node
>::
iterator
end
();
void
insert
(
vector
<
Node
>::
iterator
position
,
vector
<
Node
>::
iterator
first
,
vector
<
Node
>::
iterator
last
);
bool
&
boolean_value
()
const
;
double
numeric_value
()
const
;
Token
token
()
const
;
Token
unit
()
const
;
void
flatten
();
bool
operator
==
(
Node
rhs
)
const
;
bool
operator
!=
(
Node
rhs
)
const
;
...
...
@@ -322,6 +330,16 @@ namespace Sass {
for
(
size_t
i
=
0
,
L
=
n
.
size
();
i
<
L
;
++
i
)
push_back
(
n
[
i
]);
return
*
this
;
}
inline
vector
<
Node
>::
iterator
Node
::
begin
()
{
return
ip_
->
children
.
begin
();
}
inline
vector
<
Node
>::
iterator
Node
::
end
()
{
return
ip_
->
children
.
end
();
}
inline
void
Node
::
insert
(
vector
<
Node
>::
iterator
position
,
vector
<
Node
>::
iterator
first
,
vector
<
Node
>::
iterator
last
)
{
ip_
->
children
.
insert
(
position
,
first
,
last
);
}
inline
bool
&
Node
::
boolean_value
()
const
{
return
ip_
->
boolean_value
();
}
inline
double
Node
::
numeric_value
()
const
{
return
ip_
->
numeric_value
();
}
inline
Token
Node
::
token
()
const
{
return
ip_
->
value
.
token
;
}
...
...
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