Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(753)

Unified Diff: src/ast.cc

Issue 18429005: Undefined is not a literal. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: address comments Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698