| 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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 if (existing != null) { | 404 if (existing != null) { |
| 405 if (existing != member) { | 405 if (existing != member) { |
| 406 scope.local[name] = existing.combineAmbiguousImport(name, member, this); | 406 scope.local[name] = existing.combineAmbiguousImport(name, member, this); |
| 407 } | 407 } |
| 408 // TODO(ahe): handle duplicated names. | 408 // TODO(ahe): handle duplicated names. |
| 409 } else { | 409 } else { |
| 410 scope.local[name] = member; | 410 scope.local[name] = member; |
| 411 } | 411 } |
| 412 } | 412 } |
| 413 | 413 |
| 414 /// Returns true if the export scope was modified. |
| 414 bool addToExportScope(String name, Builder member) { | 415 bool addToExportScope(String name, Builder member) { |
| 415 if (name.startsWith("_")) return false; | 416 if (name.startsWith("_")) return false; |
| 416 if (member is PrefixBuilder) return false; | 417 if (member is PrefixBuilder) return false; |
| 417 Builder existing = exports[name]; | 418 Builder existing = exports[name]; |
| 419 if (existing == member) return false; |
| 418 if (existing != null) { | 420 if (existing != null) { |
| 419 // TODO(ahe): handle duplicated names. | 421 exports[name] = buildAmbiguousBuilder(name, existing, member, -1); |
| 420 return false; | |
| 421 } else { | 422 } else { |
| 422 exports[name] = member; | 423 exports[name] = member; |
| 423 } | 424 } |
| 424 return true; | 425 return true; |
| 425 } | 426 } |
| 426 | 427 |
| 427 int resolveTypes(_) { | 428 int resolveTypes(_) { |
| 428 int typeCount = types.length; | 429 int typeCount = types.length; |
| 429 for (T t in types) { | 430 for (T t in types) { |
| 430 t.resolveIn(scope); | 431 t.resolveIn(scope); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 } | 527 } |
| 527 | 528 |
| 528 /// Called to register [procedure] as a factory whose types are collected in | 529 /// Called to register [procedure] as a factory whose types are collected in |
| 529 /// [factoryDeclaration]. Later, once the class has been built, we can | 530 /// [factoryDeclaration]. Later, once the class has been built, we can |
| 530 /// synthesize type variables on the factory matching the class'. | 531 /// synthesize type variables on the factory matching the class'. |
| 531 void addFactoryDeclaration( | 532 void addFactoryDeclaration( |
| 532 ProcedureBuilder procedure, DeclarationBuilder<T> factoryDeclaration) { | 533 ProcedureBuilder procedure, DeclarationBuilder<T> factoryDeclaration) { |
| 533 factoryDeclarations[procedure] = factoryDeclaration; | 534 factoryDeclarations[procedure] = factoryDeclaration; |
| 534 } | 535 } |
| 535 } | 536 } |
| OLD | NEW |