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

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

Issue 1657783002: Gracefully handle syntax errors in Parser::PatternRewriter. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Unit test. Created 4 years, 10 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 | « no previous file | src/parsing/pattern-rewriter.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 #ifndef V8_PARSING_PARSER_H_ 5 #ifndef V8_PARSING_PARSER_H_
6 #define V8_PARSING_PARSER_H_ 6 #define V8_PARSING_PARSER_H_
7 7
8 #include "src/allocation.h" 8 #include "src/allocation.h"
9 #include "src/ast/ast.h" 9 #include "src/ast/ast.h"
10 #include "src/ast/scopes.h" 10 #include "src/ast/scopes.h"
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 BINDING, 825 BINDING,
826 INITIALIZER, 826 INITIALIZER,
827 ASSIGNMENT, 827 ASSIGNMENT,
828 ASSIGNMENT_INITIALIZER 828 ASSIGNMENT_INITIALIZER
829 }; 829 };
830 830
831 PatternContext context() const { return context_; } 831 PatternContext context() const { return context_; }
832 void set_context(PatternContext context) { context_ = context; } 832 void set_context(PatternContext context) { context_ = context; }
833 833
834 void RecurseIntoSubpattern(AstNode* pattern, Expression* value) { 834 void RecurseIntoSubpattern(AstNode* pattern, Expression* value) {
835 if (!*ok_) return;
836
835 Expression* old_value = current_value_; 837 Expression* old_value = current_value_;
836 current_value_ = value; 838 current_value_ = value;
837 recursion_level_++; 839 recursion_level_++;
838 pattern->Accept(this); 840 pattern->Accept(this);
839 recursion_level_--; 841 recursion_level_--;
840 current_value_ = old_value; 842 current_value_ = old_value;
841 } 843 }
842 844
843 void VisitObjectLiteral(ObjectLiteral* node, Variable** temp_var); 845 void VisitObjectLiteral(ObjectLiteral* node, Variable** temp_var);
844 void VisitArrayLiteral(ArrayLiteral* node, Variable** temp_var); 846 void VisitArrayLiteral(ArrayLiteral* node, Variable** temp_var);
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
1213 1215
1214 DoExpression* ParserTraits::ParseDoExpression(bool* ok) { 1216 DoExpression* ParserTraits::ParseDoExpression(bool* ok) {
1215 return parser_->ParseDoExpression(ok); 1217 return parser_->ParseDoExpression(ok);
1216 } 1218 }
1217 1219
1218 1220
1219 } // namespace internal 1221 } // namespace internal
1220 } // namespace v8 1222 } // namespace v8
1221 1223
1222 #endif // V8_PARSING_PARSER_H_ 1224 #endif // V8_PARSING_PARSER_H_
OLDNEW
« no previous file with comments | « no previous file | src/parsing/pattern-rewriter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698