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

Side by Side Diff: pkg/kernel/lib/transformations/closure/invalidate_closures.dart

Issue 2639253003: Handle constructor bodies (Closed)
Patch Set: 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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 library kernel.transformations.closure.invalidate;
6
7 import '../../ast.dart';
8
9 class InvalidateClosures extends Transformer {
10 FunctionDeclaration visitFunctionDeclaration(FunctionDeclaration node) {
11 invalidate(node.function);
12 return node;
13 }
14
15 FunctionExpression visitFunctionExpression(FunctionExpression node) {
16 invalidate(node.function);
17 return node;
18 }
19
20 void invalidate(FunctionNode function) {
21 var position = function.location;
22 function.body = new ExpressionStatement(new Throw(
23 new StringLiteral("Calling unconverted closure at $position")))
24 ..parent = function;
25 }
26 }
OLDNEW
« no previous file with comments | « pkg/kernel/lib/transformations/closure/converter.dart ('k') | pkg/kernel/lib/transformations/closure_conversion.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698