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

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

Issue 2369293003: [ast] Make FunctionLiteral delegate to its Scope for FunctionKind (Closed)
Patch Set: Created 4 years, 2 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 | « src/ast/ast.h ('k') | src/parsing/parser.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/compile-time-value.h" 9 #include "src/ast/compile-time-value.h"
10 #include "src/ast/prettyprinter.h" 10 #include "src/ast/prettyprinter.h"
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 306
307 int FunctionLiteral::end_position() const { 307 int FunctionLiteral::end_position() const {
308 return scope()->end_position(); 308 return scope()->end_position();
309 } 309 }
310 310
311 311
312 LanguageMode FunctionLiteral::language_mode() const { 312 LanguageMode FunctionLiteral::language_mode() const {
313 return scope()->language_mode(); 313 return scope()->language_mode();
314 } 314 }
315 315
316 FunctionKind FunctionLiteral::kind() const { return scope()->function_kind(); }
316 317
317 bool FunctionLiteral::NeedsHomeObject(Expression* expr) { 318 bool FunctionLiteral::NeedsHomeObject(Expression* expr) {
318 if (expr == nullptr || !expr->IsFunctionLiteral()) return false; 319 if (expr == nullptr || !expr->IsFunctionLiteral()) return false;
319 DCHECK_NOT_NULL(expr->AsFunctionLiteral()->scope()); 320 DCHECK_NOT_NULL(expr->AsFunctionLiteral()->scope());
320 return expr->AsFunctionLiteral()->scope()->NeedsHomeObject(); 321 return expr->AsFunctionLiteral()->scope()->NeedsHomeObject();
321 } 322 }
322 323
323 ObjectLiteralProperty::ObjectLiteralProperty(Expression* key, Expression* value, 324 ObjectLiteralProperty::ObjectLiteralProperty(Expression* key, Expression* value,
324 Kind kind, bool is_computed_name) 325 Kind kind, bool is_computed_name)
325 : LiteralProperty(key, value, is_computed_name), 326 : LiteralProperty(key, value, is_computed_name),
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 // static 958 // static
958 bool Literal::Match(void* literal1, void* literal2) { 959 bool Literal::Match(void* literal1, void* literal2) {
959 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); 960 const AstValue* x = static_cast<Literal*>(literal1)->raw_value();
960 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); 961 const AstValue* y = static_cast<Literal*>(literal2)->raw_value();
961 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || 962 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) ||
962 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); 963 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber());
963 } 964 }
964 965
965 } // namespace internal 966 } // namespace internal
966 } // namespace v8 967 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast/ast.h ('k') | src/parsing/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698