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.class_builder; | 5 library fasta.class_builder; |
6 | 6 |
7 import '../errors.dart' show internalError; | 7 import '../errors.dart' show internalError; |
8 | 8 |
9 import 'builder.dart' | 9 import 'builder.dart' |
10 show | 10 show |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 68 |
69 LibraryBuilder get library { | 69 LibraryBuilder get library { |
70 LibraryBuilder library = parent; | 70 LibraryBuilder library = parent; |
71 return library.partOfLibrary ?? library; | 71 return library.partOfLibrary ?? library; |
72 } | 72 } |
73 | 73 |
74 @override | 74 @override |
75 int resolveConstructors(LibraryBuilder library) { | 75 int resolveConstructors(LibraryBuilder library) { |
76 if (constructorReferences == null) return 0; | 76 if (constructorReferences == null) return 0; |
77 for (ConstructorReferenceBuilder ref in constructorReferences) { | 77 for (ConstructorReferenceBuilder ref in constructorReferences) { |
78 ref.resolveIn(scope); | 78 ref.resolveIn(scope, library); |
79 } | 79 } |
80 return constructorReferences.length; | 80 return constructorReferences.length; |
81 } | 81 } |
82 | 82 |
83 /// Used to lookup a static member of this class. | 83 /// Used to lookup a static member of this class. |
84 Builder findStaticBuilder(String name, int charOffset, Uri fileUri, | 84 Builder findStaticBuilder( |
| 85 String name, int charOffset, Uri fileUri, LibraryBuilder accessingLibrary, |
85 {bool isSetter: false}) { | 86 {bool isSetter: false}) { |
| 87 if (accessingLibrary != library && name.startsWith("_")) return null; |
86 Builder builder = isSetter | 88 Builder builder = isSetter |
87 ? scope.lookupSetter(name, charOffset, fileUri, isInstanceScope: false) | 89 ? scope.lookupSetter(name, charOffset, fileUri, isInstanceScope: false) |
88 : scope.lookup(name, charOffset, fileUri, isInstanceScope: false); | 90 : scope.lookup(name, charOffset, fileUri, isInstanceScope: false); |
89 return builder; | 91 return builder; |
90 } | 92 } |
91 | 93 |
92 Builder findConstructorOrFactory(String name, int charOffset, Uri uri) { | 94 Builder findConstructorOrFactory( |
| 95 String name, int charOffset, Uri uri, LibraryBuilder accessingLibrary) { |
| 96 if (accessingLibrary != library && name.startsWith("_")) return null; |
93 return constructors.lookup(name, charOffset, uri); | 97 return constructors.lookup(name, charOffset, uri); |
94 } | 98 } |
95 | 99 |
96 /// Returns a map which maps the type variables of [superclass] to their | 100 /// Returns a map which maps the type variables of [superclass] to their |
97 /// respective values as defined by the superclass clause of this class (and | 101 /// respective values as defined by the superclass clause of this class (and |
98 /// its superclasses). | 102 /// its superclasses). |
99 /// | 103 /// |
100 /// It's assumed that [superclass] is a superclass of this class. | 104 /// It's assumed that [superclass] is a superclass of this class. |
101 /// | 105 /// |
102 /// For example, given: | 106 /// For example, given: |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 } | 198 } |
195 | 199 |
196 void addWarning(int charOffset, String message) { | 200 void addWarning(int charOffset, String message) { |
197 library.addWarning(charOffset, message, fileUri: fileUri); | 201 library.addWarning(charOffset, message, fileUri: fileUri); |
198 } | 202 } |
199 | 203 |
200 void addNit(int charOffset, String message) { | 204 void addNit(int charOffset, String message) { |
201 library.addNit(charOffset, message, fileUri: fileUri); | 205 library.addNit(charOffset, message, fileUri: fileUri); |
202 } | 206 } |
203 } | 207 } |
OLD | NEW |