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:front_end/src/fasta/combinator.dart' as fasta; | 7 import 'package:front_end/src/fasta/combinator.dart' as fasta; |
8 import 'package:front_end/src/fasta/export.dart'; | 8 import 'package:front_end/src/fasta/export.dart'; |
9 import 'package:front_end/src/fasta/import.dart'; | 9 import 'package:front_end/src/fasta/import.dart'; |
10 import 'package:kernel/ast.dart'; | 10 import 'package:kernel/ast.dart'; |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 List<KernelTypeBuilder> interfaces, | 127 List<KernelTypeBuilder> interfaces, |
128 int charOffset) { | 128 int charOffset) { |
129 // Nested declaration began in `OutlineBuilder.beginClassDeclaration`. | 129 // Nested declaration began in `OutlineBuilder.beginClassDeclaration`. |
130 var declaration = endNestedDeclaration(className) | 130 var declaration = endNestedDeclaration(className) |
131 ..resolveTypes(typeVariables, this); | 131 ..resolveTypes(typeVariables, this); |
132 assert(declaration.parent == libraryDeclaration); | 132 assert(declaration.parent == libraryDeclaration); |
133 Map<String, MemberBuilder> members = declaration.members; | 133 Map<String, MemberBuilder> members = declaration.members; |
134 Map<String, MemberBuilder> constructors = declaration.constructors; | 134 Map<String, MemberBuilder> constructors = declaration.constructors; |
135 Map<String, MemberBuilder> setters = declaration.setters; | 135 Map<String, MemberBuilder> setters = declaration.setters; |
136 | 136 |
137 Scope classScope = new Scope( | 137 Scope classScope = new Scope(members, setters, |
138 members, setters, scope.withTypeVariables(typeVariables), | 138 scope.withTypeVariables(typeVariables), "class $className", |
139 isModifiable: false); | 139 isModifiable: false); |
140 | 140 |
141 // When looking up a constructor, we don't consider type variables or the | 141 // When looking up a constructor, we don't consider type variables or the |
142 // library scope. | 142 // library scope. |
143 Scope constructorScope = | 143 Scope constructorScope = new Scope(constructors, null, null, "constructors", |
144 new Scope(constructors, null, null, isModifiable: false); | 144 isModifiable: false); |
145 ClassBuilder cls = new SourceClassBuilder( | 145 ClassBuilder cls = new SourceClassBuilder( |
146 documentationComment, | 146 documentationComment, |
147 metadata, | 147 metadata, |
148 modifiers, | 148 modifiers, |
149 className, | 149 className, |
150 typeVariables, | 150 typeVariables, |
151 applyMixins(supertype, | 151 applyMixins(supertype, |
152 isSyntheticMixinImplementation: true, | 152 isSyntheticMixinImplementation: true, |
153 subclassName: className, | 153 subclassName: className, |
154 typeVariables: typeVariables), | 154 typeVariables: typeVariables), |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 builder = new SourceClassBuilder( | 247 builder = new SourceClassBuilder( |
248 documentationComment, | 248 documentationComment, |
249 metadata, | 249 metadata, |
250 modifiers, | 250 modifiers, |
251 name, | 251 name, |
252 typeVariables, | 252 typeVariables, |
253 supertype, | 253 supertype, |
254 interfaces, | 254 interfaces, |
255 new Scope(<String, MemberBuilder>{}, <String, MemberBuilder>{}, | 255 new Scope(<String, MemberBuilder>{}, <String, MemberBuilder>{}, |
256 scope.withTypeVariables(typeVariables), | 256 scope.withTypeVariables(typeVariables), |
| 257 "mixin $name", isModifiable: false), |
| 258 new Scope(constructors, null, null, "constructors", |
257 isModifiable: false), | 259 isModifiable: false), |
258 new Scope(constructors, null, null, isModifiable: false), | |
259 this, | 260 this, |
260 <ConstructorReferenceBuilder>[], | 261 <ConstructorReferenceBuilder>[], |
261 charOffset, | 262 charOffset, |
262 null, | 263 null, |
263 mixin); | 264 mixin); |
264 builder.cls.isSyntheticMixinImplementation = | 265 builder.cls.isSyntheticMixinImplementation = |
265 isSyntheticMixinImplementation; | 266 isSyntheticMixinImplementation; |
266 addBuilder(name, builder, charOffset); | 267 addBuilder(name, builder, charOffset); |
267 if (!isNamed) { | 268 if (!isNamed) { |
268 mixinApplicationClasses[name] = builder; | 269 mixinApplicationClasses[name] = builder; |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
944 mixinApplicationClasses.putIfAbsent(name, () => builder); | 945 mixinApplicationClasses.putIfAbsent(name, () => builder); |
945 if (existing != builder) { | 946 if (existing != builder) { |
946 part.scope.local.remove(name); | 947 part.scope.local.remove(name); |
947 } | 948 } |
948 }); | 949 }); |
949 super.includePart(part); | 950 super.includePart(part); |
950 nativeMethods.addAll(part.nativeMethods); | 951 nativeMethods.addAll(part.nativeMethods); |
951 boundlessTypeVariables.addAll(part.boundlessTypeVariables); | 952 boundlessTypeVariables.addAll(part.boundlessTypeVariables); |
952 } | 953 } |
953 } | 954 } |
OLD | NEW |