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/parsing/parser-base.h

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/parsing/parser.cc ('k') | src/parsing/preparser.h » ('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 #ifndef V8_PARSING_PARSER_BASE_H 5 #ifndef V8_PARSING_PARSER_BASE_H
6 #define V8_PARSING_PARSER_BASE_H 6 #define V8_PARSING_PARSER_BASE_H
7 7
8 #include "src/ast/ast.h" 8 #include "src/ast/ast.h"
9 #include "src/ast/scopes.h" 9 #include "src/ast/scopes.h"
10 #include "src/bailout-reason.h" 10 #include "src/bailout-reason.h"
(...skipping 2275 matching lines...) Expand 10 before | Expand all | Expand 10 after
2286 } 2286 }
2287 initializer_scope->set_end_position(scanner()->location().end_pos); 2287 initializer_scope->set_end_position(scanner()->location().end_pos);
2288 typename Types::StatementList body = impl()->NewStatementList(1); 2288 typename Types::StatementList body = impl()->NewStatementList(1);
2289 body->Add(factory()->NewReturnStatement(value, kNoSourcePosition), zone()); 2289 body->Add(factory()->NewReturnStatement(value, kNoSourcePosition), zone());
2290 FunctionLiteralT function_literal = factory()->NewFunctionLiteral( 2290 FunctionLiteralT function_literal = factory()->NewFunctionLiteral(
2291 impl()->EmptyIdentifierString(), initializer_scope, body, 2291 impl()->EmptyIdentifierString(), initializer_scope, body,
2292 initializer_state.materialized_literal_count(), 2292 initializer_state.materialized_literal_count(),
2293 initializer_state.expected_property_count(), 0, 2293 initializer_state.expected_property_count(), 0,
2294 FunctionLiteral::kNoDuplicateParameters, 2294 FunctionLiteral::kNoDuplicateParameters,
2295 FunctionLiteral::kAnonymousExpression, 2295 FunctionLiteral::kAnonymousExpression,
2296 FunctionLiteral::kShouldLazyCompile, kind, 2296 FunctionLiteral::kShouldLazyCompile, initializer_scope->start_position());
2297 initializer_scope->start_position());
2298 function_literal->set_is_class_field_initializer(true); 2297 function_literal->set_is_class_field_initializer(true);
2299 return function_literal; 2298 return function_literal;
2300 } 2299 }
2301 2300
2302 template <typename Impl> 2301 template <typename Impl>
2303 typename ParserBase<Impl>::ObjectLiteralPropertyT 2302 typename ParserBase<Impl>::ObjectLiteralPropertyT
2304 ParserBase<Impl>::ParseObjectPropertyDefinition(ObjectLiteralChecker* checker, 2303 ParserBase<Impl>::ParseObjectPropertyDefinition(ObjectLiteralChecker* checker,
2305 bool* is_computed_name, 2304 bool* is_computed_name,
2306 bool* ok) { 2305 bool* ok) {
2307 bool is_get = false; 2306 bool is_get = false;
(...skipping 1724 matching lines...) Expand 10 before | Expand all | Expand 10 after
4032 } 4031 }
4033 impl()->CheckConflictingVarDeclarations(formal_parameters.scope, CHECK_OK); 4032 impl()->CheckConflictingVarDeclarations(formal_parameters.scope, CHECK_OK);
4034 4033
4035 impl()->RewriteDestructuringAssignments(); 4034 impl()->RewriteDestructuringAssignments();
4036 } 4035 }
4037 4036
4038 FunctionLiteralT function_literal = factory()->NewFunctionLiteral( 4037 FunctionLiteralT function_literal = factory()->NewFunctionLiteral(
4039 impl()->EmptyIdentifierString(), formal_parameters.scope, body, 4038 impl()->EmptyIdentifierString(), formal_parameters.scope, body,
4040 materialized_literal_count, expected_property_count, num_parameters, 4039 materialized_literal_count, expected_property_count, num_parameters,
4041 FunctionLiteral::kNoDuplicateParameters, 4040 FunctionLiteral::kNoDuplicateParameters,
4042 FunctionLiteral::kAnonymousExpression, eager_compile_hint, kind, 4041 FunctionLiteral::kAnonymousExpression, eager_compile_hint,
4043 formal_parameters.scope->start_position()); 4042 formal_parameters.scope->start_position());
4044 4043
4045 function_literal->set_function_token_position( 4044 function_literal->set_function_token_position(
4046 formal_parameters.scope->start_position()); 4045 formal_parameters.scope->start_position());
4047 if (should_be_used_once_hint) { 4046 if (should_be_used_once_hint) {
4048 function_literal->set_should_be_used_once_hint(); 4047 function_literal->set_should_be_used_once_hint();
4049 } 4048 }
4050 4049
4051 impl()->InferFunctionName(function_literal); 4050 impl()->InferFunctionName(function_literal);
4052 4051
(...skipping 1360 matching lines...) Expand 10 before | Expand all | Expand 10 after
5413 has_seen_constructor_ = true; 5412 has_seen_constructor_ = true;
5414 return; 5413 return;
5415 } 5414 }
5416 } 5415 }
5417 5416
5418 5417
5419 } // namespace internal 5418 } // namespace internal
5420 } // namespace v8 5419 } // namespace v8
5421 5420
5422 #endif // V8_PARSING_PARSER_BASE_H 5421 #endif // V8_PARSING_PARSER_BASE_H
OLDNEW
« no previous file with comments | « src/parsing/parser.cc ('k') | src/parsing/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698