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

Side by Side Diff: src/parsing/parser.cc

Issue 2488493003: [inspector] fix positions for single expression arrow function (Closed)
Patch Set: addressed comments Created 4 years, 1 month 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/interpreter/bytecode-array-builder.cc ('k') | src/parsing/parser-base.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 #include "src/parsing/parser.h" 5 #include "src/parsing/parser.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "src/api.h" 9 #include "src/api.h"
10 #include "src/ast/ast-expression-rewriter.h" 10 #include "src/ast/ast-expression-rewriter.h"
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 } 278 }
279 279
280 materialized_literal_count = function_state.materialized_literal_count(); 280 materialized_literal_count = function_state.materialized_literal_count();
281 expected_property_count = function_state.expected_property_count(); 281 expected_property_count = function_state.expected_property_count();
282 } 282 }
283 283
284 FunctionLiteral* function_literal = factory()->NewFunctionLiteral( 284 FunctionLiteral* function_literal = factory()->NewFunctionLiteral(
285 name, function_scope, body, materialized_literal_count, 285 name, function_scope, body, materialized_literal_count,
286 expected_property_count, parameter_count, parameter_count, 286 expected_property_count, parameter_count, parameter_count,
287 FunctionLiteral::kNoDuplicateParameters, 287 FunctionLiteral::kNoDuplicateParameters,
288 FunctionLiteral::kAnonymousExpression, default_eager_compile_hint(), pos); 288 FunctionLiteral::kAnonymousExpression, default_eager_compile_hint(), pos,
289 true);
289 290
290 function_literal->set_requires_class_field_init(requires_class_field_init); 291 function_literal->set_requires_class_field_init(requires_class_field_init);
291 292
292 return function_literal; 293 return function_literal;
293 } 294 }
294 295
295 // ---------------------------------------------------------------------------- 296 // ----------------------------------------------------------------------------
296 // The CHECK_OK macro is a convenient macro to enforce error 297 // The CHECK_OK macro is a convenient macro to enforce error
297 // handling for functions that may fail (by returning !*ok). 298 // handling for functions that may fail (by returning !*ok).
298 // 299 //
(...skipping 2416 matching lines...) Expand 10 before | Expand all | Expand 10 after
2715 } // DiscardableZoneScope goes out of scope. 2716 } // DiscardableZoneScope goes out of scope.
2716 2717
2717 FunctionLiteral::ParameterFlag duplicate_parameters = 2718 FunctionLiteral::ParameterFlag duplicate_parameters =
2718 has_duplicate_parameters ? FunctionLiteral::kHasDuplicateParameters 2719 has_duplicate_parameters ? FunctionLiteral::kHasDuplicateParameters
2719 : FunctionLiteral::kNoDuplicateParameters; 2720 : FunctionLiteral::kNoDuplicateParameters;
2720 2721
2721 // Note that the FunctionLiteral needs to be created in the main Zone again. 2722 // Note that the FunctionLiteral needs to be created in the main Zone again.
2722 FunctionLiteral* function_literal = factory()->NewFunctionLiteral( 2723 FunctionLiteral* function_literal = factory()->NewFunctionLiteral(
2723 function_name, scope, body, materialized_literal_count, 2724 function_name, scope, body, materialized_literal_count,
2724 expected_property_count, num_parameters, function_length, 2725 expected_property_count, num_parameters, function_length,
2725 duplicate_parameters, function_type, eager_compile_hint, pos); 2726 duplicate_parameters, function_type, eager_compile_hint, pos, true);
2726 function_literal->set_function_token_position(function_token_pos); 2727 function_literal->set_function_token_position(function_token_pos);
2727 if (should_be_used_once_hint) 2728 if (should_be_used_once_hint)
2728 function_literal->set_should_be_used_once_hint(); 2729 function_literal->set_should_be_used_once_hint();
2729 2730
2730 if (should_infer_name) { 2731 if (should_infer_name) {
2731 DCHECK_NOT_NULL(fni_); 2732 DCHECK_NOT_NULL(fni_);
2732 fni_->AddFunction(function_literal); 2733 fni_->AddFunction(function_literal);
2733 } 2734 }
2734 return function_literal; 2735 return function_literal;
2735 } 2736 }
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after
3409 } 3410 }
3410 body->Add(factory()->NewReturnStatement(ThisExpression(kNoSourcePosition), 3411 body->Add(factory()->NewReturnStatement(ThisExpression(kNoSourcePosition),
3411 kNoSourcePosition), 3412 kNoSourcePosition),
3412 zone()); 3413 zone());
3413 FunctionLiteral* function_literal = factory()->NewFunctionLiteral( 3414 FunctionLiteral* function_literal = factory()->NewFunctionLiteral(
3414 ast_value_factory()->empty_string(), initializer_scope, body, 3415 ast_value_factory()->empty_string(), initializer_scope, body,
3415 initializer_state.materialized_literal_count(), 3416 initializer_state.materialized_literal_count(),
3416 initializer_state.expected_property_count(), 0, count, 3417 initializer_state.expected_property_count(), 0, count,
3417 FunctionLiteral::kNoDuplicateParameters, 3418 FunctionLiteral::kNoDuplicateParameters,
3418 FunctionLiteral::kAnonymousExpression, 3419 FunctionLiteral::kAnonymousExpression,
3419 FunctionLiteral::kShouldLazyCompile, initializer_scope->start_position()); 3420 FunctionLiteral::kShouldLazyCompile, initializer_scope->start_position(),
3421 true);
3420 function_literal->set_is_class_field_initializer(true); 3422 function_literal->set_is_class_field_initializer(true);
3421 return function_literal; 3423 return function_literal;
3422 } 3424 }
3423 3425
3424 FunctionLiteral* Parser::InsertClassFieldInitializer( 3426 FunctionLiteral* Parser::InsertClassFieldInitializer(
3425 FunctionLiteral* constructor) { 3427 FunctionLiteral* constructor) {
3426 Statement* call_initializer = factory()->NewExpressionStatement( 3428 Statement* call_initializer = factory()->NewExpressionStatement(
3427 CallClassFieldInitializer( 3429 CallClassFieldInitializer(
3428 constructor->scope(), 3430 constructor->scope(),
3429 constructor->scope()->NewUnresolved( 3431 constructor->scope()->NewUnresolved(
(...skipping 1989 matching lines...) Expand 10 before | Expand all | Expand 10 after
5419 5421
5420 return final_loop; 5422 return final_loop;
5421 } 5423 }
5422 5424
5423 #undef CHECK_OK 5425 #undef CHECK_OK
5424 #undef CHECK_OK_VOID 5426 #undef CHECK_OK_VOID
5425 #undef CHECK_FAILED 5427 #undef CHECK_FAILED
5426 5428
5427 } // namespace internal 5429 } // namespace internal
5428 } // namespace v8 5430 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-array-builder.cc ('k') | src/parsing/parser-base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698