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

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

Issue 2788913002: Prepare for separate setter scope. (Closed)
Patch Set: Address comments. Created 3 years, 8 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.dill_class_builder; 5 library fasta.dill_class_builder;
6 6
7 import 'package:kernel/ast.dart' 7 import 'package:kernel/ast.dart'
8 show Class, Constructor, Member, Procedure, ProcedureKind; 8 show Class, Constructor, Member, Procedure, ProcedureKind;
9 9
10 import '../errors.dart' show internalError; 10 import '../errors.dart' show internalError;
11 11
12 import '../kernel/kernel_builder.dart' 12 import '../kernel/kernel_builder.dart'
13 show Builder, KernelClassBuilder, KernelTypeBuilder; 13 show Builder, KernelClassBuilder, KernelTypeBuilder;
14 14
15 import '../modifier.dart' show abstractMask; 15 import '../modifier.dart' show abstractMask;
16 16
17 import 'dill_member_builder.dart' show DillMemberBuilder; 17 import 'dill_member_builder.dart' show DillMemberBuilder;
18 18
19 import 'dill_library_builder.dart' show DillLibraryBuilder; 19 import 'dill_library_builder.dart' show DillLibraryBuilder;
20 20
21 class DillClassBuilder extends KernelClassBuilder { 21 class DillClassBuilder extends KernelClassBuilder {
22 final Class cls; 22 final Class cls;
23 23
24 @override
24 final Map<String, Builder> constructors = <String, Builder>{}; 25 final Map<String, Builder> constructors = <String, Builder>{};
25 26
26 DillClassBuilder(Class cls, DillLibraryBuilder parent) 27 DillClassBuilder(Class cls, DillLibraryBuilder parent)
27 : cls = cls, 28 : cls = cls,
28 super(null, computeModifiers(cls), cls.name, null, null, null, 29 super(null, computeModifiers(cls), cls.name, null, null, null,
29 <String, Builder>{}, parent, cls.fileOffset); 30 <String, Builder>{}, parent, cls.fileOffset);
30 31
31 void addMember(Member member) { 32 void addMember(Member member) {
32 DillMemberBuilder builder = new DillMemberBuilder(member, this); 33 DillMemberBuilder builder = new DillMemberBuilder(member, this);
33 String name = member.name.name; 34 String name = member.name.name;
34 if (member is Constructor || 35 if (member is Constructor ||
35 (member is Procedure && member.kind == ProcedureKind.Factory)) { 36 (member is Procedure && member.kind == ProcedureKind.Factory)) {
36 constructors[name] = builder; 37 constructors[name] = builder;
37 } else { 38 } else {
38 DillMemberBuilder existing = members[name]; 39 DillMemberBuilder existing = members[name];
39 if (existing == null) { 40 if (existing == null) {
40 members[name] = builder; 41 members[name] = builder;
41 } else { 42 } else {
42 existing.next = builder; 43 existing.next = builder;
43 } 44 }
44 } 45 }
45 } 46 }
46 47
47 /// Returns true if this class is the result of applying a mixin to its 48 /// Returns true if this class is the result of applying a mixin to its
48 /// superclass. 49 /// superclass.
49 bool get isMixinApplication => cls.isMixinApplication; 50 bool get isMixinApplication => cls.isMixinApplication;
50 51
51 KernelTypeBuilder get mixedInType => internalError("Not implemented."); 52 KernelTypeBuilder get mixedInType => internalError("Not implemented.");
52
53 Builder findConstructorOrFactory(String name) => constructors[name];
54 } 53 }
55 54
56 int computeModifiers(Class cls) { 55 int computeModifiers(Class cls) {
57 return cls.isAbstract ? abstractMask : 0; 56 return cls.isAbstract ? abstractMask : 0;
58 } 57 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/builder/procedure_builder.dart ('k') | pkg/front_end/lib/src/fasta/dill/dill_target.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698