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

Unified Diff: lib/kernel.dart

Issue 2116793002: Work around for private names in mixin applications. (Closed) Base URL: git@github.com:dart-lang/rasta.git@master
Patch Set: Update test expectations. Created 4 years, 4 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 | « no previous file | lib/kernel_visitor.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/kernel.dart
diff --git a/lib/kernel.dart b/lib/kernel.dart
index 3ae96fc12539da01b47ef0b499c892a4b5a9a5d7..3214fd56674a0df573cb7353b54d8653f7100f24 100644
--- a/lib/kernel.dart
+++ b/lib/kernel.dart
@@ -27,7 +27,7 @@ import 'package:compiler/src/elements/elements.dart' show
FunctionElement,
ImportElement,
LibraryElement,
- Name,
+ MixinApplicationElement,
TypeVariableElement;
import 'package:compiler/src/elements/modelx.dart' show
@@ -136,15 +136,17 @@ class Kernel {
}
ir.Name irName(String name, Element element) {
- return new ir.Name(name, libraryToIr(element.library));
- }
-
- ir.Name nameToIrName(Name name) {
- ir.Library library;
- if (name.isPrivate) {
- library = libraryToIr(name.library);
+ ir.Library irLibrary = null;
+ if (name.startsWith("_")) {
+ ClassElement cls = element.enclosingClass;
+ if (cls != null && cls.isMixinApplication) {
+ MixinApplicationElement mixinApplication = cls;
+ element = mixinApplication.mixin;
+ }
+ name = "${element.library.libraryOrScriptName}::$name";
+ irLibrary = libraryToIr(element.library);
}
- return new ir.Name(name.text, library);
+ return new ir.Name(name, irLibrary);
}
Future<ir.Library> loadLibrary(Uri uri) async {
@@ -436,7 +438,7 @@ class Kernel {
? const ir.InvalidType()
: typeToIr(field.type);
ir.Field fieldNode = new ir.Field(
- nameToIrName(field.memberName), type: type, initializer: null,
+ irName(field.memberName.text, field), type: type, initializer: null,
isFinal: field.isFinal, isStatic: field.isStatic || field.isTopLevel,
isConst: field.isConst);
addWork(field, () {
« no previous file with comments | « no previous file | lib/kernel_visitor.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698