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
8821e71b
Commit
8821e71b
authored
Aug 23, 2012
by
Aaron Leung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implementing the 'if' built-in function.
parent
b3e8d772
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
1 deletions
+16
-1
context.cpp
context.cpp
+1
-0
functions.cpp
functions.cpp
+12
-1
functions.hpp
functions.hpp
+3
-0
No files found.
context.cpp
View file @
8821e71b
...
@@ -158,6 +158,7 @@ namespace Sass {
...
@@ -158,6 +158,7 @@ namespace Sass {
register_function
(
comparable_descriptor
,
comparable
);
register_function
(
comparable_descriptor
,
comparable
);
// Boolean Functions
// Boolean Functions
register_function
(
not_descriptor
,
not_impl
);
register_function
(
not_descriptor
,
not_impl
);
register_function
(
if_descriptor
,
if_impl
);
}
}
void
Context
::
setup_color_map
()
void
Context
::
setup_color_map
()
...
...
functions.cpp
View file @
8821e71b
...
@@ -748,7 +748,7 @@ namespace Sass {
...
@@ -748,7 +748,7 @@ namespace Sass {
// Boolean Functions ///////////////////////////////////////////////////
// Boolean Functions ///////////////////////////////////////////////////
Function_Descriptor
not_descriptor
=
Function_Descriptor
not_descriptor
=
{
"not"
,
"value"
,
0
};
{
"not"
,
"
$
value"
,
0
};
Node
not_impl
(
const
Node
parameters
,
map
<
Token
,
Node
>&
bindings
,
Node_Factory
&
new_Node
)
{
Node
not_impl
(
const
Node
parameters
,
map
<
Token
,
Node
>&
bindings
,
Node_Factory
&
new_Node
)
{
Node
val
(
bindings
[
parameters
[
0
].
token
()]);
Node
val
(
bindings
[
parameters
[
0
].
token
()]);
if
(
val
.
type
()
==
Node
::
boolean
&&
val
.
boolean_value
()
==
false
)
{
if
(
val
.
type
()
==
Node
::
boolean
&&
val
.
boolean_value
()
==
false
)
{
...
@@ -759,5 +759,16 @@ namespace Sass {
...
@@ -759,5 +759,16 @@ namespace Sass {
}
}
}
}
Function_Descriptor
if_descriptor
=
{
"if"
,
"$predicate"
,
"$consequent"
,
"$alternative"
,
0
};
Node
if_impl
(
const
Node
parameters
,
map
<
Token
,
Node
>&
bindings
,
Node_Factory
&
new_Node
)
{
Node
predicate
(
bindings
[
parameters
[
0
].
token
()]);
Node
consequent
(
bindings
[
parameters
[
1
].
token
()]);
Node
alternative
(
bindings
[
parameters
[
2
].
token
()]);
if
(
predicate
.
type
()
==
Node
::
boolean
&&
predicate
.
boolean_value
()
==
false
)
return
alternative
;
return
consequent
;
}
}
}
}
}
functions.hpp
View file @
8821e71b
...
@@ -196,6 +196,9 @@ namespace Sass {
...
@@ -196,6 +196,9 @@ namespace Sass {
extern
Function_Descriptor
not_descriptor
;
extern
Function_Descriptor
not_descriptor
;
Node
not_impl
(
const
Node
parameters
,
map
<
Token
,
Node
>&
bindings
,
Node_Factory
&
new_Node
);
Node
not_impl
(
const
Node
parameters
,
map
<
Token
,
Node
>&
bindings
,
Node_Factory
&
new_Node
);
extern
Function_Descriptor
if_descriptor
;
Node
if_impl
(
const
Node
parameters
,
map
<
Token
,
Node
>&
bindings
,
Node_Factory
&
new_Node
);
}
}
}
}
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