Index: src/ast.cc |
diff --git a/src/ast.cc b/src/ast.cc |
index 964f5bc76e2ea88b9b0f16fac9f167ed3d5bd927..6317e50b8b0365c19273f96ba8443dcd5cefcf82 100644 |
--- a/src/ast.cc |
+++ b/src/ast.cc |
@@ -72,7 +72,13 @@ bool Expression::IsNullLiteral() { |
bool Expression::IsUndefinedLiteral() { |
- return AsLiteral() != NULL && AsLiteral()->value()->IsUndefined(); |
+ if (!IsVariableProxy()) return false; |
+ VariableProxy* var_proxy = static_cast<VariableProxy*>(this); |
rossberg
2013/07/12 13:40:32
Instead of these two lines, use AsVariableProxy()
|
+ Variable* var = var_proxy->var(); |
+ // The global identifier "undefined" is immutable. Everything |
+ // else could be reassigned. |
+ return var != NULL && var->location() == Variable::UNALLOCATED && |
+ strncmp(*var_proxy->name()->ToCString(), "undefined", 10) == 0; |
rossberg
2013/07/12 13:40:32
You should be able to say
var->name()->Equals(i
|
} |