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

Side by Side Diff: pkg/front_end/lib/src/fasta/scanner/canonicalizer.dart

Issue 2694013004: Fix analyzer warnings in StringCanonicalizer (Closed)
Patch Set: Created 3 years, 10 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 | 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 (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 library fasta.scanner.abstract_scanner; 5 library fasta.scanner.abstract_scanner;
6 6
7 import 'dart:convert'; 7 import 'dart:convert';
8 8
9 class Node { 9 class Node {
10 var /* String | List<int> */ data; 10 var /* String | List<int> */ data;
(...skipping 16 matching lines...) Expand all
27 /// Mask away top bits to keep hash calculation within 32-bit SMI range. 27 /// Mask away top bits to keep hash calculation within 32-bit SMI range.
28 static const int MASK = 16 * 1024 * 1024 - 1; 28 static const int MASK = 16 * 1024 * 1024 - 1;
29 29
30 static const int INITIAL_SIZE = 8 * 1024; 30 static const int INITIAL_SIZE = 8 * 1024;
31 31
32 /// Linear size of a hash table. 32 /// Linear size of a hash table.
33 int _size = INITIAL_SIZE; 33 int _size = INITIAL_SIZE;
34 /// Items in a hash table. 34 /// Items in a hash table.
35 int _count = 0; 35 int _count = 0;
36 /// The table itself. 36 /// The table itself.
37 Node _nodes = new List<Node>(INITIAL_SIZE); 37 List<Node> _nodes = new List<Node>(INITIAL_SIZE);
38 38
39 static String decode(List<int> data, int start, int end, bool asciiOnly) { 39 static String decode(List<int> data, int start, int end, bool asciiOnly) {
40 var s; 40 var s;
41 if (asciiOnly) { 41 if (asciiOnly) {
42 s = new String.fromCharCodes(data, start, end); 42 s = new String.fromCharCodes(data, start, end);
43 } else { 43 } else {
44 s = new Utf8Decoder(allowMalformed: true).convert(data, start, end); 44 s = new Utf8Decoder(allowMalformed: true).convert(data, start, end);
45 } 45 }
46 return s; 46 return s;
47 } 47 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 payload = decode(data, start, end, asciiOnly); 109 payload = decode(data, start, end, asciiOnly);
110 _nodes[index] = new Node(data, start, end, payload, s); 110 _nodes[index] = new Node(data, start, end, payload, s);
111 _count++; 111 _count++;
112 return payload; 112 return payload;
113 } 113 }
114 114
115 clear() { 115 clear() {
116 _nodes = new List<Node>(_size); 116 _nodes = new List<Node>(_size);
117 } 117 }
118 } 118 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698