Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/ast/ast.h" | 5 #include "src/ast/ast.h" |
| 6 | 6 |
| 7 #include <cmath> // For isfinite. | 7 #include <cmath> // For isfinite. |
| 8 | 8 |
| 9 #include "src/ast/prettyprinter.h" | 9 #include "src/ast/prettyprinter.h" |
| 10 #include "src/ast/scopes.h" | 10 #include "src/ast/scopes.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 118 | 118 |
| 119 bool Expression::ToBooleanIsTrue() const { | 119 bool Expression::ToBooleanIsTrue() const { |
| 120 return IsLiteral() && AsLiteral()->ToBooleanIsTrue(); | 120 return IsLiteral() && AsLiteral()->ToBooleanIsTrue(); |
| 121 } | 121 } |
| 122 | 122 |
| 123 bool Expression::ToBooleanIsFalse() const { | 123 bool Expression::ToBooleanIsFalse() const { |
| 124 return IsLiteral() && AsLiteral()->ToBooleanIsFalse(); | 124 return IsLiteral() && AsLiteral()->ToBooleanIsFalse(); |
| 125 } | 125 } |
| 126 | 126 |
| 127 bool Expression::IsValidReferenceExpression() const { | 127 bool Expression::IsValidReferenceExpression() const { |
| 128 // We don't want expressions wrapped inside RewritableExpression to be | |
| 129 // considered as valid reference expressions, as they will be rewritten | |
| 130 // to something (most probably involving a do expression). | |
| 131 if (IsRewritableExpression()) return false; | |
|
Michael Starzinger
2016/07/18 13:08:04
I am confused, how can the below predicate return
Michael Starzinger
2016/07/18 13:10:13
Ah, now I see, the IsFoo predicates actually speci
nickie
2016/07/18 13:13:18
That's the point. They never should be. They nev
| |
| 128 return IsProperty() || | 132 return IsProperty() || |
| 129 (IsVariableProxy() && AsVariableProxy()->IsValidReferenceExpression()); | 133 (IsVariableProxy() && AsVariableProxy()->IsValidReferenceExpression()); |
| 130 } | 134 } |
| 131 | 135 |
| 132 bool Expression::IsValidReferenceExpressionOrThis() const { | 136 bool Expression::IsValidReferenceExpressionOrThis() const { |
| 133 return IsValidReferenceExpression() || | 137 return IsValidReferenceExpression() || |
| 134 (IsVariableProxy() && AsVariableProxy()->is_this()); | 138 (IsVariableProxy() && AsVariableProxy()->is_this()); |
| 135 } | 139 } |
| 136 | 140 |
| 137 bool Expression::IsAnonymousFunctionDefinition() const { | 141 bool Expression::IsAnonymousFunctionDefinition() const { |
| (...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1234 bool Literal::Match(void* literal1, void* literal2) { | 1238 bool Literal::Match(void* literal1, void* literal2) { |
| 1235 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); | 1239 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); |
| 1236 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); | 1240 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); |
| 1237 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || | 1241 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || |
| 1238 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); | 1242 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); |
| 1239 } | 1243 } |
| 1240 | 1244 |
| 1241 | 1245 |
| 1242 } // namespace internal | 1246 } // namespace internal |
| 1243 } // namespace v8 | 1247 } // namespace v8 |
| OLD | NEW |