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

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

Issue 2708893002: fasta: Cache relativizeUri(fileUri) on LibraryBuilder and ClassBuilder (or rather it's base class) (Closed)
Patch Set: addressed comments 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 | pkg/front_end/lib/src/fasta/builder/library_builder.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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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.builder; 5 library fasta.builder;
6 6
7 import '../errors.dart' show 7 import '../errors.dart' show
8 internalError; 8 internalError;
9 9
10 import '../messages.dart' show 10 import '../messages.dart' show
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 92
93 /// The values of [parent], [charOffset], and [fileUri] aren't stored. We 93 /// The values of [parent], [charOffset], and [fileUri] aren't stored. We
94 /// need to evaluate the memory impact of doing so, but want to ensure the 94 /// need to evaluate the memory impact of doing so, but want to ensure the
95 /// information is always provided. 95 /// information is always provided.
96 Builder(Builder parent, int charOffset, Uri fileUri); 96 Builder(Builder parent, int charOffset, Uri fileUri);
97 97
98 int get charOffset => -1; 98 int get charOffset => -1;
99 99
100 Uri get fileUri => null; 100 Uri get fileUri => null;
101 101
102 String get relativeFileUri {
103 throw "The relativeFileUri method should be only called on subclasses "
104 "which have an efficient implementation of `relativeFileUri`!";
105 }
106
102 /// Resolve types (lookup names in scope) recorded in this builder and return 107 /// Resolve types (lookup names in scope) recorded in this builder and return
103 /// the number of types resolved. 108 /// the number of types resolved.
104 int resolveTypes(covariant Builder parent) => 0; 109 int resolveTypes(covariant Builder parent) => 0;
105 110
106 /// Resolve constructors (lookup names in scope) recorded in this builder and 111 /// Resolve constructors (lookup names in scope) recorded in this builder and
107 /// return the number of constructors resolved. 112 /// return the number of constructors resolved.
108 int resolveConstructors(covariant Builder parent) => 0; 113 int resolveConstructors(covariant Builder parent) => 0;
109 114
110 /// This builder and [other] has been imported into [library] using [name]. 115 /// This builder and [other] has been imported into [library] using [name].
111 /// 116 ///
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 182
178 static Uri getUri(Builder builder) { 183 static Uri getUri(Builder builder) {
179 if (builder == null) return internalError("Builder is null."); 184 if (builder == null) return internalError("Builder is null.");
180 while (builder != null) { 185 while (builder != null) {
181 if (builder is LibraryBuilder) return builder.uri; 186 if (builder is LibraryBuilder) return builder.uri;
182 builder = builder.parent; 187 builder = builder.parent;
183 } 188 }
184 return internalError("No library parent."); 189 return internalError("No library parent.");
185 } 190 }
186 } 191 }
OLDNEW
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/builder/library_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698