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

Unified Diff: pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart

Issue 2925263002: A step towards handling `new Object()` in compile_from_dill_test (Closed)
Patch Set: Updated cf. comments Created 3 years, 6 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
Index: pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart
diff --git a/pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart b/pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart
index ac562b6988635cf0d5fb78c6bf2aa10ff1379540..ef47eff3ccc9d9da4fdd298dc468fdf03edee393 100644
--- a/pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart
+++ b/pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart
@@ -12,6 +12,7 @@ import '../elements/resolution_types.dart'
show ResolutionDartType, ResolutionFunctionType, ResolutionInterfaceType;
import '../elements/elements.dart'
show ClassElement, Element, FunctionElement, MixinApplicationElement;
+import '../elements/entities.dart';
import '../js/js.dart' as jsAst;
import '../js/js.dart' show js;
import '../js_backend/js_interop_analysis.dart';
@@ -97,11 +98,14 @@ class RuntimeTypeGenerator {
/// type (if class has one) in the metadata object and stores its index in
/// the result. This is only possible for function types that do not contain
/// type variables.
- TypeTestProperties generateIsTests(ClassElement classElement,
+ TypeTestProperties generateIsTests(ClassEntity cls,
{bool storeFunctionTypeInMetadata: true}) {
- assert(classElement.isDeclaration, failedAt(classElement));
-
TypeTestProperties result = new TypeTestProperties();
+ if (cls is! ClassElement) return result;
+
+ // TODO(johnniwinther): Handle class entities.
+ ClassElement classElement = cls;
+ assert(classElement.isDeclaration, failedAt(classElement));
/// Generates an is-test if the test is not inherited from a superclass
/// This assumes that for every class an is-tests is generated
@@ -282,7 +286,7 @@ class RuntimeTypeGenerator {
Element call = cls.lookupLocalMember(Identifiers.call);
if (call == null) {
// If [cls] is a closure, it has a synthetic call operator method.
- call = cls.lookupBackendMember(Identifiers.call);
+ call = cls.lookupConstructorBody(Identifiers.call);
}
if (call != null && call.isFunction) {
FunctionElement callFunction = call;
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart ('k') | pkg/compiler/lib/src/kernel/element_map.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698