Commit ca0690c7 by Aaron Leung

Giving a field a better name.

parent c8478d3b
...@@ -4,12 +4,15 @@ namespace Sass { ...@@ -4,12 +4,15 @@ namespace Sass {
using std::map; using std::map;
struct Environment { struct Environment {
map<Token, Node> frame; map<Token, Node> current_frame;
Environment* parent; Environment* parent;
Environment() : frame(map<Token, Node>()), parent(0) Environment()
: current_frame(map<Token, Node>()), parent(0)
{ } { }
Environment(Environment* env) : frame(map<Token, Node>()), parent(env) Environment(Environment* env)
: current_frame(map<Token, Node>()),
parent(env)
{ } { }
void link(Environment& env) void link(Environment& env)
...@@ -17,16 +20,16 @@ namespace Sass { ...@@ -17,16 +20,16 @@ namespace Sass {
bool query(const Token& key) const bool query(const Token& key) const
{ {
if (frame.count(key)) return true; if (current_frame.count(key)) return true;
else if (parent) return parent->query(key); else if (parent) return parent->query(key);
else return false; else return false;
} }
Node& operator[](const Token& key) Node& operator[](const Token& key)
{ {
if (frame.count(key)) return frame[key]; if (current_frame.count(key)) return current_frame[key];
else if (parent) return (*parent)[key]; else if (parent) return (*parent)[key];
else return frame[key]; else return current_frame[key];
} }
}; };
......
...@@ -46,7 +46,7 @@ namespace Sass { ...@@ -46,7 +46,7 @@ namespace Sass {
env[expr[0].token] = val; env[expr[0].token] = val;
} }
else { else {
env.frame[expr[0].token] = val; env.current_frame[expr[0].token] = val;
} }
return expr; return expr;
} break; } break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment