OLD | NEW |
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.kernel_library_builder; | 5 library fasta.kernel_library_builder; |
6 | 6 |
7 import 'package:kernel/ast.dart'; | 7 import 'package:kernel/ast.dart'; |
8 | 8 |
9 import 'package:kernel/clone.dart' show CloneVisitor; | 9 import 'package:kernel/clone.dart' show CloneVisitor; |
10 | 10 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 } | 94 } |
95 | 95 |
96 void addClass( | 96 void addClass( |
97 List<MetadataBuilder> metadata, | 97 List<MetadataBuilder> metadata, |
98 int modifiers, | 98 int modifiers, |
99 String className, | 99 String className, |
100 List<TypeVariableBuilder> typeVariables, | 100 List<TypeVariableBuilder> typeVariables, |
101 KernelTypeBuilder supertype, | 101 KernelTypeBuilder supertype, |
102 List<KernelTypeBuilder> interfaces, | 102 List<KernelTypeBuilder> interfaces, |
103 int charOffset) { | 103 int charOffset) { |
| 104 assert(currentDeclaration.parent == libraryDeclaration); |
| 105 Map<String, MemberBuilder> members = currentDeclaration.members; |
104 ClassBuilder cls = new SourceClassBuilder( | 106 ClassBuilder cls = new SourceClassBuilder( |
105 metadata, | 107 metadata, |
106 modifiers, | 108 modifiers, |
107 className, | 109 className, |
108 typeVariables, | 110 typeVariables, |
109 supertype, | 111 supertype, |
110 interfaces, | 112 interfaces, |
111 classMembers, | 113 members, |
112 this, | 114 this, |
113 new List<ConstructorReferenceBuilder>.from(constructorReferences), | 115 new List<ConstructorReferenceBuilder>.from(constructorReferences), |
114 charOffset); | 116 charOffset); |
115 constructorReferences.clear(); | 117 constructorReferences.clear(); |
116 classMembers.forEach((String name, MemberBuilder builder) { | 118 members.forEach((String name, MemberBuilder builder) { |
117 while (builder != null) { | 119 while (builder != null) { |
118 builder.parent = cls; | 120 builder.parent = cls; |
119 builder = builder.next; | 121 builder = builder.next; |
120 } | 122 } |
121 }); | 123 }); |
122 // Nested declaration began in `OutlineBuilder.beginClassDeclaration`. | 124 // Nested declaration began in `OutlineBuilder.beginClassDeclaration`. |
123 endNestedDeclaration().resolveTypes(typeVariables, this); | 125 endNestedDeclaration().resolveTypes(typeVariables, this); |
124 addBuilder(className, cls, charOffset); | 126 addBuilder(className, cls, charOffset); |
125 } | 127 } |
126 | 128 |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 } | 516 } |
515 } | 517 } |
516 | 518 |
517 bool isConstructorName(String name, String className) { | 519 bool isConstructorName(String name, String className) { |
518 if (name.startsWith(className)) { | 520 if (name.startsWith(className)) { |
519 if (name.length == className.length) return true; | 521 if (name.length == className.length) return true; |
520 if (name.startsWith(".", className.length)) return true; | 522 if (name.startsWith(".", className.length)) return true; |
521 } | 523 } |
522 return false; | 524 return false; |
523 } | 525 } |
OLD | NEW |