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

Side by Side Diff: src/preparser.h

Issue 1129083009: [destructuring] Support computed property names in patterns. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Minor test fix Created 5 years, 7 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 2542 matching lines...) Expand 10 before | Expand all | Expand 10 after
2553 2553
2554 case Token::NUMBER: 2554 case Token::NUMBER:
2555 Consume(Token::NUMBER); 2555 Consume(Token::NUMBER);
2556 *name = this->GetNumberAsSymbol(scanner()); 2556 *name = this->GetNumberAsSymbol(scanner());
2557 break; 2557 break;
2558 2558
2559 case Token::LBRACK: 2559 case Token::LBRACK:
2560 if (allow_harmony_computed_property_names_) { 2560 if (allow_harmony_computed_property_names_) {
2561 *is_computed_name = true; 2561 *is_computed_name = true;
2562 Consume(Token::LBRACK); 2562 Consume(Token::LBRACK);
2563 ExpressionT expression = 2563 ExpressionClassifier computed_name_classifier;
2564 ParseAssignmentExpression(true, classifier, CHECK_OK); 2564 ExpressionT expression = ParseAssignmentExpression(
2565 true, &computed_name_classifier, CHECK_OK);
2566 classifier->AccumulateReclassifyingAsPattern(computed_name_classifier);
2565 Expect(Token::RBRACK, CHECK_OK); 2567 Expect(Token::RBRACK, CHECK_OK);
2566 return expression; 2568 return expression;
2567 } 2569 }
2568 2570
2569 // Fall through. 2571 // Fall through.
2570 case Token::STATIC: 2572 case Token::STATIC:
2571 *is_static = true; 2573 *is_static = true;
2572 2574
2573 // Fall through. 2575 // Fall through.
2574 default: 2576 default:
(...skipping 1430 matching lines...) Expand 10 before | Expand all | Expand 10 after
4005 *ok = false; 4007 *ok = false;
4006 return; 4008 return;
4007 } 4009 }
4008 has_seen_constructor_ = true; 4010 has_seen_constructor_ = true;
4009 return; 4011 return;
4010 } 4012 }
4011 } 4013 }
4012 } } // v8::internal 4014 } } // v8::internal
4013 4015
4014 #endif // V8_PREPARSER_H 4016 #endif // V8_PREPARSER_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698