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

Side by Side Diff: pkg/compiler/lib/src/scanner/utf8_bytes_scanner.dart

Issue 1225273002: Remove flag for enabling null-aware operators. They are now on by default. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 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
« no previous file with comments | « pkg/compiler/lib/src/scanner/token.dart ('k') | pkg/compiler/lib/src/warnings.dart » ('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 (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of scanner; 5 part of scanner;
6 6
7 /** 7 /**
8 * Scanner that reads from a UTF-8 encoded list of bytes and creates tokens 8 * Scanner that reads from a UTF-8 encoded list of bytes and creates tokens
9 * that points to substrings. 9 * that points to substrings.
10 */ 10 */
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 62
63 /** 63 /**
64 * Creates a new Utf8BytesScanner. The source file is expected to be a 64 * Creates a new Utf8BytesScanner. The source file is expected to be a
65 * [Utf8BytesSourceFile] that holds a list of UTF-8 bytes. Otherwise the 65 * [Utf8BytesSourceFile] that holds a list of UTF-8 bytes. Otherwise the
66 * string text of the source file is decoded. 66 * string text of the source file is decoded.
67 * 67 *
68 * The list of UTF-8 bytes [file.slowUtf8Bytes()] is expected to return an 68 * The list of UTF-8 bytes [file.slowUtf8Bytes()] is expected to return an
69 * array whose last element is '0' to signal the end of the file. If this 69 * array whose last element is '0' to signal the end of the file. If this
70 * is not the case, the entire array is copied before scanning. 70 * is not the case, the entire array is copied before scanning.
71 */ 71 */
72 Utf8BytesScanner(SourceFile file, {bool includeComments: false, 72 Utf8BytesScanner(SourceFile file, {bool includeComments: false})
73 bool enableNullAwareOperators: false})
74 : bytes = file.slowUtf8ZeroTerminatedBytes(), 73 : bytes = file.slowUtf8ZeroTerminatedBytes(),
75 super(file, includeComments, enableNullAwareOperators) { 74 super(file, includeComments) {
76 assert(bytes.last == 0); 75 assert(bytes.last == 0);
77 // Skip a leading BOM. 76 // Skip a leading BOM.
78 if (_containsBomAt(0)) byteOffset += 3; 77 if (_containsBomAt(0)) byteOffset += 3;
79 } 78 }
80 79
81 /** 80 /**
82 * Creates a new Utf8BytesScanner from a list of UTF-8 bytes. 81 * Creates a new Utf8BytesScanner from a list of UTF-8 bytes.
83 * 82 *
84 * The last element of the list is expected to be '0' to signal the end of 83 * The last element of the list is expected to be '0' to signal the end of
85 * the file. If this is not the case, the entire array is copied before 84 * the file. If this is not the case, the entire array is copied before
86 * scanning. 85 * scanning.
87 */ 86 */
88 Utf8BytesScanner.fromBytes(List<int> zeroTerminatedBytes, 87 Utf8BytesScanner.fromBytes(List<int> zeroTerminatedBytes,
89 {bool includeComments: false, 88 {bool includeComments: false})
90 bool enableNullAwareOperators: false})
91 : this.bytes = zeroTerminatedBytes, 89 : this.bytes = zeroTerminatedBytes,
92 super(null, includeComments, enableNullAwareOperators) { 90 super(null, includeComments) {
93 assert(bytes.last == 0); 91 assert(bytes.last == 0);
94 } 92 }
95 93
96 bool _containsBomAt(int offset) { 94 bool _containsBomAt(int offset) {
97 const BOM_UTF8 = const [0xEF, 0xBB, 0xBF]; 95 const BOM_UTF8 = const [0xEF, 0xBB, 0xBF];
98 96
99 return offset + 3 < bytes.length && 97 return offset + 3 < bytes.length &&
100 bytes[offset] == BOM_UTF8[0] && 98 bytes[offset] == BOM_UTF8[0] &&
101 bytes[offset + 1] == BOM_UTF8[1] && 99 bytes[offset + 1] == BOM_UTF8[1] &&
102 bytes[offset + 2] == BOM_UTF8[2]; 100 bytes[offset + 2] == BOM_UTF8[2];
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 198
201 void appendSubstringToken(PrecedenceInfo info, int start, bool asciiOnly, 199 void appendSubstringToken(PrecedenceInfo info, int start, bool asciiOnly,
202 [int extraOffset = 0]) { 200 [int extraOffset = 0]) {
203 tail.next = new StringToken.fromUtf8Bytes( 201 tail.next = new StringToken.fromUtf8Bytes(
204 info, bytes, start, byteOffset + extraOffset, asciiOnly, tokenStart); 202 info, bytes, start, byteOffset + extraOffset, asciiOnly, tokenStart);
205 tail = tail.next; 203 tail = tail.next;
206 } 204 }
207 205
208 bool atEndOfFile() => byteOffset >= bytes.length - 1; 206 bool atEndOfFile() => byteOffset >= bytes.length - 1;
209 } 207 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/scanner/token.dart ('k') | pkg/compiler/lib/src/warnings.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698