| 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 members.forEach((String name, Builder b) { |
| 104 MemberBuilder builder = b; |
| 104 if (isConstructorName(name, this.name)) { | 105 if (isConstructorName(name, this.name)) { |
| 105 oldConstructorNames.add(name); | 106 oldConstructorNames.add(name); |
| 106 String newName = ""; | 107 String newName = ""; |
| 107 int index = name.indexOf("."); | 108 int index = name.indexOf("."); |
| 108 if (index != -1) { | 109 if (index != -1) { |
| 109 newName = name.substring(index + 1); | 110 newName = name.substring(index + 1); |
| 110 } | 111 } |
| 111 if (builder is KernelProcedureBuilder) { | 112 if (builder is KernelProcedureBuilder) { |
| 112 Builder constructor = builder.toConstructor(newName, typeVariables); | 113 Builder constructor = builder.toConstructor(newName, typeVariables); |
| 113 Builder other = members[newName]; | 114 Builder other = members[newName]; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 if (isConstructorName(builder.name, className)) return; | 159 if (isConstructorName(builder.name, className)) return; |
| 159 } | 160 } |
| 160 if (name.indexOf(".") != -1) { | 161 if (name.indexOf(".") != -1) { |
| 161 inputError(null, null, "Only constructors and factories can have names " | 162 inputError(null, null, "Only constructors and factories can have names " |
| 162 "containing a period ('.'): $name"); | 163 "containing a period ('.'): $name"); |
| 163 } | 164 } |
| 164 membersInScope[name] = builder; | 165 membersInScope[name] = builder; |
| 165 }); | 166 }); |
| 166 return membersInScope; | 167 return membersInScope; |
| 167 } | 168 } |
| OLD | NEW |