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

Side by Side Diff: pkg/compiler/lib/src/ssa/graph_builder.dart

Issue 2567133002: Add support for the new function-type syntax. (Closed)
Patch Set: Remove obsolete named argument. Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import '../closure.dart'; 5 import '../closure.dart';
6 import '../common.dart'; 6 import '../common.dart';
7 import '../common/codegen.dart' show CodegenRegistry; 7 import '../common/codegen.dart' show CodegenRegistry;
8 import '../compiler.dart'; 8 import '../compiler.dart';
9 import '../constants/constant_system.dart'; 9 import '../constants/constant_system.dart';
10 import '../dart_types.dart'; 10 import '../dart_types.dart';
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 void visit(DartType type, GraphBuilder builder) => type.accept(this, builder); 254 void visit(DartType type, GraphBuilder builder) => type.accept(this, builder);
255 255
256 void visitVoidType(VoidType type, GraphBuilder builder) { 256 void visitVoidType(VoidType type, GraphBuilder builder) {
257 ClassElement cls = builder.backend.helpers.VoidRuntimeType; 257 ClassElement cls = builder.backend.helpers.VoidRuntimeType;
258 builder.push(new HVoidType(type, new TypeMask.exact(cls, closedWorld))); 258 builder.push(new HVoidType(type, new TypeMask.exact(cls, closedWorld)));
259 } 259 }
260 260
261 void visitTypeVariableType(TypeVariableType type, GraphBuilder builder) { 261 void visitTypeVariableType(TypeVariableType type, GraphBuilder builder) {
262 ClassElement cls = builder.backend.helpers.RuntimeType; 262 ClassElement cls = builder.backend.helpers.RuntimeType;
263 TypeMask instructionType = new TypeMask.subclass(cls, closedWorld); 263 TypeMask instructionType = new TypeMask.subclass(cls, closedWorld);
264
265 // TODO(floitsch): this hack maps type variables of generic function
266 // typedefs to dynamic. For example: `typedef F = Function<T>(T)`.
267 if (type is MethodTypeVariableType) {
268 visitDynamicType(const DynamicType(), builder);
269 return;
270 }
271
264 if (!builder.sourceElement.enclosingElement.isClosure && 272 if (!builder.sourceElement.enclosingElement.isClosure &&
265 builder.sourceElement.isInstanceMember) { 273 builder.sourceElement.isInstanceMember) {
266 HInstruction receiver = builder.localsHandler.readThis(); 274 HInstruction receiver = builder.localsHandler.readThis();
267 builder.push(new HReadTypeVariable(type, receiver, instructionType)); 275 builder.push(new HReadTypeVariable(type, receiver, instructionType));
268 } else { 276 } else {
269 builder.push(new HReadTypeVariable.noReceiver( 277 builder.push(new HReadTypeVariable.noReceiver(
270 type, 278 type,
271 builder.typeBuilder 279 builder.typeBuilder
272 .addTypeVariableReference(type, builder.sourceElement), 280 .addTypeVariableReference(type, builder.sourceElement),
273 instructionType)); 281 instructionType));
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 if (unaliased is TypedefType) throw 'unable to unalias $type'; 337 if (unaliased is TypedefType) throw 'unable to unalias $type';
330 unaliased.accept(this, builder); 338 unaliased.accept(this, builder);
331 } 339 }
332 340
333 void visitDynamicType(DynamicType type, GraphBuilder builder) { 341 void visitDynamicType(DynamicType type, GraphBuilder builder) {
334 JavaScriptBackend backend = builder.compiler.backend; 342 JavaScriptBackend backend = builder.compiler.backend;
335 ClassElement cls = backend.helpers.DynamicRuntimeType; 343 ClassElement cls = backend.helpers.DynamicRuntimeType;
336 builder.push(new HDynamicType(type, new TypeMask.exact(cls, closedWorld))); 344 builder.push(new HDynamicType(type, new TypeMask.exact(cls, closedWorld)));
337 } 345 }
338 } 346 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698