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

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

Issue 1180973003: dart2js cps: Support function types in 'is' and 'as' operators. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Update doc comment for TypeCast Created 5 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
« no previous file with comments | « pkg/compiler/lib/src/js_backend/backend.dart ('k') | pkg/compiler/lib/src/ssa/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/codegen/codegen.dart
diff --git a/pkg/compiler/lib/src/js_backend/codegen/codegen.dart b/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
index b752a21a540e29dae94df820edd83dc87ef1e4c7..47faf29a8f91b6b8a452add38d3e958aac922d2b 100644
--- a/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
+++ b/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
@@ -15,6 +15,7 @@ import '../../util/maplet.dart';
import '../../constants/values.dart';
import '../../dart2jslib.dart';
import '../../dart_types.dart';
+import '../../closure.dart' show ClosureClassElement;
class CodegenBailout {
final tree_ir.Node node;
@@ -385,7 +386,7 @@ class CodeGenerator extends tree_ir.StatementVisitor
return buildStaticHelperInvocation(
function,
<js.Expression>[value, isT, typeArgumentArray, asT]);
- } else if (type is TypeVariableType) {
+ } else if (type is TypeVariableType || type is FunctionType) {
glue.registerIsCheck(type, registry);
Element function = node.isTypeTest
@@ -575,19 +576,22 @@ class CodeGenerator extends tree_ir.StatementVisitor
@override
js.Expression visitCreateInstance(tree_ir.CreateInstance node) {
- ClassElement cls = node.classElement;
+ ClassElement classElement = node.classElement;
// TODO(asgerf): To allow inlining of InvokeConstructor, CreateInstance must
// carry a DartType so we can register the instantiated type
// with its type arguments. Otherwise dataflow analysis is
// needed to reconstruct the instantiated type.
- registry.registerInstantiatedClass(cls);
+ registry.registerInstantiatedClass(classElement);
+ if (classElement is ClosureClassElement) {
+ registry.registerInstantiatedClosure(classElement.methodElement);
+ }
js.Expression instance = new js.New(
- glue.constructorAccess(cls),
+ glue.constructorAccess(classElement),
visitExpressionList(node.arguments));
List<tree_ir.Expression> typeInformation = node.typeInformation;
assert(typeInformation.isEmpty ||
- typeInformation.length == cls.typeVariables.length);
+ typeInformation.length == classElement.typeVariables.length);
if (typeInformation.isNotEmpty) {
FunctionElement helper = glue.getAddRuntimeTypeInformation();
js.Expression typeArguments = new js.ArrayInitializer(
« no previous file with comments | « pkg/compiler/lib/src/js_backend/backend.dart ('k') | pkg/compiler/lib/src/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698