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

Unified Diff: src/parsing/parser-base.h

Issue 1692713005: ES6: Desugaring of instanceof to support @@hasInstance (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@blah
Patch Set: Fixed todos. Created 4 years, 10 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
Index: src/parsing/parser-base.h
diff --git a/src/parsing/parser-base.h b/src/parsing/parser-base.h
index e75e87a65a427da96e9382f58b0a9a8c33fa8460..539209e985d4e9120075b1f041f476ec62408bfa 100644
--- a/src/parsing/parser-base.h
+++ b/src/parsing/parser-base.h
@@ -2246,12 +2246,15 @@ ParserBase<Traits>::ParseBinaryExpression(int prec, bool accept_IN,
*ok = false;
return this->EmptyExpression();
}
- x = factory()->NewCompareOperation(cmp, x, y, pos);
- if (cmp != op) {
- // The comparison was negated - add a NOT.
- x = factory()->NewUnaryOperation(Token::NOT, x, pos);
+ if (FLAG_harmony_instanceof && op == Token::INSTANCEOF) {
rossberg 2016/02/12 14:11:31 Nit: make this and 'else if'. Also, s/op/cmp/
mvstanton 2016/02/18 02:12:17 Done.
+ x = Traits::RewriteInstanceof(x, y, pos);
+ } else {
+ x = factory()->NewCompareOperation(cmp, x, y, pos);
+ if (cmp != op) {
+ // The comparison was negated - add a NOT.
+ x = factory()->NewUnaryOperation(Token::NOT, x, pos);
+ }
}
-
} else {
// We have a "normal" binary operation.
x = factory()->NewBinaryOperation(op, x, y, pos);
« src/parsing/parser.cc ('K') | « src/parsing/parser.cc ('k') | src/parsing/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698