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
ccedd982
Commit
ccedd982
authored
Oct 08, 2012
by
Aaron Leung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New top-level inheritance resolving function. In progress.
parent
766673fc
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
0 deletions
+51
-0
eval_apply.cpp
eval_apply.cpp
+51
-0
No files found.
eval_apply.cpp
View file @
ccedd982
...
...
@@ -203,6 +203,7 @@ namespace Sass {
break
;
}
// extendee -> { extenders }
ctx
.
extensions
.
insert
(
pair
<
Node
,
Node
>
(
expr
[
0
],
prefix
));
ctx
.
has_extensions
=
true
;
}
break
;
...
...
@@ -1083,6 +1084,56 @@ namespace Sass {
// selector to see whether it's the base of an extension. Needs to be a
// separate pass after evaluation because extension requests may be located
// within mixins, and their targets may be interpolated.
void
extend
(
Node
expr
,
multimap
<
Node
,
Node
>&
extension_requests
,
Node_Factory
&
new_Node
)
{
switch
(
expr
.
type
())
{
case
Node
:
:
ruleset
:
{
// check single selector
if
(
expr
[
2
].
type
()
!=
Node
::
selector_group
)
{
Node
sel
(
selector_base
(
expr
[
2
]));
if
(
extension_requests
.
count
(
sel
))
{
for
(
multimap
<
Node
,
Node
>::
iterator
i
=
extension_requests
.
lower_bound
(
sel
);
i
!=
extension_requests
.
upper_bound
(
sel
);
++
i
)
{
// something!
}
}
}
// individually check each selector in a group
else
{
Node
group
(
expr
[
2
]);
for
(
size_t
i
=
0
,
S
=
group
.
size
();
i
<
S
;
++
i
)
{
Node
sel
(
selector_base
(
group
[
i
]));
if
(
extension_requests
.
count
(
sel
))
{
for
(
multimap
<
Node
,
Node
>::
iterator
j
=
extension_requests
.
lower_bound
(
sel
);
j
!=
extension_requests
.
upper_bound
(
sel
);
++
j
)
{
// something!
}
}
}
}
}
break
;
case
Node
:
:
root
:
case
Node
:
:
block
:
case
Node
:
:
mixin_call
:
case
Node
:
:
if_directive
:
case
Node
:
:
for_through_directive
:
case
Node
:
:
for_to_directive
:
case
Node
:
:
each_directive
:
case
Node
:
:
while_directive
:
{
// at this point, all directives have been expanded into style blocks,
// so just recursively process their children
for
(
size_t
i
=
0
,
S
<
expr
.
size
();
i
<
S
;
++
i
)
{
extend
(
expr
[
i
],
extension_requests
,
new_Node
);
}
}
break
;
default:
{
// do nothing
}
break
;
}
return
;
}
void
extend_selectors
(
vector
<
pair
<
Node
,
Node
>
>&
pending
,
multimap
<
Node
,
Node
>&
extension_table
,
Node_Factory
&
new_Node
)
{
for
(
size_t
i
=
0
,
S
=
pending
.
size
();
i
<
S
;
++
i
)
{
...
...
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