| Index: pkg/compiler/lib/src/js_backend/namer.dart
|
| diff --git a/pkg/compiler/lib/src/js_backend/namer.dart b/pkg/compiler/lib/src/js_backend/namer.dart
|
| index 6156b277c2107c48dd750947b0bb977e9ad7b05a..5f762056f3ad2a4755cd4f1433abf8a9378e4fa3 100644
|
| --- a/pkg/compiler/lib/src/js_backend/namer.dart
|
| +++ b/pkg/compiler/lib/src/js_backend/namer.dart
|
| @@ -633,6 +633,26 @@ class Namer {
|
| return invocationName(new Selector.fromElement(method));
|
| }
|
|
|
| + String _jsNameHelper(Element e) {
|
| + if (e.jsInteropName != null && e.jsInteropName.isNotEmpty)
|
| + return e.jsInteropName;
|
| + return e.isLibrary ? 'self' : e.name;
|
| + }
|
| +
|
| + String fixedBackendPath(Element element) {
|
| + if (!element.isJsInterop) return null;
|
| + if (element.isInstanceMember) return 'this';
|
| + if (element.isConstructor) return fixedBackendPath(element.enclosingClass);
|
| + if (element.isLibrary) return 'self';
|
| + var sb = new StringBuffer();
|
| + sb..write(_jsNameHelper(element.library));
|
| +
|
| + if (element.enclosingClass != null && element.enclosingClass != element) {
|
| + sb..write('.')..write(_jsNameHelper(element.enclosingClass));
|
| + }
|
| + return sb.toString();
|
| + }
|
| +
|
| /// Returns the annotated name for a variant of `call`.
|
| /// The result has the form:
|
| ///
|
| @@ -764,6 +784,7 @@ class Namer {
|
| if (element.hasFixedBackendName) {
|
| // Certain native fields must be given a specific name. Native names must
|
| // not contain '$'. We rely on this to avoid clashes.
|
| + // TODO(jacobr): we need to relax this constraint.
|
| assert(enclosingClass.isNative &&
|
| !element.fixedBackendName.contains(r'$'));
|
|
|
|
|