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

Unified Diff: pkg/compiler/lib/src/elements/common.dart

Issue 1927963002: Support compilation of Hello World (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Fixes Created 4 years, 8 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
« no previous file with comments | « pkg/compiler/lib/src/diagnostics/messages.dart ('k') | pkg/compiler/lib/src/elements/elements.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/elements/common.dart
diff --git a/pkg/compiler/lib/src/elements/common.dart b/pkg/compiler/lib/src/elements/common.dart
index 9cdce47251bceacdd2678c0d8217a5b1e0005106..6c9a013451a35f19ce281285945374e4f9bcd130 100644
--- a/pkg/compiler/lib/src/elements/common.dart
+++ b/pkg/compiler/lib/src/elements/common.dart
@@ -151,6 +151,13 @@ abstract class ElementCommon implements Element {
}
return null;
}
+
+ Element get enclosingClassOrCompilationUnit {
+ for (Element e = this; e != null; e = e.enclosingElement) {
+ if (e.isClass || e.isCompilationUnit) return e;
+ }
+ return null;
+ }
}
abstract class LibraryElementCommon implements LibraryElement {
@@ -465,6 +472,36 @@ abstract class ClassElementCommon implements ClassElement {
bool get isNamedMixinApplication {
return isMixinApplication && !isUnnamedMixinApplication;
}
+
+ // backendMembers are members that have been added by the backend to simplify
+ // compilation. They don't have any user-side counter-part.
+ Link<Element> backendMembers = const Link<Element>();
+
+ bool get hasBackendMembers => !backendMembers.isEmpty;
+
+ void addBackendMember(Element member) {
+ // TODO(ngeoffray): Deprecate this method.
+ assert(member.isGenerativeConstructorBody);
+ backendMembers = backendMembers.prepend(member);
+ }
+
+ void reverseBackendMembers() {
+ backendMembers = backendMembers.reverse();
+ }
+
+ /// Lookup a synthetic element created by the backend.
+ Element lookupBackendMember(String memberName) {
+ for (Element element in backendMembers) {
+ if (element.name == memberName) {
+ return element;
+ }
+ }
+ return null;
+ }
+
+ void forEachBackendMember(void f(Element member)) {
+ backendMembers.forEach(f);
+ }
}
abstract class FunctionSignatureCommon implements FunctionSignature {
« no previous file with comments | « pkg/compiler/lib/src/diagnostics/messages.dart ('k') | pkg/compiler/lib/src/elements/elements.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698