Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Unified Diff: pkg/compiler/lib/src/resolution/resolution_strategy.dart

Issue 2882523003: Add forEachLibraryMember and forEachConstructor to ElementEnvironment (Closed)
Patch Set: Updated cf. comments. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/compiler/lib/src/resolution/resolution_strategy.dart
diff --git a/pkg/compiler/lib/src/resolution/resolution_strategy.dart b/pkg/compiler/lib/src/resolution/resolution_strategy.dart
index a7125c7e123e463237c5a3ceec7a57e5e81c1296..f2647fe418ac4a188e5e0d515f8eef7c3ceb75dd 100644
--- a/pkg/compiler/lib/src/resolution/resolution_strategy.dart
+++ b/pkg/compiler/lib/src/resolution/resolution_strategy.dart
@@ -294,6 +294,7 @@ class _CompilerElementEnvironment implements ElementEnvironment {
{bool required: false}) {
cls.ensureResolved(_resolution);
ConstructorElement constructor = cls.implementation.lookupConstructor(name);
+ // TODO(johnniwinther): Skip redirecting factories.
if (constructor == null && required) {
throw new SpannableAssertionFailure(
cls,
@@ -316,6 +317,17 @@ class _CompilerElementEnvironment implements ElementEnvironment {
}
@override
+ void forEachConstructor(
+ ClassElement cls, void f(ConstructorEntity constructor)) {
+ cls.ensureResolved(_resolution);
+ for (ConstructorElement constructor in cls.implementation.constructors) {
+ _resolution.ensureResolved(constructor.declaration);
+ if (constructor.isRedirectingFactory) continue;
+ f(constructor);
+ }
+ }
+
+ @override
ClassEntity getSuperClass(ClassElement cls,
{bool skipUnnamedMixinApplications: false}) {
cls.ensureResolved(_resolution);
@@ -373,6 +385,17 @@ class _CompilerElementEnvironment implements ElementEnvironment {
}
@override
+ void forEachLibraryMember(
+ LibraryElement library, void f(MemberEntity member)) {
+ library.implementation.forEachLocalMember((Element element) {
+ if (!element.isClass && !element.isTypedef) {
+ MemberElement member = element;
+ f(member);
+ }
+ });
+ }
+
+ @override
ClassElement lookupClass(LibraryElement library, String name,
{bool required: false}) {
ClassElement cls = library.implementation.findLocal(name);
« no previous file with comments | « pkg/compiler/lib/src/kernel/element_map_impl.dart ('k') | tests/compiler/dart2js/equivalence/check_functions.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698