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

Side by Side Diff: src/preparser.h

Issue 1189743003: [destructuring] Implement parameter pattern matching. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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
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_PREPARSER_H 5 #ifndef V8_PREPARSER_H
6 #define V8_PREPARSER_H 6 #define V8_PREPARSER_H
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/bailout-reason.h" 10 #include "src/bailout-reason.h"
(...skipping 1498 matching lines...) Expand 10 before | Expand all | Expand 10 after
1509 } 1509 }
1510 1510
1511 static PreParserStatementList NewStatementList(int size, Zone* zone) { 1511 static PreParserStatementList NewStatementList(int size, Zone* zone) {
1512 return PreParserStatementList(); 1512 return PreParserStatementList();
1513 } 1513 }
1514 1514
1515 static PreParserExpressionList NewPropertyList(int size, Zone* zone) { 1515 static PreParserExpressionList NewPropertyList(int size, Zone* zone) {
1516 return PreParserExpressionList(); 1516 return PreParserExpressionList();
1517 } 1517 }
1518 1518
1519 static void AddParameterInitializationBlock(PreParserStatementList list,
1520 bool* ok) {}
1521
1519 V8_INLINE void SkipLazyFunctionBody(int* materialized_literal_count, 1522 V8_INLINE void SkipLazyFunctionBody(int* materialized_literal_count,
1520 int* expected_property_count, bool* ok) { 1523 int* expected_property_count, bool* ok) {
1521 UNREACHABLE(); 1524 UNREACHABLE();
1522 } 1525 }
1523 1526
1524 V8_INLINE PreParserStatementList 1527 V8_INLINE PreParserStatementList
1525 ParseEagerFunctionBody(PreParserIdentifier function_name, int pos, 1528 ParseEagerFunctionBody(PreParserIdentifier function_name, int pos,
1526 Variable* fvar, Token::Value fvar_init_op, 1529 Variable* fvar, Token::Value fvar_init_op,
1527 FunctionKind kind, bool* ok); 1530 FunctionKind kind, bool* ok);
1528 1531
(...skipping 2095 matching lines...) Expand 10 before | Expand all | Expand 10 after
3624 } 3627 }
3625 } else { 3628 } else {
3626 // Single-expression body 3629 // Single-expression body
3627 int pos = position(); 3630 int pos = position();
3628 parenthesized_function_ = false; 3631 parenthesized_function_ = false;
3629 ExpressionClassifier classifier; 3632 ExpressionClassifier classifier;
3630 ExpressionT expression = 3633 ExpressionT expression =
3631 ParseAssignmentExpression(true, &classifier, CHECK_OK); 3634 ParseAssignmentExpression(true, &classifier, CHECK_OK);
3632 ValidateExpression(&classifier, CHECK_OK); 3635 ValidateExpression(&classifier, CHECK_OK);
3633 body = this->NewStatementList(1, zone()); 3636 body = this->NewStatementList(1, zone());
3637 this->AddParameterInitializationBlock(body, CHECK_OK);
3634 body->Add(factory()->NewReturnStatement(expression, pos), zone()); 3638 body->Add(factory()->NewReturnStatement(expression, pos), zone());
3635 materialized_literal_count = function_state.materialized_literal_count(); 3639 materialized_literal_count = function_state.materialized_literal_count();
3636 expected_property_count = function_state.expected_property_count(); 3640 expected_property_count = function_state.expected_property_count();
3637 } 3641 }
3638 super_loc = function_state.super_location(); 3642 super_loc = function_state.super_location();
3639 3643
3640 scope->set_end_position(scanner()->location().end_pos); 3644 scope->set_end_position(scanner()->location().end_pos);
3641 3645
3642 // Arrow function formal parameters are parsed as StrictFormalParameterList, 3646 // Arrow function formal parameters are parsed as StrictFormalParameterList,
3643 // which is not the same as "parameters of a strict function"; it only means 3647 // which is not the same as "parameters of a strict function"; it only means
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
3857 *ok = false; 3861 *ok = false;
3858 return; 3862 return;
3859 } 3863 }
3860 has_seen_constructor_ = true; 3864 has_seen_constructor_ = true;
3861 return; 3865 return;
3862 } 3866 }
3863 } 3867 }
3864 } } // v8::internal 3868 } } // v8::internal
3865 3869
3866 #endif // V8_PREPARSER_H 3870 #endif // V8_PREPARSER_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698