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

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

Issue 1817353007: Fix "use types" directive in modules (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@types
Patch Set: Created 4 years, 9 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 | test/cctest/test-parsing.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 #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 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after
1349 literal->raw_value()->IsString()) { 1349 literal->raw_value()->IsString()) {
1350 // Ignore "use strict" directive in a module, check "use asm". 1350 // Ignore "use strict" directive in a module, check "use asm".
1351 if (literal->raw_value()->AsString() == 1351 if (literal->raw_value()->AsString() ==
1352 ast_value_factory()->use_asm_string() && 1352 ast_value_factory()->use_asm_string() &&
1353 token_loc.end_pos - token_loc.beg_pos == 1353 token_loc.end_pos - token_loc.beg_pos ==
1354 ast_value_factory()->use_asm_string()->length() + 2) { 1354 ast_value_factory()->use_asm_string()->length() + 2) {
1355 // Store the usage count; The actual use counter on the isolate is 1355 // Store the usage count; The actual use counter on the isolate is
1356 // incremented after parsing is done. 1356 // incremented after parsing is done.
1357 ++use_counts_[v8::Isolate::kUseAsm]; 1357 ++use_counts_[v8::Isolate::kUseAsm];
1358 scope_->SetAsmModule(); 1358 scope_->SetAsmModule();
1359 // Check "use types".
1360 } else if (allow_harmony_types() &&
1361 literal->raw_value()->AsString() ==
1362 ast_value_factory()->use_types_string() &&
1363 token_loc.end_pos - token_loc.beg_pos ==
1364 ast_value_factory()->use_types_string()->length() + 2) {
1365 scope_->SetTyped();
1359 } 1366 }
1360 } else { 1367 } else {
1361 // End of the directive prologue. 1368 // End of the directive prologue.
1362 directive_prologue = false; 1369 directive_prologue = false;
1363 } 1370 }
1364 } 1371 }
1365 1372
1366 body->Add(stat, zone()); 1373 body->Add(stat, zone());
1367 } 1374 }
1368 1375
(...skipping 5571 matching lines...) Expand 10 before | Expand all | Expand 10 after
6940 try_block, target); 6947 try_block, target);
6941 final_loop = target; 6948 final_loop = target;
6942 } 6949 }
6943 6950
6944 return final_loop; 6951 return final_loop;
6945 } 6952 }
6946 6953
6947 6954
6948 } // namespace internal 6955 } // namespace internal
6949 } // namespace v8 6956 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698