OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 'package:analyzer/dart/ast/ast.dart'; | 5 import 'package:analyzer/dart/ast/ast.dart'; |
6 import 'package:analyzer/dart/ast/token.dart'; | 6 import 'package:analyzer/dart/ast/token.dart'; |
7 import 'package:analyzer/src/dart/ast/token.dart'; | 7 import 'package:analyzer/src/dart/ast/token.dart'; |
8 import 'package:analyzer/src/generated/utilities_dart.dart'; | 8 import 'package:analyzer/src/generated/utilities_dart.dart'; |
9 import 'package:logging/logging.dart' as logger; | 9 import 'package:logging/logging.dart' as logger; |
10 | 10 |
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 static BlockFunctionBody blockFunctionBody(Block b) { | 518 static BlockFunctionBody blockFunctionBody(Block b) { |
519 return new BlockFunctionBody(null, null, b); | 519 return new BlockFunctionBody(null, null, b); |
520 } | 520 } |
521 | 521 |
522 static ExpressionFunctionBody expressionFunctionBody(Expression body, | 522 static ExpressionFunctionBody expressionFunctionBody(Expression body, |
523 [bool decl = false]) { | 523 [bool decl = false]) { |
524 Token semi = (decl) ? new Token(TokenType.SEMICOLON, 0) : null; | 524 Token semi = (decl) ? new Token(TokenType.SEMICOLON, 0) : null; |
525 return new ExpressionFunctionBody(null, null, body, semi); | 525 return new ExpressionFunctionBody(null, null, body, semi); |
526 } | 526 } |
527 | 527 |
| 528 static ExpressionStatement expressionStatement(Expression expression) { |
| 529 Token semi = new Token(TokenType.SEMICOLON, 0); |
| 530 return new ExpressionStatement(expression, semi); |
| 531 } |
| 532 |
528 static FunctionDeclaration functionDeclaration( | 533 static FunctionDeclaration functionDeclaration( |
529 TypeName rt, SimpleIdentifier f, FunctionExpression fexp) { | 534 TypeName rt, SimpleIdentifier f, FunctionExpression fexp) { |
530 return new FunctionDeclaration(null, null, null, rt, null, f, fexp); | 535 return new FunctionDeclaration(null, null, null, rt, null, f, fexp); |
531 } | 536 } |
532 | 537 |
533 static MethodDeclaration methodDeclaration(TypeName rt, SimpleIdentifier m, | 538 static MethodDeclaration methodDeclaration(TypeName rt, SimpleIdentifier m, |
534 FormalParameterList fl, FunctionBody body, | 539 FormalParameterList fl, FunctionBody body, |
535 {bool isStatic: false}) { | 540 {bool isStatic: false}) { |
536 Token st = isStatic ? new KeywordToken(Keyword.STATIC, 0) : null; | 541 Token st = isStatic ? new KeywordToken(Keyword.STATIC, 0) : null; |
537 return new MethodDeclaration( | 542 return new MethodDeclaration( |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 Label l = new Label(s, new Token(TokenType.COLON, 0)); | 590 Label l = new Label(s, new Token(TokenType.COLON, 0)); |
586 return new NamedExpression(l, e); | 591 return new NamedExpression(l, e); |
587 } | 592 } |
588 | 593 |
589 static VariableDeclarationStatement variableDeclarationStatement( | 594 static VariableDeclarationStatement variableDeclarationStatement( |
590 VariableDeclarationList varDecl) { | 595 VariableDeclarationList varDecl) { |
591 var semi = new Token(TokenType.SEMICOLON, 0); | 596 var semi = new Token(TokenType.SEMICOLON, 0); |
592 return new VariableDeclarationStatement(varDecl, semi); | 597 return new VariableDeclarationStatement(varDecl, semi); |
593 } | 598 } |
594 } | 599 } |
OLD | NEW |