| 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 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 for (int i = 0; i < expressions->length(); i++) { | 812 for (int i = 0; i < expressions->length(); i++) { |
| 813 // The variable statement visiting code may pass NULL expressions | 813 // The variable statement visiting code may pass NULL expressions |
| 814 // to this code. Maybe this should be handled by introducing an | 814 // to this code. Maybe this should be handled by introducing an |
| 815 // undefined expression or literal? Revisit this code if this | 815 // undefined expression or literal? Revisit this code if this |
| 816 // changes | 816 // changes |
| 817 Expression* expression = expressions->at(i); | 817 Expression* expression = expressions->at(i); |
| 818 if (expression != NULL) Visit(expression); | 818 if (expression != NULL) Visit(expression); |
| 819 } | 819 } |
| 820 } | 820 } |
| 821 | 821 |
| 822 | |
| 823 CaseClause::CaseClause(Zone* zone, Expression* label, | 822 CaseClause::CaseClause(Zone* zone, Expression* label, |
| 824 ZoneList<Statement*>* statements, int pos) | 823 ZoneList<Statement*>* statements, int pos) |
| 825 : Expression(zone, pos), | 824 : Expression(zone, pos), |
| 826 label_(label), | 825 label_(label), |
| 827 statements_(statements), | 826 statements_(statements), |
| 828 compare_type_(Type::None(zone)) {} | 827 compare_type_(Type::None()) {} |
| 829 | |
| 830 | 828 |
| 831 uint32_t Literal::Hash() { | 829 uint32_t Literal::Hash() { |
| 832 return raw_value()->IsString() | 830 return raw_value()->IsString() |
| 833 ? raw_value()->AsString()->hash() | 831 ? raw_value()->AsString()->hash() |
| 834 : ComputeLongHash(double_to_uint64(raw_value()->AsNumber())); | 832 : ComputeLongHash(double_to_uint64(raw_value()->AsNumber())); |
| 835 } | 833 } |
| 836 | 834 |
| 837 | 835 |
| 838 // static | 836 // static |
| 839 bool Literal::Match(void* literal1, void* literal2) { | 837 bool Literal::Match(void* literal1, void* literal2) { |
| 840 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); | 838 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); |
| 841 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); | 839 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); |
| 842 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || | 840 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || |
| 843 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); | 841 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); |
| 844 } | 842 } |
| 845 | 843 |
| 846 | 844 |
| 847 } // namespace internal | 845 } // namespace internal |
| 848 } // namespace v8 | 846 } // namespace v8 |
| OLD | NEW |