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

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

Issue 1408043002: Move native and js interop properties from the element model to the JS backend (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 5 years, 2 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/elements/elements.dart ('k') | pkg/compiler/lib/src/enqueue.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/elements/modelx.dart
diff --git a/pkg/compiler/lib/src/elements/modelx.dart b/pkg/compiler/lib/src/elements/modelx.dart
index 6dfd7511605d8e24d9c4548f1c1b529cca755b6f..29e4c8121d11af78bd6bd6f9db5ecfa66413bd24 100644
--- a/pkg/compiler/lib/src/elements/modelx.dart
+++ b/pkg/compiler/lib/src/elements/modelx.dart
@@ -232,62 +232,6 @@ abstract class ElementX extends Element with ElementCommon {
}
}
- String _fixedBackendName = null;
- bool _isNative = false;
- String _jsInteropName = null;
- bool _isJsInterop = false;
-
- /// Whether the element is implemented via typed JavaScript interop.
- bool get isJsInterop => _isJsInterop;
- /// JavaScript name for the element if it is implemented via typed JavaScript
- /// interop.
- String get jsInteropName => _jsInteropName;
-
- void markAsJsInterop() {
- _isJsInterop = true;
- }
-
- void setJsInteropName(String name) {
- assert(invariant(this,
- _isJsInterop,
- message: 'Element is not js interop but given a js interop name.'));
- _jsInteropName = name;
- }
-
- /// Whether the element corresponds to a native JavaScript construct either
- /// through the existing [setNative] mechanism which is only allowed
- /// for internal libraries or via the new typed JavaScriptInterop mechanism
- /// which is allowed for user libraries.
- bool get isNative => _isNative || isJsInterop;
- bool get hasFixedBackendName => fixedBackendName != null || isJsInterop;
-
- String _jsNameHelper(Element e) {
- assert(invariant(this,
- !(_isJsInterop && _jsInteropName == null),
- message:
- 'Element is js interop but js interop name has not yet been'
- 'computed.'));
- if (e.jsInteropName != null && e.jsInteropName.isNotEmpty) {
- return e.jsInteropName;
- }
- return e.isLibrary ? 'self' : e.name;
- }
-
- String get fixedBackendName {
- if (_fixedBackendName == null && isJsInterop) {
- // If an element isJsInterop but _isJsInterop is false that means it is
- // considered interop as the parent class is interop.
- _fixedBackendName = _jsNameHelper(isConstructor ? enclosingClass : this);
- }
- return _fixedBackendName;
- }
-
- // Marks this element as a native element.
- void setNative(String name) {
- _isNative = true;
- _fixedBackendName = name;
- }
-
FunctionElement asFunctionElement() => null;
bool get isAbstract => modifiers.isAbstract;
@@ -1054,7 +998,6 @@ class LibraryElementX
LinkBuilder<LibraryTag> tagsBuilder = new LinkBuilder<LibraryTag>();
List<LibraryTag> tagsCache;
LibraryName libraryTag;
- bool canUseNative = false;
Link<Element> localMembers = const Link<Element>();
final ScopeX localScope = new ScopeX();
final ImportScope importScope = new ImportScope();
@@ -2053,18 +1996,6 @@ abstract class BaseFunctionElementX
typeCache = _functionSignatureCache.type;
}
- /// An function is part of JsInterop in the following cases:
- /// * It has a jsInteropName annotation
- /// * It is external member of a class or library tagged as JsInterop.
- bool get isJsInterop {
- if (!isExternal) return false;
-
- if (super.isJsInterop) return true;
- if (isClassMember) return contextClass.isJsInterop;
- if (isTopLevel) return library.isJsInterop;
- return false;
- }
-
List<ParameterElement> get parameters {
// TODO(johnniwinther): Store the list directly, possibly by using List
// instead of Link in FunctionSignature.
@@ -2557,7 +2488,6 @@ abstract class BaseClassElementX extends ElementX
DartType supertype;
Link<DartType> interfaces;
- String nativeTagInfo;
int supertypeLoadState;
int resolutionState;
bool isProxy = false;
@@ -2685,19 +2615,6 @@ abstract class BaseClassElementX extends ElementX
return asInstanceOf(compiler.functionClass) != null || callType != null;
}
- bool get isNative => nativeTagInfo != null || isJsInterop;
-
- void setNative(String name) {
- // TODO(johnniwinther): Assert that this is only called once. The memory
- // compiler copies pre-processed elements into a new compiler through
- // [Compiler.onLibraryScanned] and thereby causes multiple calls to this
- // method.
- assert(invariant(this, nativeTagInfo == null || nativeTagInfo == name,
- message: "Native tag info set inconsistently on $this: "
- "Existing name '$nativeTagInfo', new name '$name'."));
- nativeTagInfo = name;
- }
-
// TODO(johnniwinther): Remove these when issue 18630 is fixed.
ClassElement get patch => super.patch;
ClassElement get origin => super.origin;
« no previous file with comments | « pkg/compiler/lib/src/elements/elements.dart ('k') | pkg/compiler/lib/src/enqueue.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698