Reviewers: danno,
Description:
There is no undefined Literal.
BUG=
Please review this at https://codereview.chromium.org/18429005/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/ast.h
M src/ast.cc
Index: src/ast.cc
diff --git a/src/ast.cc b/src/ast.cc
index
964f5bc76e2ea88b9b0f16fac9f167ed3d5bd927..2b8bc2d3d75207c3438014b4dce7f83c9c23e90c
100644
--- a/src/ast.cc
+++ b/src/ast.cc
@@ -71,11 +71,6 @@ bool Expression::IsNullLiteral() {
}
-bool Expression::IsUndefinedLiteral() {
- return AsLiteral() != NULL && AsLiteral()->value()->IsUndefined();
-}
-
-
VariableProxy::VariableProxy(Isolate* isolate, Variable* var)
: Expression(isolate),
name_(var->name()),
@@ -390,9 +385,12 @@ static bool MatchLiteralCompareUndefined(Expression*
left,
*expr = right;
return true;
}
- if (left->IsUndefinedLiteral() && Token::IsEqualityOp(op)) {
- *expr = right;
- return true;
+ if (left->IsVariableProxy() && Token::IsEqualityOp(op)) {
+ VariableProxy* var = static_cast<VariableProxy*>(left);
+ if (strncmp(*var->name()->ToCString(), "undefined", 10) == 0) {
+ *expr = right;
+ return true;
+ }
}
return false;
}
Index: src/ast.h
diff --git a/src/ast.h b/src/ast.h
index
6336b3a14b0e144aee345f0f2b91acce270f37ac..ee9473e0fc82eda49b8003ca278767f7da1e11c5
100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -353,9 +353,6 @@ class Expression: public AstNode {
// True iff the expression is the null literal.
bool IsNullLiteral();
- // True iff the expression is the undefined literal.
- bool IsUndefinedLiteral();
-
// Expression type bounds
Handle<Type> upper_type() { return upper_type_; }
Handle<Type> lower_type() { return lower_type_; }
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.