| 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_library_builder; | 5 library fasta.source_library_builder; |
| 6 | 6 |
| 7 import 'package:kernel/ast.dart' show AsyncMarker, ProcedureKind; | 7 import 'package:kernel/ast.dart' show AsyncMarker, ProcedureKind; |
| 8 | 8 |
| 9 import '../combinator.dart' show Combinator; | 9 import '../combinator.dart' show Combinator; |
| 10 | 10 |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 if (existing is ClassBuilder && other is ClassBuilder) { | 282 if (existing is ClassBuilder && other is ClassBuilder) { |
| 283 // We allow multiple mixin applications with the same name. An | 283 // We allow multiple mixin applications with the same name. An |
| 284 // alternative is to share these mixin applications. This situation can | 284 // alternative is to share these mixin applications. This situation can |
| 285 // happen if you have `class A extends Object with Mixin {}` and `class B | 285 // happen if you have `class A extends Object with Mixin {}` and `class B |
| 286 // extends Object with Mixin {}` in the same library. | 286 // extends Object with Mixin {}` in the same library. |
| 287 return !existing.isMixinApplication || !other.isMixinApplication; | 287 return !existing.isMixinApplication || !other.isMixinApplication; |
| 288 } | 288 } |
| 289 return true; | 289 return true; |
| 290 } | 290 } |
| 291 | 291 |
| 292 void buildBuilder(Builder builder); | 292 void buildBuilder(Builder builder, LibraryBuilder coreLibrary); |
| 293 | 293 |
| 294 R build() { | 294 R build(LibraryBuilder coreLibrary) { |
| 295 assert(implementationBuilders.isEmpty); | 295 assert(implementationBuilders.isEmpty); |
| 296 canAddImplementationBuilders = true; | 296 canAddImplementationBuilders = true; |
| 297 forEach((String name, Builder builder) { | 297 forEach((String name, Builder builder) { |
| 298 do { | 298 do { |
| 299 buildBuilder(builder); | 299 buildBuilder(builder, coreLibrary); |
| 300 builder = builder.next; | 300 builder = builder.next; |
| 301 } while (builder != null); | 301 } while (builder != null); |
| 302 }); | 302 }); |
| 303 for (List list in implementationBuilders) { | 303 for (List list in implementationBuilders) { |
| 304 String name = list[0]; | 304 String name = list[0]; |
| 305 Builder builder = list[1]; | 305 Builder builder = list[1]; |
| 306 int charOffset = list[2]; | 306 int charOffset = list[2]; |
| 307 addBuilder(name, builder, charOffset); | 307 addBuilder(name, builder, charOffset); |
| 308 buildBuilder(builder); | 308 buildBuilder(builder, coreLibrary); |
| 309 } | 309 } |
| 310 canAddImplementationBuilders = false; | 310 canAddImplementationBuilders = false; |
| 311 | 311 |
| 312 scope.setters.forEach((String name, Builder setter) { | 312 scope.setters.forEach((String name, Builder setter) { |
| 313 Builder member = scopeBuilder[name]; | 313 Builder member = scopeBuilder[name]; |
| 314 if (member == null || !member.isField || member.isFinal) return; | 314 if (member == null || !member.isField || member.isFinal) return; |
| 315 // TODO(ahe): charOffset is missing. | 315 // TODO(ahe): charOffset is missing. |
| 316 addCompileTimeError( | 316 addCompileTimeError( |
| 317 setter.charOffset, "Conflicts with member '${name}'."); | 317 setter.charOffset, "Conflicts with member '${name}'."); |
| 318 addCompileTimeError( | 318 addCompileTimeError( |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 /// synthesize type variables on the factory matching the class'. | 556 /// synthesize type variables on the factory matching the class'. |
| 557 void addFactoryDeclaration( | 557 void addFactoryDeclaration( |
| 558 ProcedureBuilder procedure, DeclarationBuilder<T> factoryDeclaration) { | 558 ProcedureBuilder procedure, DeclarationBuilder<T> factoryDeclaration) { |
| 559 factoryDeclarations[procedure] = factoryDeclaration; | 559 factoryDeclarations[procedure] = factoryDeclaration; |
| 560 } | 560 } |
| 561 | 561 |
| 562 Scope toScope(Scope parent) { | 562 Scope toScope(Scope parent) { |
| 563 return new Scope(members, setters, parent, isModifiable: false); | 563 return new Scope(members, setters, parent, isModifiable: false); |
| 564 } | 564 } |
| 565 } | 565 } |
| OLD | NEW |