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/analyzer/lib/src/generated/parser.dart

Issue 189433006: Support for DartBlockBody, DartExpressionBody, DartOmit in java2dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine.parser; 8 library engine.parser;
9 9
10 import 'java_core.dart'; 10 import 'java_core.dart';
(...skipping 8542 matching lines...) Expand 10 before | Expand all | Expand 10 after
8553 return false; 8553 return false;
8554 } 8554 }
8555 return first.lexeme == second.lexeme; 8555 return first.lexeme == second.lexeme;
8556 } 8556 }
8557 } 8557 }
8558 8558
8559 /** 8559 /**
8560 * Instances of the class {link ToFormattedSourceVisitor} write a source represe ntation of a visited 8560 * Instances of the class {link ToFormattedSourceVisitor} write a source represe ntation of a visited
8561 * AST node (and all of it's children) to a writer. 8561 * AST node (and all of it's children) to a writer.
8562 */ 8562 */
8563 class ToFormattedSourceVisitor implements AstVisitor<Object> { 8563 class ToFormattedSourceVisitor implements AstVisitor<Object> {
Brian Wilkerson 2014/03/07 16:12:31 I don't understand why this class is here. It is p
scheglov 2014/03/07 22:47:44 You are right. I used it once about a year ago, bu
8564 static String COMMENTS_KEY = "List of comments before statement"; 8564 static String COMMENTS_KEY = "List of comments before statement";
8565 8565
8566 static String BLOCK_BODY_KEY = "Block body source";
8567
8568 static String EXPRESSION_BODY_KEY = "Expression body source";
8569
8566 /** 8570 /**
8567 * The writer to which the source is to be written. 8571 * The writer to which the source is to be written.
8568 */ 8572 */
8569 PrintWriter _writer; 8573 PrintWriter _writer;
8570 8574
8571 int _indentLevel = 0; 8575 int _indentLevel = 0;
8572 8576
8573 String _indentString = ""; 8577 String _indentString = "";
8574 8578
8575 /** 8579 /**
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
9154 visitNode(node.documentationComment); 9158 visitNode(node.documentationComment);
9155 visitTokenWithSuffix(node.externalKeyword, " "); 9159 visitTokenWithSuffix(node.externalKeyword, " ");
9156 visitTokenWithSuffix(node.modifierKeyword, " "); 9160 visitTokenWithSuffix(node.modifierKeyword, " ");
9157 visitNodeWithSuffix(node.returnType, " "); 9161 visitNodeWithSuffix(node.returnType, " ");
9158 visitTokenWithSuffix(node.propertyKeyword, " "); 9162 visitTokenWithSuffix(node.propertyKeyword, " ");
9159 visitTokenWithSuffix(node.operatorKeyword, " "); 9163 visitTokenWithSuffix(node.operatorKeyword, " ");
9160 visitNode(node.name); 9164 visitNode(node.name);
9161 if (!node.isGetter) { 9165 if (!node.isGetter) {
9162 visitNode(node.parameters); 9166 visitNode(node.parameters);
9163 } 9167 }
9164 if (node.body is! EmptyFunctionBody) { 9168 String bodySource;
9165 _writer.print(' '); 9169 if ((bodySource = node.getProperty(BLOCK_BODY_KEY) as String) != null) {
9170 _writer.print(" {");
9171 if (!bodySource.isEmpty) {
9172 nl();
9173 _writer.print(bodySource);
9174 }
9175 nl2();
9176 _writer.print('}');
9177 } else if ((bodySource = node.getProperty(EXPRESSION_BODY_KEY) as String) != null) {
9178 _writer.print(" => ");
9179 _writer.print(bodySource);
9180 _writer.print(';');
9181 } else {
9182 if (node.body is! EmptyFunctionBody) {
9183 _writer.print(' ');
9184 }
9185 visitNode(node.body);
9166 } 9186 }
9167 visitNode(node.body);
9168 return null; 9187 return null;
9169 } 9188 }
9170 9189
9171 Object visitMethodInvocation(MethodInvocation node) { 9190 Object visitMethodInvocation(MethodInvocation node) {
9172 if (node.isCascaded) { 9191 if (node.isCascaded) {
9173 _writer.print(".."); 9192 _writer.print("..");
9174 } else { 9193 } else {
9175 visitNodeWithSuffix(node.target, "."); 9194 visitNodeWithSuffix(node.target, ".");
9176 } 9195 }
9177 visitNode(node.methodName); 9196 visitNode(node.methodName);
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
9627 * @param suffix the suffix to be printed if there is a node to visit 9646 * @param suffix the suffix to be printed if there is a node to visit
9628 * @param node the node to be visited 9647 * @param node the node to be visited
9629 */ 9648 */
9630 void visitTokenWithSuffix(Token token, String suffix) { 9649 void visitTokenWithSuffix(Token token, String suffix) {
9631 if (token != null) { 9650 if (token != null) {
9632 _writer.print(token.lexeme); 9651 _writer.print(token.lexeme);
9633 _writer.print(suffix); 9652 _writer.print(suffix);
9634 } 9653 }
9635 } 9654 }
9636 } 9655 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698