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

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

Issue 2695453002: Generalize DeclarationBuilder.resolveTypes. (Closed)
Patch Set: 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/dynamic_type_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.class_builder; 5 library fasta.class_builder;
6 6
7 import 'builder.dart' show 7 import 'builder.dart' show
8 Builder, 8 Builder,
9 ConstructorReferenceBuilder, 9 ConstructorReferenceBuilder,
10 LibraryBuilder, 10 LibraryBuilder,
(...skipping 12 matching lines...) Expand all
23 23
24 T supertype; 24 T supertype;
25 25
26 List<T> interfaces; 26 List<T> interfaces;
27 27
28 final Map<String, Builder> members; 28 final Map<String, Builder> members;
29 29
30 ClassBuilder( 30 ClassBuilder(
31 List<MetadataBuilder> metadata, int modifiers, 31 List<MetadataBuilder> metadata, int modifiers,
32 String name, this.typeVariables, this.supertype, this.interfaces, 32 String name, this.typeVariables, this.supertype, this.interfaces,
33 this.members, List<T> types, LibraryBuilder parent, int charOffset) 33 this.members, LibraryBuilder parent, int charOffset)
34 : super(metadata, modifiers, name, types, parent, charOffset); 34 : super(metadata, modifiers, name, parent, charOffset);
35 35
36 List<ConstructorReferenceBuilder> get constructorReferences => null; 36 List<ConstructorReferenceBuilder> get constructorReferences => null;
37 37
38 Map<String, Builder> get constructors; 38 Map<String, Builder> get constructors;
39 39
40 Map<String, Builder> get membersInScope => members; 40 Map<String, Builder> get membersInScope => members;
41 41
42 int resolveTypes(LibraryBuilder library) {
43 Scope scope;
44 int count = 0;
45 if (types != null) {
46 scope = computeInstanceScope(library.scope);
47 for (T t in types) {
48 t.resolveIn(scope);
49 }
50 count += types.length;
51 }
52 return count;
53 }
54
55 int resolveConstructors(LibraryBuilder library) { 42 int resolveConstructors(LibraryBuilder library) {
56 if (constructorReferences == null) return 0; 43 if (constructorReferences == null) return 0;
57 Scope scope = computeInstanceScope(library.scope); 44 Scope scope = computeInstanceScope(library.scope);
58 for (ConstructorReferenceBuilder ref in constructorReferences) { 45 for (ConstructorReferenceBuilder ref in constructorReferences) {
59 ref.resolveIn(scope); 46 ref.resolveIn(scope);
60 } 47 }
61 return constructorReferences.length; 48 return constructorReferences.length;
62 } 49 }
63 50
64 Scope computeInstanceScope(Scope parent) { 51 Scope computeInstanceScope(Scope parent) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 return null; 83 return null;
97 } else if (isSetter && builder.isGetter) { 84 } else if (isSetter && builder.isGetter) {
98 return null; 85 return null;
99 } else { 86 } else {
100 return builder.isInstanceMember ? null : builder; 87 return builder.isInstanceMember ? null : builder;
101 } 88 }
102 } 89 }
103 90
104 Builder findConstructorOrFactory(String name); 91 Builder findConstructorOrFactory(String name);
105 } 92 }
OLDNEW
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/builder/dynamic_type_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698