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

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

Issue 2123953002: [parser] Fix bug in destructuring binding for catch. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 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 #include "src/parsing/parser.h" 5 #include "src/parsing/parser.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/ast/ast.h" 8 #include "src/ast/ast.h"
9 #include "src/ast/ast-expression-rewriter.h" 9 #include "src/ast/ast-expression-rewriter.h"
10 #include "src/ast/ast-expression-visitor.h" 10 #include "src/ast/ast-expression-visitor.h"
(...skipping 2999 matching lines...) Expand 10 before | Expand all | Expand 10 after
3010 if (!is_simple) { 3010 if (!is_simple) {
3011 DeclarationDescriptor descriptor; 3011 DeclarationDescriptor descriptor;
3012 descriptor.declaration_kind = DeclarationDescriptor::NORMAL; 3012 descriptor.declaration_kind = DeclarationDescriptor::NORMAL;
3013 descriptor.parser = this; 3013 descriptor.parser = this;
3014 descriptor.scope = scope_; 3014 descriptor.scope = scope_;
3015 descriptor.hoist_scope = nullptr; 3015 descriptor.hoist_scope = nullptr;
3016 descriptor.mode = LET; 3016 descriptor.mode = LET;
3017 descriptor.declaration_pos = pattern->position(); 3017 descriptor.declaration_pos = pattern->position();
3018 descriptor.initialization_pos = pattern->position(); 3018 descriptor.initialization_pos = pattern->position();
3019 3019
3020 // Initializer position for variables declared by the pattern.
3021 const int initializer_position = position();
3022
3020 DeclarationParsingResult::Declaration decl( 3023 DeclarationParsingResult::Declaration decl(
3021 pattern, pattern->position(), 3024 pattern, initializer_position,
3022 factory()->NewVariableProxy(catch_variable)); 3025 factory()->NewVariableProxy(catch_variable));
3023 3026
3024 Block* init_block = 3027 Block* init_block =
3025 factory()->NewBlock(nullptr, 8, true, kNoSourcePosition); 3028 factory()->NewBlock(nullptr, 8, true, kNoSourcePosition);
3026 PatternRewriter::DeclareAndInitializeVariables( 3029 PatternRewriter::DeclareAndInitializeVariables(
3027 init_block, &descriptor, &decl, nullptr, CHECK_OK); 3030 init_block, &descriptor, &decl, nullptr, CHECK_OK);
3028 catch_block->statements()->Add(init_block, zone()); 3031 catch_block->statements()->Add(init_block, zone());
3029 } 3032 }
3030 3033
3031 // TODO(adamk): This should call ParseBlock in order to properly 3034 // TODO(adamk): This should call ParseBlock in order to properly
(...skipping 3965 matching lines...) Expand 10 before | Expand all | Expand 10 after
6997 try_block, target); 7000 try_block, target);
6998 final_loop = target; 7001 final_loop = target;
6999 } 7002 }
7000 7003
7001 return final_loop; 7004 return final_loop;
7002 } 7005 }
7003 7006
7004 7007
7005 } // namespace internal 7008 } // namespace internal
7006 } // namespace v8 7009 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698