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

Side by Side Diff: pkg/kernel/lib/visitor.dart

Issue 2778223002: Add primitive to create closures and use it for closure conversion (Closed)
Patch Set: Fix bug: put parameters with no initalizers into contexts correctly Created 3 years, 8 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 library kernel.ast.visitor; 4 library kernel.ast.visitor;
5 5
6 import 'ast.dart'; 6 import 'ast.dart';
7 7
8 abstract class ExpressionVisitor<R> { 8 abstract class ExpressionVisitor<R> {
9 R defaultExpression(Expression node) => null; 9 R defaultExpression(Expression node) => null;
10 R defaultBasicLiteral(BasicLiteral node) => defaultExpression(node); 10 R defaultBasicLiteral(BasicLiteral node) => defaultExpression(node);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 R visitBoolLiteral(BoolLiteral node) => defaultBasicLiteral(node); 51 R visitBoolLiteral(BoolLiteral node) => defaultBasicLiteral(node);
52 R visitNullLiteral(NullLiteral node) => defaultBasicLiteral(node); 52 R visitNullLiteral(NullLiteral node) => defaultBasicLiteral(node);
53 R visitLet(Let node) => defaultExpression(node); 53 R visitLet(Let node) => defaultExpression(node);
54 R visitLoadLibrary(LoadLibrary node) => defaultExpression(node); 54 R visitLoadLibrary(LoadLibrary node) => defaultExpression(node);
55 R visitCheckLibraryIsLoaded(CheckLibraryIsLoaded node) => 55 R visitCheckLibraryIsLoaded(CheckLibraryIsLoaded node) =>
56 defaultExpression(node); 56 defaultExpression(node);
57 R visitVectorCreation(VectorCreation node) => defaultExpression(node); 57 R visitVectorCreation(VectorCreation node) => defaultExpression(node);
58 R visitVectorGet(VectorGet node) => defaultExpression(node); 58 R visitVectorGet(VectorGet node) => defaultExpression(node);
59 R visitVectorSet(VectorSet node) => defaultExpression(node); 59 R visitVectorSet(VectorSet node) => defaultExpression(node);
60 R visitVectorCopy(VectorCopy node) => defaultExpression(node); 60 R visitVectorCopy(VectorCopy node) => defaultExpression(node);
61 R visitClosureCreation(ClosureCreation node) => defaultExpression(node);
61 } 62 }
62 63
63 abstract class StatementVisitor<R> { 64 abstract class StatementVisitor<R> {
64 R defaultStatement(Statement node) => null; 65 R defaultStatement(Statement node) => null;
65 66
66 R visitInvalidStatement(InvalidStatement node) => defaultStatement(node); 67 R visitInvalidStatement(InvalidStatement node) => defaultStatement(node);
67 R visitExpressionStatement(ExpressionStatement node) => 68 R visitExpressionStatement(ExpressionStatement node) =>
68 defaultStatement(node); 69 defaultStatement(node);
69 R visitBlock(Block node) => defaultStatement(node); 70 R visitBlock(Block node) => defaultStatement(node);
70 R visitEmptyStatement(EmptyStatement node) => defaultStatement(node); 71 R visitEmptyStatement(EmptyStatement node) => defaultStatement(node);
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 R visitBoolLiteral(BoolLiteral node) => defaultBasicLiteral(node); 163 R visitBoolLiteral(BoolLiteral node) => defaultBasicLiteral(node);
163 R visitNullLiteral(NullLiteral node) => defaultBasicLiteral(node); 164 R visitNullLiteral(NullLiteral node) => defaultBasicLiteral(node);
164 R visitLet(Let node) => defaultExpression(node); 165 R visitLet(Let node) => defaultExpression(node);
165 R visitLoadLibrary(LoadLibrary node) => defaultExpression(node); 166 R visitLoadLibrary(LoadLibrary node) => defaultExpression(node);
166 R visitCheckLibraryIsLoaded(CheckLibraryIsLoaded node) => 167 R visitCheckLibraryIsLoaded(CheckLibraryIsLoaded node) =>
167 defaultExpression(node); 168 defaultExpression(node);
168 R visitVectorCreation(VectorCreation node) => defaultExpression(node); 169 R visitVectorCreation(VectorCreation node) => defaultExpression(node);
169 R visitVectorGet(VectorGet node) => defaultExpression(node); 170 R visitVectorGet(VectorGet node) => defaultExpression(node);
170 R visitVectorSet(VectorSet node) => defaultExpression(node); 171 R visitVectorSet(VectorSet node) => defaultExpression(node);
171 R visitVectorCopy(VectorCopy node) => defaultExpression(node); 172 R visitVectorCopy(VectorCopy node) => defaultExpression(node);
173 R visitClosureCreation(ClosureCreation node) => defaultExpression(node);
172 174
173 // Statements 175 // Statements
174 R defaultStatement(Statement node) => defaultTreeNode(node); 176 R defaultStatement(Statement node) => defaultTreeNode(node);
175 R visitInvalidStatement(InvalidStatement node) => defaultStatement(node); 177 R visitInvalidStatement(InvalidStatement node) => defaultStatement(node);
176 R visitExpressionStatement(ExpressionStatement node) => 178 R visitExpressionStatement(ExpressionStatement node) =>
177 defaultStatement(node); 179 defaultStatement(node);
178 R visitBlock(Block node) => defaultStatement(node); 180 R visitBlock(Block node) => defaultStatement(node);
179 R visitEmptyStatement(EmptyStatement node) => defaultStatement(node); 181 R visitEmptyStatement(EmptyStatement node) => defaultStatement(node);
180 R visitAssertStatement(AssertStatement node) => defaultStatement(node); 182 R visitAssertStatement(AssertStatement node) => defaultStatement(node);
181 R visitLabeledStatement(LabeledStatement node) => defaultStatement(node); 183 R visitLabeledStatement(LabeledStatement node) => defaultStatement(node);
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 R visitNullLiteral(NullLiteral node, arg) => defaultBasicLiteral(node, arg); 387 R visitNullLiteral(NullLiteral node, arg) => defaultBasicLiteral(node, arg);
386 R visitLet(Let node, arg) => defaultExpression(node, arg); 388 R visitLet(Let node, arg) => defaultExpression(node, arg);
387 R visitLoadLibrary(LoadLibrary node, arg) => defaultExpression(node, arg); 389 R visitLoadLibrary(LoadLibrary node, arg) => defaultExpression(node, arg);
388 R visitCheckLibraryIsLoaded(CheckLibraryIsLoaded node, arg) => 390 R visitCheckLibraryIsLoaded(CheckLibraryIsLoaded node, arg) =>
389 defaultExpression(node, arg); 391 defaultExpression(node, arg);
390 R visitVectorCreation(VectorCreation node, arg) => 392 R visitVectorCreation(VectorCreation node, arg) =>
391 defaultExpression(node, arg); 393 defaultExpression(node, arg);
392 R visitVectorGet(VectorGet node, arg) => defaultExpression(node, arg); 394 R visitVectorGet(VectorGet node, arg) => defaultExpression(node, arg);
393 R visitVectorSet(VectorSet node, arg) => defaultExpression(node, arg); 395 R visitVectorSet(VectorSet node, arg) => defaultExpression(node, arg);
394 R visitVectorCopy(VectorCopy node, arg) => defaultExpression(node, arg); 396 R visitVectorCopy(VectorCopy node, arg) => defaultExpression(node, arg);
397 R visitClosureCreation(ClosureCreation node, arg) =>
398 defaultExpression(node, arg);
395 } 399 }
396 400
397 abstract class StatementVisitor1<R> { 401 abstract class StatementVisitor1<R> {
398 R defaultStatement(Statement node, arg) => null; 402 R defaultStatement(Statement node, arg) => null;
399 403
400 R visitInvalidStatement(InvalidStatement node, arg) => 404 R visitInvalidStatement(InvalidStatement node, arg) =>
401 defaultStatement(node, arg); 405 defaultStatement(node, arg);
402 R visitExpressionStatement(ExpressionStatement node, arg) => 406 R visitExpressionStatement(ExpressionStatement node, arg) =>
403 defaultStatement(node, arg); 407 defaultStatement(node, arg);
404 R visitBlock(Block node, arg) => defaultStatement(node, arg); 408 R visitBlock(Block node, arg) => defaultStatement(node, arg);
(...skipping 20 matching lines...) Expand all
425 defaultStatement(node, arg); 429 defaultStatement(node, arg);
426 R visitTryCatch(TryCatch node, arg) => defaultStatement(node, arg); 430 R visitTryCatch(TryCatch node, arg) => defaultStatement(node, arg);
427 R visitTryFinally(TryFinally node, arg) => defaultStatement(node, arg); 431 R visitTryFinally(TryFinally node, arg) => defaultStatement(node, arg);
428 R visitYieldStatement(YieldStatement node, arg) => 432 R visitYieldStatement(YieldStatement node, arg) =>
429 defaultStatement(node, arg); 433 defaultStatement(node, arg);
430 R visitVariableDeclaration(VariableDeclaration node, arg) => 434 R visitVariableDeclaration(VariableDeclaration node, arg) =>
431 defaultStatement(node, arg); 435 defaultStatement(node, arg);
432 R visitFunctionDeclaration(FunctionDeclaration node, arg) => 436 R visitFunctionDeclaration(FunctionDeclaration node, arg) =>
433 defaultStatement(node, arg); 437 defaultStatement(node, arg);
434 } 438 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698