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

Side by Side Diff: src/parser.cc

Issue 748113003: harmony-scoping: Catch variable should be VAR, not LET (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years 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 | test/mjsunit/harmony/block-conflicts.js » ('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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/ast.h" 8 #include "src/ast.h"
9 #include "src/bailout-reason.h" 9 #include "src/bailout-reason.h"
10 #include "src/base/platform/platform.h" 10 #include "src/base/platform/platform.h"
(...skipping 2778 matching lines...) Expand 10 before | Expand all | Expand 10 after
2789 Consume(Token::CATCH); 2789 Consume(Token::CATCH);
2790 2790
2791 Expect(Token::LPAREN, CHECK_OK); 2791 Expect(Token::LPAREN, CHECK_OK);
2792 catch_scope = NewScope(scope_, CATCH_SCOPE); 2792 catch_scope = NewScope(scope_, CATCH_SCOPE);
2793 catch_scope->set_start_position(scanner()->location().beg_pos); 2793 catch_scope->set_start_position(scanner()->location().beg_pos);
2794 name = ParseIdentifier(kDontAllowEvalOrArguments, CHECK_OK); 2794 name = ParseIdentifier(kDontAllowEvalOrArguments, CHECK_OK);
2795 2795
2796 Expect(Token::RPAREN, CHECK_OK); 2796 Expect(Token::RPAREN, CHECK_OK);
2797 2797
2798 Target target(&this->target_stack_, &catch_collector); 2798 Target target(&this->target_stack_, &catch_collector);
2799 VariableMode mode = 2799 catch_variable = catch_scope->DeclareLocal(name, VAR, kCreatedInitialized);
2800 allow_harmony_scoping() && strict_mode() == STRICT ? LET : VAR;
2801 catch_variable = catch_scope->DeclareLocal(name, mode, kCreatedInitialized);
2802 BlockState block_state(&scope_, catch_scope); 2800 BlockState block_state(&scope_, catch_scope);
2803 catch_block = ParseBlock(NULL, CHECK_OK); 2801 catch_block = ParseBlock(NULL, CHECK_OK);
2804 2802
2805 catch_scope->set_end_position(scanner()->location().end_pos); 2803 catch_scope->set_end_position(scanner()->location().end_pos);
2806 tok = peek(); 2804 tok = peek();
2807 } 2805 }
2808 2806
2809 Block* finally_block = NULL; 2807 Block* finally_block = NULL;
2810 DCHECK(tok == Token::FINALLY || catch_block != NULL); 2808 DCHECK(tok == Token::FINALLY || catch_block != NULL);
2811 if (tok == Token::FINALLY) { 2809 if (tok == Token::FINALLY) {
(...skipping 2532 matching lines...) Expand 10 before | Expand all | Expand 10 after
5344 5342
5345 hash_string.Truncate(num_hash_chars); 5343 hash_string.Truncate(num_hash_chars);
5346 int utf16_length; 5344 int utf16_length;
5347 *hash = StringHasher::ComputeUtf8Hash(Vector<const char>::cast(hash_string), 5345 *hash = StringHasher::ComputeUtf8Hash(Vector<const char>::cast(hash_string),
5348 num_hash_chars, &utf16_length); 5346 num_hash_chars, &utf16_length);
5349 hash_string.Dispose(); 5347 hash_string.Dispose();
5350 5348
5351 return raw_strings; 5349 return raw_strings;
5352 } 5350 }
5353 } } // namespace v8::internal 5351 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/harmony/block-conflicts.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698