Fix checks to bit flags of PreParserExpression
This fixes checks on the "code_" member of PreParserExpression, in order to make methods IsThis(), IsThisProperty(), IsProperty(), IsCall() and IsValidReferenceExpression() work correctly. BUG=v8:3456 LOG= R=svenpanne@chromium.org Review URL: https://codereview.chromium.org/410873004 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22562 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
f5a4b26061
commit
b5220b20bc
@ -676,21 +676,24 @@ class PreParserExpression {
|
||||
return (code_ & kTypeMask) == kTypeStringLiteral;
|
||||
}
|
||||
|
||||
bool IsUseStrictLiteral() {
|
||||
bool IsUseStrictLiteral() const {
|
||||
return (code_ & kUseStrictString) == kUseStrictString;
|
||||
}
|
||||
|
||||
bool IsThis() { return code_ == kThisExpression; }
|
||||
bool IsThis() const { return (code_ & kThisExpression) == kThisExpression; }
|
||||
|
||||
bool IsThisProperty() { return code_ == kThisPropertyExpression; }
|
||||
|
||||
bool IsProperty() {
|
||||
return code_ == kPropertyExpression || code_ == kThisPropertyExpression;
|
||||
bool IsThisProperty() const {
|
||||
return (code_ & kThisPropertyExpression) == kThisPropertyExpression;
|
||||
}
|
||||
|
||||
bool IsCall() { return code_ == kCallExpression; }
|
||||
bool IsProperty() const {
|
||||
return (code_ & kPropertyExpression) == kPropertyExpression ||
|
||||
(code_ & kThisPropertyExpression) == kThisPropertyExpression;
|
||||
}
|
||||
|
||||
bool IsValidReferenceExpression() {
|
||||
bool IsCall() const { return (code_ & kCallExpression) == kCallExpression; }
|
||||
|
||||
bool IsValidReferenceExpression() const {
|
||||
return IsIdentifier() || IsProperty();
|
||||
}
|
||||
|
||||
|
13
test/mjsunit/regress-3456.js
Normal file
13
test/mjsunit/regress-3456.js
Normal file
@ -0,0 +1,13 @@
|
||||
// Copyright 2014 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --min-preparse-length 1
|
||||
|
||||
// Arrow function parsing (commit r22366) changed the flags stored in
|
||||
// PreParserExpression, and IsValidReferenceExpression() would return
|
||||
// false for certain valid expressions. This case is the minimum amount
|
||||
// of code needed to validate that IsValidReferenceExpression() works
|
||||
// properly. If it does not, a ReferenceError is thrown during parsing.
|
||||
|
||||
function f() { ++(this.foo) }
|
Loading…
Reference in New Issue
Block a user