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

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: Reorder import 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)
53 : this._internal(fileUri, relativizeUri(fileUri));
54
55 LibraryBuilder._internal(this.fileUri, this.relativeFileUri)
ahe 2017/02/21 14:15:22 How about just having one constructor: LibraryBui
kustermann 2017/02/22 14:40:28 Done
49 : super(null, -1, fileUri); 56 : super(null, -1, fileUri);
50 57
51 Builder addBuilder(String name, Builder builder, int charOffset); 58 Builder addBuilder(String name, Builder builder, int charOffset);
52 59
53 void addExporter(LibraryBuilder exporter, List<Combinator> combinators, 60 void addExporter(LibraryBuilder exporter, List<Combinator> combinators,
54 int charOffset) { 61 int charOffset) {
55 exporters.add(new Export(exporter, this, combinators, charOffset)); 62 exporters.add(new Export(exporter, this, combinators, charOffset));
56 } 63 }
57 64
58 void addCompileTimeError(int charOffset, Object message, [Uri fileUri]) { 65 void addCompileTimeError(int charOffset, Object message, [Uri fileUri]) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 } else if (constructor.isFactory) { 103 } else if (constructor.isFactory) {
97 return constructor; 104 return constructor;
98 } 105 }
99 } 106 }
100 throw internalError("Internal error: No constructor named" 107 throw internalError("Internal error: No constructor named"
101 " '$className::$constructorName' in '$uri'."); 108 " '$className::$constructorName' in '$uri'.");
102 } 109 }
103 110
104 int finishTypeVariables(ClassBuilder object) => 0; 111 int finishTypeVariables(ClassBuilder object) => 0;
105 } 112 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698