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
0917520e
Commit
0917520e
authored
Sep 25, 2012
by
Aaron Leung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Working on an elusive evaluation bug.
parent
4c086066
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
11 deletions
+45
-11
environment.hpp
environment.hpp
+12
-0
eval_apply.cpp
eval_apply.cpp
+22
-0
node_emitters.cpp
node_emitters.cpp
+11
-11
No files found.
environment.hpp
View file @
0917520e
...
@@ -37,5 +37,16 @@ namespace Sass {
...
@@ -37,5 +37,16 @@ namespace Sass {
else
if
(
parent
)
return
(
*
parent
)[
key
];
else
if
(
parent
)
return
(
*
parent
)[
key
];
else
return
current_frame
[
key
];
else
return
current_frame
[
key
];
}
}
void
print
()
{
for
(
map
<
Token
,
Node
>::
iterator
i
=
current_frame
.
begin
();
i
!=
current_frame
.
end
();
++
i
)
{
cerr
<<
i
->
first
.
to_string
()
<<
": "
<<
i
->
second
.
to_string
()
<<
endl
;
}
if
(
parent
)
{
cerr
<<
"---"
<<
endl
;
parent
->
print
();
}
}
};
};
}
}
\ No newline at end of file
eval_apply.cpp
View file @
0917520e
...
@@ -278,6 +278,14 @@ namespace Sass {
...
@@ -278,6 +278,14 @@ namespace Sass {
case
Node
:
:
variable
:
{
case
Node
:
:
variable
:
{
if
(
!
env
.
query
(
expr
.
token
()))
throw_eval_error
(
"reference to unbound variable "
+
expr
.
token
().
to_string
(),
expr
.
path
(),
expr
.
line
());
if
(
!
env
.
query
(
expr
.
token
()))
throw_eval_error
(
"reference to unbound variable "
+
expr
.
token
().
to_string
(),
expr
.
path
(),
expr
.
line
());
cerr
<<
"ACCESSING VARIABLE "
<<
expr
.
token
().
to_string
()
<<
endl
;
cerr
<<
endl
<<
"*** ENV DUMP ***"
<<
endl
;
env
.
print
();
cerr
<<
"*** END ENV ***"
<<
endl
<<
endl
;
return
env
[
expr
.
token
()];
return
env
[
expr
.
token
()];
}
break
;
}
break
;
...
@@ -454,6 +462,7 @@ namespace Sass {
...
@@ -454,6 +462,7 @@ namespace Sass {
case
Node
:
:
warning
:
{
case
Node
:
:
warning
:
{
expr
[
0
]
=
eval
(
expr
[
0
],
prefix
,
env
,
f_env
,
new_Node
,
ctx
);
expr
[
0
]
=
eval
(
expr
[
0
],
prefix
,
env
,
f_env
,
new_Node
,
ctx
);
cerr
<<
"WARNING:"
<<
expr
.
path
()
<<
":"
<<
expr
.
line
()
<<
" -- "
<<
expr
[
0
].
to_string
()
<<
endl
;
return
expr
;
return
expr
;
}
break
;
}
break
;
...
@@ -759,10 +768,14 @@ namespace Sass {
...
@@ -759,10 +768,14 @@ namespace Sass {
val
=
eval
(
val
,
Node
(),
bindings
,
ctx
.
function_env
,
new_Node
,
ctx
);
val
=
eval
(
val
,
Node
(),
bindings
,
ctx
.
function_env
,
new_Node
,
ctx
);
}
}
Node
var
(
stm
[
0
]);
Node
var
(
stm
[
0
]);
// cerr << "ASSIGNMENT IN FUNCTION: " << var.to_string() << ": " << val.to_string() << endl;
if
(
stm
.
is_guarded
()
&&
bindings
.
query
(
var
.
token
()))
continue
;
if
(
stm
.
is_guarded
()
&&
bindings
.
query
(
var
.
token
()))
continue
;
// If a binding exists (possibly upframe), then update it.
// If a binding exists (possibly upframe), then update it.
// Otherwise, make a new one in the current frame.
// Otherwise, make a new one in the current frame.
if
(
bindings
.
query
(
var
.
token
()))
{
if
(
bindings
.
query
(
var
.
token
()))
{
cerr
<<
"MODIFYING EXISTING BINDING FOR "
<<
var
.
token
().
to_string
()
<<
endl
;
cerr
<<
"CURRENT VALUE: "
<<
bindings
[
var
.
token
()].
to_string
()
<<
endl
;
cerr
<<
"NEW VALUE: "
<<
val
.
to_string
()
<<
endl
;
bindings
[
var
.
token
()]
=
val
;
bindings
[
var
.
token
()]
=
val
;
}
}
else
{
else
{
...
@@ -818,7 +831,11 @@ namespace Sass {
...
@@ -818,7 +831,11 @@ namespace Sass {
each_env
.
link
(
bindings
);
each_env
.
link
(
bindings
);
for
(
size_t
j
=
0
,
T
=
list
.
size
();
j
<
T
;
++
j
)
{
for
(
size_t
j
=
0
,
T
=
list
.
size
();
j
<
T
;
++
j
)
{
each_env
.
current_frame
[
iter_var
.
token
()]
=
eval
(
list
[
j
],
Node
(),
bindings
,
ctx
.
function_env
,
new_Node
,
ctx
);
each_env
.
current_frame
[
iter_var
.
token
()]
=
eval
(
list
[
j
],
Node
(),
bindings
,
ctx
.
function_env
,
new_Node
,
ctx
);
cerr
<<
"EACH with "
<<
iter_var
.
token
().
to_string
()
<<
": "
<<
each_env
[
iter_var
.
token
()].
to_string
()
<<
endl
;
Node
v
(
function_eval
(
name
,
each_body
,
each_env
,
new_Node
,
ctx
));
Node
v
(
function_eval
(
name
,
each_body
,
each_env
,
new_Node
,
ctx
));
// cerr << endl << "*** ENV DUMP ***" << endl;
// each_env.print();
// cerr << "*** END ENV ***" << endl << endl;
if
(
v
.
is_null_ptr
())
continue
;
if
(
v
.
is_null_ptr
())
continue
;
else
return
v
;
else
return
v
;
}
}
...
@@ -840,6 +857,11 @@ namespace Sass {
...
@@ -840,6 +857,11 @@ namespace Sass {
}
}
}
break
;
}
break
;
case
Node
:
:
warning
:
{
stm
[
0
]
=
eval
(
stm
[
0
],
Node
(),
bindings
,
ctx
.
function_env
,
new_Node
,
ctx
);
cerr
<<
"WARNING:"
<<
stm
.
path
()
<<
":"
<<
stm
.
line
()
<<
" -- "
<<
stm
[
0
].
to_string
()
<<
endl
;
}
break
;
case
Node
:
:
return_directive
:
{
case
Node
:
:
return_directive
:
{
Node
retval
(
eval
(
stm
[
0
],
Node
(),
bindings
,
ctx
.
function_env
,
new_Node
,
ctx
));
Node
retval
(
eval
(
stm
[
0
],
Node
(),
bindings
,
ctx
.
function_env
,
new_Node
,
ctx
));
if
(
retval
.
type
()
==
Node
::
comma_list
||
retval
.
type
()
==
Node
::
space_list
)
{
if
(
retval
.
type
()
==
Node
::
comma_list
||
retval
.
type
()
==
Node
::
space_list
)
{
...
...
node_emitters.cpp
View file @
0917520e
...
@@ -368,17 +368,17 @@ namespace Sass {
...
@@ -368,17 +368,17 @@ namespace Sass {
}
break
;
}
break
;
case
warning
:
{
case
warning
:
{
string
prefix
(
"WARNING: "
);
//
string prefix("WARNING: ");
string
indent
(
" "
);
//
string indent(" ");
Node
contents
(
at
(
0
));
//
Node contents(at(0));
string
result
(
contents
.
to_string
());
//
string result(contents.to_string());
if
(
contents
.
type
()
==
string_constant
||
contents
.
type
()
==
string_schema
)
{
//
if (contents.type() == string_constant || contents.type() == string_schema) {
result
=
result
.
substr
(
1
,
result
.
size
()
-
2
);
// unquote if it's a single string
//
result = result.substr(1, result.size()-2); // unquote if it's a single string
}
//
}
// These cerrs aren't log lines! They're supposed to be here!
//
//
These cerrs aren't log lines! They're supposed to be here!
cerr
<<
prefix
<<
result
<<
endl
;
//
cerr << prefix << result << endl;
cerr
<<
indent
<<
"on line "
<<
at
(
0
).
line
()
<<
" of "
<<
at
(
0
).
path
();
//
cerr << indent << "on line " << at(0).line() << " of " << at(0).path();
cerr
<<
endl
<<
endl
;
//
cerr << endl << endl;
return
""
;
return
""
;
}
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