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

Side by Side Diff: pkg/analyzer_experimental/lib/src/generated/parser.dart

Issue 18129004: Simplify constructors translation, improve code style. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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 // This code was auto-generated, is not intended to be edited, and is subject to 1 // This code was auto-generated, is not intended to be edited, and is subject to
2 // significant change. Please see the README file for more information. 2 // significant change. Please see the README file for more information.
3 library engine.parser; 3 library engine.parser;
4 import 'dart:collection'; 4 import 'dart:collection';
5 import 'java_core.dart'; 5 import 'java_core.dart';
6 import 'java_engine.dart'; 6 import 'java_engine.dart';
7 import 'instrumentation.dart'; 7 import 'instrumentation.dart';
8 import 'error.dart'; 8 import 'error.dart';
9 import 'source.dart'; 9 import 'source.dart';
10 import 'scanner.dart'; 10 import 'scanner.dart';
(...skipping 2028 matching lines...) Expand 10 before | Expand all | Expand 10 after
2039 } 2039 }
2040 return new TopLevelVariableDeclaration.full(commentAndMetadata.comment, co mmentAndMetadata.metadata, parseVariableDeclarationList2(null, validateModifiers ForTopLevelVariable(modifiers), null), expect2(TokenType.SEMICOLON)); 2040 return new TopLevelVariableDeclaration.full(commentAndMetadata.comment, co mmentAndMetadata.metadata, parseVariableDeclarationList2(null, validateModifiers ForTopLevelVariable(modifiers), null), expect2(TokenType.SEMICOLON));
2041 } 2041 }
2042 TypeName returnType = parseReturnType(); 2042 TypeName returnType = parseReturnType();
2043 if (matches(Keyword.GET) || matches(Keyword.SET)) { 2043 if (matches(Keyword.GET) || matches(Keyword.SET)) {
2044 validateModifiersForTopLevelFunction(modifiers); 2044 validateModifiersForTopLevelFunction(modifiers);
2045 return parseFunctionDeclaration(commentAndMetadata, modifiers.externalKeyw ord, returnType); 2045 return parseFunctionDeclaration(commentAndMetadata, modifiers.externalKeyw ord, returnType);
2046 } else if (matches(Keyword.OPERATOR) && isOperator(peek())) { 2046 } else if (matches(Keyword.OPERATOR) && isOperator(peek())) {
2047 reportError8(ParserErrorCode.TOP_LEVEL_OPERATOR, _currentToken, []); 2047 reportError8(ParserErrorCode.TOP_LEVEL_OPERATOR, _currentToken, []);
2048 return convertToFunctionDeclaration(parseOperator(commentAndMetadata, modi fiers.externalKeyword, returnType)); 2048 return convertToFunctionDeclaration(parseOperator(commentAndMetadata, modi fiers.externalKeyword, returnType));
2049 } else if (matches5(TokenType.AT)) {
2050 return new TopLevelVariableDeclaration.full(commentAndMetadata.comment, co mmentAndMetadata.metadata, parseVariableDeclarationList2(null, validateModifiers ForTopLevelVariable(modifiers), returnType), expect2(TokenType.SEMICOLON));
2049 } else if (!matchesIdentifier()) { 2051 } else if (!matchesIdentifier()) {
2050 reportError8(ParserErrorCode.EXPECTED_EXECUTABLE, _currentToken, []); 2052 reportError8(ParserErrorCode.EXPECTED_EXECUTABLE, _currentToken, []);
2051 return null; 2053 Token semicolon;
2054 if (matches5(TokenType.SEMICOLON)) {
2055 semicolon = andAdvance;
2056 } else {
2057 semicolon = createSyntheticToken2(TokenType.SEMICOLON);
2058 }
2059 List<VariableDeclaration> variables = new List<VariableDeclaration>();
2060 variables.add(new VariableDeclaration.full(null, null, createSyntheticIden tifier(), null, null));
2061 return new TopLevelVariableDeclaration.full(commentAndMetadata.comment, co mmentAndMetadata.metadata, new VariableDeclarationList.full(null, null, null, re turnType, variables), semicolon);
2052 } 2062 }
2053 if (matchesAny(peek(), [TokenType.OPEN_PAREN, TokenType.FUNCTION, TokenType. OPEN_CURLY_BRACKET])) { 2063 if (matchesAny(peek(), [TokenType.OPEN_PAREN, TokenType.FUNCTION, TokenType. OPEN_CURLY_BRACKET])) {
2054 validateModifiersForTopLevelFunction(modifiers); 2064 validateModifiersForTopLevelFunction(modifiers);
2055 return parseFunctionDeclaration(commentAndMetadata, modifiers.externalKeyw ord, returnType); 2065 return parseFunctionDeclaration(commentAndMetadata, modifiers.externalKeyw ord, returnType);
2056 } 2066 }
2057 return new TopLevelVariableDeclaration.full(commentAndMetadata.comment, comm entAndMetadata.metadata, parseVariableDeclarationList2(null, validateModifiersFo rTopLevelVariable(modifiers), returnType), expect2(TokenType.SEMICOLON)); 2067 return new TopLevelVariableDeclaration.full(commentAndMetadata.comment, comm entAndMetadata.metadata, parseVariableDeclarationList2(null, validateModifiersFo rTopLevelVariable(modifiers), returnType), expect2(TokenType.SEMICOLON));
2058 } 2068 }
2059 2069
2060 /** 2070 /**
2061 * Parse a conditional expression. 2071 * Parse a conditional expression.
(...skipping 3721 matching lines...) Expand 10 before | Expand all | Expand 10 after
5783 * The message template used to create the message to be displayed for this er ror. 5793 * The message template used to create the message to be displayed for this er ror.
5784 */ 5794 */
5785 String _message; 5795 String _message;
5786 5796
5787 /** 5797 /**
5788 * Initialize a newly created error code to have the given severity and messag e. 5798 * Initialize a newly created error code to have the given severity and messag e.
5789 * 5799 *
5790 * @param severity the severity of the error 5800 * @param severity the severity of the error
5791 * @param message the message template used to create the message to be displa yed for the error 5801 * @param message the message template used to create the message to be displa yed for the error
5792 */ 5802 */
5793 ParserErrorCode.con1(this.name, this.ordinal, ErrorSeverity severity2, String message2) { 5803 ParserErrorCode.con1(this.name, this.ordinal, ErrorSeverity severity, String m essage) {
5794 _jtd_constructor_316_impl(severity2, message2); 5804 this._severity = severity;
5795 } 5805 this._message = message;
5796 _jtd_constructor_316_impl(ErrorSeverity severity2, String message2) {
5797 this._severity = severity2;
5798 this._message = message2;
5799 } 5806 }
5800 5807
5801 /** 5808 /**
5802 * Initialize a newly created error code to have the given message and a sever ity of ERROR. 5809 * Initialize a newly created error code to have the given message and a sever ity of ERROR.
5803 * 5810 *
5804 * @param message the message template used to create the message to be displa yed for the error 5811 * @param message the message template used to create the message to be displa yed for the error
5805 */ 5812 */
5806 ParserErrorCode.con2(this.name, this.ordinal, String message) { 5813 ParserErrorCode.con2(String name, int ordinal, String message) : this.con1(nam e, ordinal, ErrorSeverity.ERROR, message);
5807 _jtd_constructor_317_impl(message);
5808 }
5809 _jtd_constructor_317_impl(String message) {
5810 _jtd_constructor_316_impl(ErrorSeverity.ERROR, message);
5811 }
5812 ErrorSeverity get errorSeverity => _severity; 5814 ErrorSeverity get errorSeverity => _severity;
5813 String get message => _message; 5815 String get message => _message;
5814 ErrorType get type => ErrorType.SYNTACTIC_ERROR; 5816 ErrorType get type => ErrorType.SYNTACTIC_ERROR;
5815 int compareTo(ParserErrorCode other) => ordinal - other.ordinal; 5817 int compareTo(ParserErrorCode other) => ordinal - other.ordinal;
5816 int get hashCode => ordinal; 5818 int get hashCode => ordinal;
5817 String toString() => name; 5819 String toString() => name;
5818 } 5820 }
5819 /** 5821 /**
5820 * Instances of the class {link ToFormattedSourceVisitor} write a source represe ntation of a visited 5822 * Instances of the class {link ToFormattedSourceVisitor} write a source represe ntation of a visited
5821 * AST node (and all of it's children) to a writer. 5823 * AST node (and all of it's children) to a writer.
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after
6719 for (int i = 0; i < size; i++) { 6721 for (int i = 0; i < size; i++) {
6720 if (i > 0) { 6722 if (i > 0) {
6721 _writer.print(separator); 6723 _writer.print(separator);
6722 } 6724 }
6723 nodes[i].accept(this); 6725 nodes[i].accept(this);
6724 } 6726 }
6725 } 6727 }
6726 } 6728 }
6727 } 6729 }
6728 } 6730 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698