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

Side by Side Diff: pkg/front_end/lib/src/fasta/builder/library_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
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.library_builder; 5 library fasta.library_builder;
6 6
7 import '../combinator.dart' show 7 import '../combinator.dart' show
8 Combinator; 8 Combinator;
9 9
10 import '../errors.dart' show 10 import '../errors.dart' show
11 InputError, 11 InputError,
12 internalError; 12 internalError;
13 13
14 import '../export.dart' show 14 import '../export.dart' show
15 Export; 15 Export;
16 16
17 import '../loader.dart' show 17 import '../loader.dart' show
18 Loader; 18 Loader;
19 19
20 import '../util/relativize.dart' show
21 relativizeUri;
22
20 import 'builder.dart' show 23 import 'builder.dart' show
21 Builder, 24 Builder,
22 ClassBuilder, 25 ClassBuilder,
23 TypeBuilder; 26 TypeBuilder;
24 27
25 import 'scope.dart' show 28 import 'scope.dart' show
26 Scope; 29 Scope;
27 30
28 abstract class LibraryBuilder<T extends TypeBuilder, R> extends Builder { 31 abstract class LibraryBuilder<T extends TypeBuilder, R> extends Builder {
29 final List<Export> exporters = <Export>[]; 32 final List<Export> exporters = <Export>[];
30 33
31 final List<InputError> compileTimeErrors = <InputError>[]; 34 final List<InputError> compileTimeErrors = <InputError>[];
32 35
33 LibraryBuilder partOfLibrary; 36 LibraryBuilder partOfLibrary;
34 37
35 Loader get loader; 38 Loader get loader;
36 39
37 Uri get uri; 40 Uri get uri;
38 41
39 Uri get fileUri; 42 final Uri fileUri;
43 final String relativeFileUri;
40 44
41 Map<String, Builder> get members; 45 Map<String, Builder> get members;
42 46
43 // TODO(ahe): Move this to SourceLibraryBuilder. 47 // TODO(ahe): Move this to SourceLibraryBuilder.
44 Scope get scope; 48 Scope get scope;
45 49
46 Map<String, Builder> get exports; 50 Map<String, Builder> get exports;
47 51
48 LibraryBuilder(Uri fileUri) 52 LibraryBuilder(Uri fileUri)
49 : super(null, -1, fileUri); 53 : fileUri = fileUri,
54 relativeFileUri = relativizeUri(fileUri),
55 super(null, -1, fileUri);
50 56
51 Builder addBuilder(String name, Builder builder, int charOffset); 57 Builder addBuilder(String name, Builder builder, int charOffset);
52 58
53 void addExporter(LibraryBuilder exporter, List<Combinator> combinators, 59 void addExporter(LibraryBuilder exporter, List<Combinator> combinators,
54 int charOffset) { 60 int charOffset) {
55 exporters.add(new Export(exporter, this, combinators, charOffset)); 61 exporters.add(new Export(exporter, this, combinators, charOffset));
56 } 62 }
57 63
58 void addCompileTimeError(int charOffset, Object message, [Uri fileUri]) { 64 void addCompileTimeError(int charOffset, Object message, [Uri fileUri]) {
59 fileUri ??= this.fileUri; 65 fileUri ??= this.fileUri;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 } else if (constructor.isFactory) { 102 } else if (constructor.isFactory) {
97 return constructor; 103 return constructor;
98 } 104 }
99 } 105 }
100 throw internalError("Internal error: No constructor named" 106 throw internalError("Internal error: No constructor named"
101 " '$className::$constructorName' in '$uri'."); 107 " '$className::$constructorName' in '$uri'.");
102 } 108 }
103 109
104 int finishTypeVariables(ClassBuilder object) => 0; 110 int finishTypeVariables(ClassBuilder object) => 0;
105 } 111 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/builder/builder.dart ('k') | pkg/front_end/lib/src/fasta/builder/type_declaration_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698