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

Side by Side Diff: src/ast/ast.cc

Issue 2243783002: Call IsStringLiteral instead of IsPropertyName in VisitObjectLiteral. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/compiler/ast-graph-builder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | src/compiler/ast-graph-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698