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

Unified Diff: pkg/compiler/lib/src/js_backend/native_data.dart

Issue 2775283002: Use Entity in native_data. (Closed)
Patch Set: Fix. Created 3 years, 9 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/js_backend/backend_usage.dart ('k') | pkg/compiler/lib/src/kernel/world_builder.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js_backend/native_data.dart
diff --git a/pkg/compiler/lib/src/js_backend/native_data.dart b/pkg/compiler/lib/src/js_backend/native_data.dart
index c8403f58f3b2ab69f6d4d570991ad0f313c432cb..2cc38824ba22d79452324658060129f5eb046b9e 100644
--- a/pkg/compiler/lib/src/js_backend/native_data.dart
+++ b/pkg/compiler/lib/src/js_backend/native_data.dart
@@ -5,7 +5,7 @@
library js_backend.native_data;
import '../common.dart';
-import '../elements/elements.dart' show ClassElement;
+import '../common_elements.dart' show ElementEnvironment;
import '../elements/entities.dart';
import '../native/behavior.dart' show NativeBehavior;
import '../util/util.dart';
@@ -106,7 +106,9 @@ abstract class NativeBasicDataBuilder {
/// expected to be computed later.
void markAsJsInteropClass(ClassEntity element);
- NativeBasicData close();
+ /// Creates the [NativeBasicData] object for the data collected in this
+ /// builder.
+ NativeBasicData close(ElementEnvironment environment);
}
abstract class NativeDataBuilder {
@@ -180,13 +182,15 @@ class NativeBasicDataBuilderImpl implements NativeBasicDataBuilder {
jsInteropClasses.add(element);
}
- NativeBasicData close() {
+ NativeBasicData close(ElementEnvironment environment) {
return new NativeBasicDataImpl(
- nativeClassTagInfo, jsInteropLibraries, jsInteropClasses);
+ environment, nativeClassTagInfo, jsInteropLibraries, jsInteropClasses);
}
}
class NativeBasicDataImpl implements NativeBasicData {
+ final ElementEnvironment _env;
+
/// Tag info for native JavaScript classes names. See
/// [setNativeClassTagInfo].
final Map<ClassEntity, NativeClassTag> nativeClassTagInfo;
@@ -197,8 +201,8 @@ class NativeBasicDataImpl implements NativeBasicData {
/// The JavaScript classes implemented via typed JavaScript interop.
final Set<ClassEntity> jsInteropClasses;
- NativeBasicDataImpl(
- this.nativeClassTagInfo, this.jsInteropLibraries, this.jsInteropClasses);
+ NativeBasicDataImpl(this._env, this.nativeClassTagInfo,
+ this.jsInteropLibraries, this.jsInteropClasses);
/// Returns `true` if [cls] is a native class.
bool isNativeClass(ClassEntity element) {
@@ -227,13 +231,12 @@ class NativeBasicDataImpl implements NativeBasicData {
}
/// Returns `true` if [element] or any of its superclasses is native.
- bool isNativeOrExtendsNative(ClassElement element) {
+ bool isNativeOrExtendsNative(ClassEntity element) {
if (element == null) return false;
if (isNativeClass(element) || isJsInteropClass(element)) {
return true;
}
- assert(element.isResolved);
- return isNativeOrExtendsNative(element.superclass);
+ return isNativeOrExtendsNative(_env.getSuperClass(element));
}
}
« no previous file with comments | « pkg/compiler/lib/src/js_backend/backend_usage.dart ('k') | pkg/compiler/lib/src/kernel/world_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698