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

Unified Diff: sdk/lib/_internal/compiler/implementation/enqueue.dart

Issue 12334070: Support runtime check of function types. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Register dependency Created 7 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
Index: sdk/lib/_internal/compiler/implementation/enqueue.dart
diff --git a/sdk/lib/_internal/compiler/implementation/enqueue.dart b/sdk/lib/_internal/compiler/implementation/enqueue.dart
index 8c351c203181515dd59255ee802a027e6501539b..cb7ec509505d8d54844ebbf66f865f73d875d40b 100644
--- a/sdk/lib/_internal/compiler/implementation/enqueue.dart
+++ b/sdk/lib/_internal/compiler/implementation/enqueue.dart
@@ -150,12 +150,21 @@ abstract class Enqueuer {
if (member.name == Compiler.NO_SUCH_METHOD) {
enableNoSuchMethod(member);
}
+ if (member.name == Compiler.CALL_OPERATOR_NAME) {
+ if (!cls.typeVariables.isEmpty) {
+ compiler.backend.registerRuntimeType(compiler.globalDependencies);
+ universe.callMethods.add(member);
+ }
+ }
if (universe.hasInvocation(member, compiler)) {
return addToWorkList(member);
}
// If there is a property access with the same name as a method we
// need to emit the method.
if (universe.hasInvokedGetter(member, compiler)) {
+ if (!cls.typeVariables.isEmpty) {
+ registerGenericClosure(member, compiler.globalDependencies);
+ }
// We will emit a closure, so make sure the closure class is
// generated.
compiler.closureClass.ensureResolved(compiler);
@@ -282,6 +291,11 @@ abstract class Enqueuer {
void handleUnseenSelector(SourceString methodName, Selector selector) {
processInstanceMembers(methodName, (Element member) {
if (selector.appliesUnnamed(member, compiler)) {
+ if (member.isFunction() && selector.isGetter()) {
+ if (!member.getEnclosingClass().typeVariables.isEmpty) {
+ registerGenericClosure(member, compiler.globalDependencies);
+ }
+ }
if (member.isField() && member.enclosingElement.isNative()) {
if (selector.isGetter() || selector.isCall()) {
nativeEnqueuer.registerFieldLoad(member);
@@ -377,6 +391,7 @@ abstract class Enqueuer {
}
void registerIsCheck(DartType type, TreeElements elements) {
+ type = type.unalias(compiler);
// Even in checked mode, type annotations for return type and argument
// types do not imply type checks, so there should never be a check
// against the type variable of a typedef.
@@ -391,6 +406,11 @@ abstract class Enqueuer {
compiler.backend.registerAsCheck(type, elements);
}
+ void registerGenericClosure(Element element, TreeElements elements) {
+ compiler.backend.registerGenericClosure(this, elements);
+ universe.closurizedMembers.add(element);
+ }
+
void forEach(f(WorkItem work));
void logSummary(log(message)) {

Powered by Google App Engine
This is Rietveld 408576698