| 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 |
| 11 import '../../scanner/token.dart' show Token; | 11 import '../../scanner/token.dart' show Token; |
| 12 | 12 |
| 13 import '../fasta_codes.dart' | 13 import '../fasta_codes.dart' |
| 14 show | 14 show |
| 15 Message, | 15 Message, |
| 16 messageConflictsWithTypeVariableCause, |
| 17 templateConflictsWithTypeVariable, |
| 16 templateDuplicatedExport, | 18 templateDuplicatedExport, |
| 17 templateDuplicatedImport, | 19 templateDuplicatedImport, |
| 18 templateExportHidesExport, | 20 templateExportHidesExport, |
| 19 templateImportHidesImport, | 21 templateImportHidesImport, |
| 20 templateLocalDefinitionHidesExport, | 22 templateLocalDefinitionHidesExport, |
| 21 templateLocalDefinitionHidesImport; | 23 templateLocalDefinitionHidesImport; |
| 22 | 24 |
| 23 import '../loader.dart' show Loader; | 25 import '../loader.dart' show Loader; |
| 24 | 26 |
| 25 import '../modifier.dart' | 27 import '../modifier.dart' |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 while (member != null) { | 153 while (member != null) { |
| 152 member.parent = cls; | 154 member.parent = cls; |
| 153 member = member.next; | 155 member = member.next; |
| 154 } | 156 } |
| 155 } | 157 } |
| 156 | 158 |
| 157 void setParentAndCheckConflicts(String name, MemberBuilder member) { | 159 void setParentAndCheckConflicts(String name, MemberBuilder member) { |
| 158 if (typeVariablesByName != null) { | 160 if (typeVariablesByName != null) { |
| 159 TypeVariableBuilder tv = typeVariablesByName[name]; | 161 TypeVariableBuilder tv = typeVariablesByName[name]; |
| 160 if (tv != null) { | 162 if (tv != null) { |
| 161 cls.deprecated_addCompileTimeError( | 163 cls.addCompileTimeError( |
| 162 member.charOffset, "Conflict with type variable '$name'."); | 164 templateConflictsWithTypeVariable.withArguments(name), |
| 163 cls.deprecated_addCompileTimeError( | 165 member.charOffset); |
| 164 tv.charOffset, "This is the type variable."); | 166 cls.addCompileTimeError( |
| 167 messageConflictsWithTypeVariableCause, tv.charOffset); |
| 165 } | 168 } |
| 166 } | 169 } |
| 167 setParent(name, member); | 170 setParent(name, member); |
| 168 } | 171 } |
| 169 | 172 |
| 170 members.forEach(setParentAndCheckConflicts); | 173 members.forEach(setParentAndCheckConflicts); |
| 171 constructors.forEach(setParentAndCheckConflicts); | 174 constructors.forEach(setParentAndCheckConflicts); |
| 172 // Formally, a setter has the name `id=`, so it can never conflict with a | 175 // Formally, a setter has the name `id=`, so it can never conflict with a |
| 173 // type variable. | 176 // type variable. |
| 174 setters.forEach(setParent); | 177 setters.forEach(setParent); |
| (...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 859 mixinApplicationClasses.putIfAbsent(name, () => builder); | 862 mixinApplicationClasses.putIfAbsent(name, () => builder); |
| 860 if (existing != builder) { | 863 if (existing != builder) { |
| 861 part.scope.local.remove(name); | 864 part.scope.local.remove(name); |
| 862 } | 865 } |
| 863 }); | 866 }); |
| 864 super.includePart(part); | 867 super.includePart(part); |
| 865 nativeMethods.addAll(part.nativeMethods); | 868 nativeMethods.addAll(part.nativeMethods); |
| 866 boundlessTypeVariables.addAll(part.boundlessTypeVariables); | 869 boundlessTypeVariables.addAll(part.boundlessTypeVariables); |
| 867 } | 870 } |
| 868 } | 871 } |
| OLD | NEW |