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.constructor_reference_builder; | 5 library fasta.constructor_reference_builder; |
6 | 6 |
7 import 'builder.dart' | 7 import 'builder.dart' |
8 show Builder, ClassBuilder, PrefixBuilder, Scope, TypeBuilder; | 8 show Builder, ClassBuilder, PrefixBuilder, Scope, TypeBuilder; |
9 | 9 |
10 import '../messages.dart' show warning; | 10 import '../messages.dart' show warning; |
(...skipping 18 matching lines...) Expand all Loading... |
29 int index = name.indexOf("."); | 29 int index = name.indexOf("."); |
30 Builder builder; | 30 Builder builder; |
31 if (index == -1) { | 31 if (index == -1) { |
32 builder = scope.lookup(name, charOffset, fileUri); | 32 builder = scope.lookup(name, charOffset, fileUri); |
33 } else { | 33 } else { |
34 String prefix = name.substring(0, index); | 34 String prefix = name.substring(0, index); |
35 String middle = name.substring(index + 1); | 35 String middle = name.substring(index + 1); |
36 builder = scope.lookup(prefix, charOffset, fileUri); | 36 builder = scope.lookup(prefix, charOffset, fileUri); |
37 if (builder is PrefixBuilder) { | 37 if (builder is PrefixBuilder) { |
38 PrefixBuilder prefix = builder; | 38 PrefixBuilder prefix = builder; |
39 builder = prefix.exports[middle]; | 39 builder = prefix.lookup(middle, charOffset, fileUri); |
40 } else if (builder is ClassBuilder) { | 40 } else if (builder is ClassBuilder) { |
41 ClassBuilder cls = builder; | 41 ClassBuilder cls = builder; |
42 builder = cls.constructors[middle]; | 42 builder = cls.findConstructorOrFactory(middle, charOffset, fileUri); |
43 if (suffix == null) { | 43 if (suffix == null) { |
44 target = builder; | 44 target = builder; |
45 return; | 45 return; |
46 } | 46 } |
47 } | 47 } |
48 } | 48 } |
49 if (builder is ClassBuilder) { | 49 if (builder is ClassBuilder) { |
50 target = builder.constructors[suffix ?? ""]; | 50 target = |
| 51 builder.findConstructorOrFactory(suffix ?? "", charOffset, fileUri); |
51 } | 52 } |
52 if (target == null) { | 53 if (target == null) { |
53 warning(null, -1, "Couldn't find constructor '$fullNameForErrors'."); | 54 warning(fileUri, charOffset, |
| 55 "Couldn't find constructor '$fullNameForErrors'."); |
54 } | 56 } |
55 } | 57 } |
56 } | 58 } |
OLD | NEW |