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

Side by Side Diff: test/cctest/parsing/test-scanner.cc

Issue 2341323002: Simplify Scanner bookmarking. (Closed)
Patch Set: feedback, rebase, plus fix bug Created 4 years, 3 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 | « src/parsing/scanner.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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 // Tests v8::internal::Scanner. Note that presently most unit tests for the 5 // Tests v8::internal::Scanner. Note that presently most unit tests for the
6 // Scanner are in cctest/test-parsing.cc, rather than here. 6 // Scanner are in cctest/test-parsing.cc, rather than here.
7 7
8 #include "src/handles-inl.h" 8 #include "src/handles-inl.h"
9 #include "src/parsing/scanner-character-streams.h" 9 #include "src/parsing/scanner-character-streams.h"
10 #include "src/parsing/scanner.h" 10 #include "src/parsing/scanner.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 auto scanner = make_scanner(src_simple); 49 auto scanner = make_scanner(src_simple);
50 Scanner::BookmarkScope bookmark(scanner.get()); 50 Scanner::BookmarkScope bookmark(scanner.get());
51 51
52 for (size_t i = 0; i < std::min(bookmark_pos + 10, tokens.size()); i++) { 52 for (size_t i = 0; i < std::min(bookmark_pos + 10, tokens.size()); i++) {
53 if (i == bookmark_pos) { 53 if (i == bookmark_pos) {
54 bookmark.Set(); 54 bookmark.Set();
55 } 55 }
56 DCHECK_EQ(tokens[i], scanner->Next()); 56 DCHECK_EQ(tokens[i], scanner->Next());
57 } 57 }
58 58
59 bookmark.Reset(); 59 bookmark.Apply();
60 for (size_t i = bookmark_pos; i < tokens.size(); i++) { 60 for (size_t i = bookmark_pos; i < tokens.size(); i++) {
61 DCHECK_EQ(tokens[i], scanner->Next()); 61 DCHECK_EQ(tokens[i], scanner->Next());
62 } 62 }
63 } 63 }
64 } 64 }
OLDNEW
« no previous file with comments | « src/parsing/scanner.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698