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

Side by Side Diff: pkg/front_end/lib/src/base/file_repository.dart

Issue 2841543002: Spelling a (Closed)
Patch Set: Created 3 years, 8 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
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 /// Data structure storing an association between URI and file contents. 5 /// Data structure storing an association between URI and file contents.
6 /// 6 ///
7 /// Each URI is also associated with a unique arbitrary path ending in ".dart". 7 /// Each URI is also associated with a unique arbitrary path ending in ".dart".
8 /// This allows interfacing with analyzer code that expects to manipulate paths 8 /// This allows interfacing with analyzer code that expects to manipulate paths
9 /// rather than URIs. 9 /// rather than URIs.
10 class FileRepository { 10 class FileRepository {
(...skipping 14 matching lines...) Expand all
25 /// URI and arbitrary path is preserved. 25 /// URI and arbitrary path is preserved.
26 /// 26 ///
27 /// Subsequent calls to [contentsForPath] will have undefined results until 27 /// Subsequent calls to [contentsForPath] will have undefined results until
28 /// new contents are stored using [store]. 28 /// new contents are stored using [store].
29 void clearContents() { 29 void clearContents() {
30 for (var i = 0; i < _contents.length; i++) { 30 for (var i = 0; i < _contents.length; i++) {
31 _contents[i] = null; 31 _contents[i] = null;
32 } 32 }
33 } 33 }
34 34
35 /// Return the contents of the file whose arbitary path is [path]. 35 /// Return the contents of the file whose arbitrary path is [path].
36 /// 36 ///
37 /// The path must have been returned by a previous call to [store] or 37 /// The path must have been returned by a previous call to [store] or
38 /// [pathForUri]. 38 /// [pathForUri].
39 String contentsForPath(String path) { 39 String contentsForPath(String path) {
40 var contents = _contents[_indexForPath(path)]; 40 var contents = _contents[_indexForPath(path)];
41 assert(contents != null); 41 assert(contents != null);
42 return contents; 42 return contents;
43 } 43 }
44 44
45 /// For testing purposes, return the contents of all files stored in the file 45 /// For testing purposes, return the contents of all files stored in the file
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 _uris.add(uri); 91 _uris.add(uri);
92 _uriToIndexMap[uri] = index; 92 _uriToIndexMap[uri] = index;
93 _contents.add(null); 93 _contents.add(null);
94 } 94 }
95 return index; 95 return index;
96 } 96 }
97 97
98 /// Return the arbitrary path associated with the given index. 98 /// Return the arbitrary path associated with the given index.
99 String _pathForIndex(int index) => '/$index.dart'; 99 String _pathForIndex(int index) => '/$index.dart';
100 } 100 }
OLDNEW
« no previous file with comments | « pkg/dev_compiler/tool/input_sdk/private/js_array.dart ('k') | pkg/front_end/lib/src/fasta/kernel/body_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698