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.source_class_builder; | 5 library fasta.source_class_builder; |
6 | 6 |
7 import 'package:kernel/ast.dart' show | 7 import 'package:kernel/ast.dart' show |
8 Class, | 8 Class, |
9 Constructor, | 9 Constructor, |
10 Supertype, | 10 Supertype, |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 // TODO(ahe): Report an error if supertype is null. | 93 // TODO(ahe): Report an error if supertype is null. |
94 cls.implementedTypes.add(supertype); | 94 cls.implementedTypes.add(supertype); |
95 } | 95 } |
96 } | 96 } |
97 } | 97 } |
98 return cls; | 98 return cls; |
99 } | 99 } |
100 | 100 |
101 int convertConstructors(KernelLibraryBuilder library) { | 101 int convertConstructors(KernelLibraryBuilder library) { |
102 List<String> oldConstructorNames = <String>[]; | 102 List<String> oldConstructorNames = <String>[]; |
103 members.forEach((String name, MemberBuilder builder) { | 103 // TODO(sigmund): should be `covariant MemberBuilder` |
| 104 members.forEach((String name, dynamic b) { |
| 105 MemberBuilder builder = b; |
104 if (isConstructorName(name, this.name)) { | 106 if (isConstructorName(name, this.name)) { |
105 oldConstructorNames.add(name); | 107 oldConstructorNames.add(name); |
106 String newName = ""; | 108 String newName = ""; |
107 int index = name.indexOf("."); | 109 int index = name.indexOf("."); |
108 if (index != -1) { | 110 if (index != -1) { |
109 newName = name.substring(index + 1); | 111 newName = name.substring(index + 1); |
110 } | 112 } |
111 if (builder is KernelProcedureBuilder) { | 113 if (builder is KernelProcedureBuilder) { |
112 Builder constructor = builder.toConstructor(newName, typeVariables); | 114 Builder constructor = builder.toConstructor(newName, typeVariables); |
113 Builder other = members[newName]; | 115 Builder other = members[newName]; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 if (isConstructorName(builder.name, className)) return; | 160 if (isConstructorName(builder.name, className)) return; |
159 } | 161 } |
160 if (name.indexOf(".") != -1) { | 162 if (name.indexOf(".") != -1) { |
161 inputError(null, null, "Only constructors and factories can have names " | 163 inputError(null, null, "Only constructors and factories can have names " |
162 "containing a period ('.'): $name"); | 164 "containing a period ('.'): $name"); |
163 } | 165 } |
164 membersInScope[name] = builder; | 166 membersInScope[name] = builder; |
165 }); | 167 }); |
166 return membersInScope; | 168 return membersInScope; |
167 } | 169 } |
OLD | NEW |