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

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: Fixes after rebase. Created 3 years, 10 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 '../common/codegen.dart' show CodegenRegistry; 5 import '../common/codegen.dart' show CodegenRegistry;
6 import '../compiler.dart'; 6 import '../compiler.dart';
7 import '../elements/elements.dart'; 7 import '../elements/elements.dart';
8 import '../elements/entities.dart' show Entity, Local; 8 import '../elements/entities.dart' show Entity, Local;
9 import '../elements/resolution_types.dart'; 9 import '../elements/resolution_types.dart';
10 import '../js_backend/js_backend.dart'; 10 import '../js_backend/js_backend.dart';
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 254
255 void visitVoidType(ResolutionVoidType type, GraphBuilder builder) { 255 void visitVoidType(ResolutionVoidType type, GraphBuilder builder) {
256 ClassElement cls = builder.backend.helpers.VoidRuntimeType; 256 ClassElement cls = builder.backend.helpers.VoidRuntimeType;
257 builder.push(new HVoidType(type, new TypeMask.exact(cls, closedWorld))); 257 builder.push(new HVoidType(type, new TypeMask.exact(cls, closedWorld)));
258 } 258 }
259 259
260 void visitTypeVariableType( 260 void visitTypeVariableType(
261 ResolutionTypeVariableType type, GraphBuilder builder) { 261 ResolutionTypeVariableType 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 ResolutionDynamicType(), 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 ResolutionTypedefType) throw 'unable to unalias $type'; 337 if (unaliased is ResolutionTypedefType) throw 'unable to unalias $type';
330 unaliased.accept(this, builder); 338 unaliased.accept(this, builder);
331 } 339 }
332 340
333 void visitDynamicType(ResolutionDynamicType type, GraphBuilder builder) { 341 void visitDynamicType(ResolutionDynamicType 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