| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 switch (node_type()) { | 59 switch (node_type()) { |
| 60 LITERAL_NODE_LIST(RETURN_NODE); | 60 LITERAL_NODE_LIST(RETURN_NODE); |
| 61 default: | 61 default: |
| 62 return nullptr; | 62 return nullptr; |
| 63 } | 63 } |
| 64 } | 64 } |
| 65 | 65 |
| 66 #undef RETURN_NODE | 66 #undef RETURN_NODE |
| 67 | 67 |
| 68 bool Expression::IsSmiLiteral() const { | 68 bool Expression::IsSmiLiteral() const { |
| 69 return IsLiteral() && AsLiteral()->value()->IsSmi(); | 69 return IsLiteral() && AsLiteral()->raw_value()->IsSmi(); |
| 70 } | 70 } |
| 71 | 71 |
| 72 | |
| 73 bool Expression::IsStringLiteral() const { | 72 bool Expression::IsStringLiteral() const { |
| 74 return IsLiteral() && AsLiteral()->value()->IsString(); | 73 return IsLiteral() && AsLiteral()->raw_value()->IsString(); |
| 75 } | 74 } |
| 76 | 75 |
| 77 bool Expression::IsPropertyName() const { | 76 bool Expression::IsPropertyName() const { |
| 78 return IsLiteral() && AsLiteral()->IsPropertyName(); | 77 return IsLiteral() && AsLiteral()->IsPropertyName(); |
| 79 } | 78 } |
| 80 | 79 |
| 81 bool Expression::IsNullLiteral() const { | 80 bool Expression::IsNullLiteral() const { |
| 82 if (!IsLiteral()) return false; | 81 if (!IsLiteral()) return false; |
| 83 return AsLiteral()->raw_value()->IsNull(); | 82 return AsLiteral()->raw_value()->IsNull(); |
| 84 } | 83 } |
| (...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 961 // static | 960 // static |
| 962 bool Literal::Match(void* literal1, void* literal2) { | 961 bool Literal::Match(void* literal1, void* literal2) { |
| 963 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); | 962 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); |
| 964 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); | 963 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); |
| 965 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || | 964 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || |
| 966 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); | 965 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); |
| 967 } | 966 } |
| 968 | 967 |
| 969 } // namespace internal | 968 } // namespace internal |
| 970 } // namespace v8 | 969 } // namespace v8 |
| OLD | NEW |