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

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

Issue 2880213002: Reduce use of relativize and unsort methods. (Closed)
Patch Set: Fix warning and ensure only one AST node is created. Created 3 years, 7 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.source_class_builder; 5 library fasta.source_class_builder;
6 6
7 import 'package:front_end/src/fasta/builder/class_builder.dart' 7 import 'package:front_end/src/fasta/builder/class_builder.dart'
8 show ClassBuilder; 8 show ClassBuilder;
9 9
10 import 'package:front_end/src/fasta/source/source_library_builder.dart' 10 import 'package:front_end/src/fasta/source/source_library_builder.dart'
(...skipping 15 matching lines...) Expand all
26 KernelTypeBuilder, 26 KernelTypeBuilder,
27 KernelTypeVariableBuilder, 27 KernelTypeVariableBuilder,
28 LibraryBuilder, 28 LibraryBuilder,
29 MetadataBuilder, 29 MetadataBuilder,
30 Scope, 30 Scope,
31 TypeVariableBuilder, 31 TypeVariableBuilder,
32 compareProcedures; 32 compareProcedures;
33 33
34 import '../dill/dill_member_builder.dart' show DillMemberBuilder; 34 import '../dill/dill_member_builder.dart' show DillMemberBuilder;
35 35
36 import '../util/relativize.dart' show relativizeUri;
37
38 Class initializeClass( 36 Class initializeClass(
39 Class cls, String name, LibraryBuilder parent, int charOffset) { 37 Class cls, String name, KernelLibraryBuilder parent, int charOffset) {
40 cls ??= new Class(name: name); 38 cls ??= new Class(name: name);
41 cls.fileUri ??= relativizeUri(parent.fileUri); 39 cls.fileUri ??= parent.library.fileUri;
42 if (cls.fileOffset == TreeNode.noOffset) { 40 if (cls.fileOffset == TreeNode.noOffset) {
43 cls.fileOffset = charOffset; 41 cls.fileOffset = charOffset;
44 } 42 }
45 return cls; 43 return cls;
46 } 44 }
47 45
48 class SourceClassBuilder extends KernelClassBuilder { 46 class SourceClassBuilder extends KernelClassBuilder {
49 final Class cls; 47 final Class cls;
50 48
51 final List<ConstructorReferenceBuilder> constructorReferences; 49 final List<ConstructorReferenceBuilder> constructorReferences;
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 } 153 }
156 154
157 @override 155 @override
158 void prepareInitializerInference( 156 void prepareInitializerInference(
159 SourceLibraryBuilder library, ClassBuilder currentClass) { 157 SourceLibraryBuilder library, ClassBuilder currentClass) {
160 scope.forEach((name, builder) { 158 scope.forEach((name, builder) {
161 builder.prepareInitializerInference(library, this); 159 builder.prepareInitializerInference(library, this);
162 }); 160 });
163 } 161 }
164 } 162 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698