| OLD | NEW |
| 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 | 4 |
| 5 library fasta.analyzer.ast_builder; | 5 library fasta.analyzer.ast_builder; |
| 6 | 6 |
| 7 import 'package:analyzer/analyzer.dart'; | 7 import 'package:analyzer/analyzer.dart'; |
| 8 import 'package:analyzer/dart/ast/ast_factory.dart' show AstFactory; | 8 import 'package:analyzer/dart/ast/ast_factory.dart' show AstFactory; |
| 9 import 'package:analyzer/dart/ast/standard_ast_factory.dart' as standard; | 9 import 'package:analyzer/dart/ast/standard_ast_factory.dart' as standard; |
| 10 import 'package:analyzer/dart/ast/token.dart' show Token, TokenType; | 10 import 'package:analyzer/dart/ast/token.dart' show Token, TokenType; |
| (...skipping 1906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1917 ParserErrorCode.NATIVE_CLAUSE_SHOULD_BE_ANNOTATION, | 1917 ParserErrorCode.NATIVE_CLAUSE_SHOULD_BE_ANNOTATION, |
| 1918 charOffset, | 1918 charOffset, |
| 1919 1); | 1919 1); |
| 1920 } | 1920 } |
| 1921 return; | 1921 return; |
| 1922 case "EXPECTED_STRING_LITERAL": | 1922 case "EXPECTED_STRING_LITERAL": |
| 1923 errorReporter?.reportErrorForOffset( | 1923 errorReporter?.reportErrorForOffset( |
| 1924 ParserErrorCode.EXPECTED_STRING_LITERAL, charOffset, 1); | 1924 ParserErrorCode.EXPECTED_STRING_LITERAL, charOffset, 1); |
| 1925 return; | 1925 return; |
| 1926 case "UNEXPECTED_TOKEN": | 1926 case "UNEXPECTED_TOKEN": |
| 1927 var text = arguments['string']; | 1927 String text = arguments['string']; |
| 1928 if (text == null) { | 1928 if (text == null) { |
| 1929 Token token = arguments['token']; | 1929 Token token = arguments['token']; |
| 1930 if (token != null) { | 1930 if (token != null) { |
| 1931 text = token.lexeme; | 1931 text = token.lexeme; |
| 1932 } | 1932 } |
| 1933 } | 1933 } |
| 1934 errorReporter?.reportErrorForOffset( | 1934 if (text == ';') { |
| 1935 ParserErrorCode.UNEXPECTED_TOKEN, charOffset, 1, [text]); | 1935 errorReporter?.reportErrorForOffset( |
| 1936 ParserErrorCode.EXPECTED_TOKEN, charOffset, text.length, [text]); |
| 1937 } else { |
| 1938 errorReporter?.reportErrorForOffset( |
| 1939 ParserErrorCode.UNEXPECTED_TOKEN, charOffset, 1, [text]); |
| 1940 } |
| 1936 return; | 1941 return; |
| 1937 default: | 1942 default: |
| 1938 // fall through | 1943 // fall through |
| 1939 } | 1944 } |
| 1940 library.addCompileTimeError(message, charOffset, uri); | 1945 library.addCompileTimeError(message, charOffset, uri); |
| 1941 } | 1946 } |
| 1942 } | 1947 } |
| 1943 | 1948 |
| 1944 /// Data structure placed on the stack to represent a class body. | 1949 /// Data structure placed on the stack to represent a class body. |
| 1945 /// | 1950 /// |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2039 } else if (identical('var', s)) { | 2044 } else if (identical('var', s)) { |
| 2040 finalConstOrVarKeyword = token; | 2045 finalConstOrVarKeyword = token; |
| 2041 } else if (identical('covariant', s)) { | 2046 } else if (identical('covariant', s)) { |
| 2042 covariantKeyword = token; | 2047 covariantKeyword = token; |
| 2043 } else { | 2048 } else { |
| 2044 unhandled("$s", "modifier", token.charOffset, null); | 2049 unhandled("$s", "modifier", token.charOffset, null); |
| 2045 } | 2050 } |
| 2046 } | 2051 } |
| 2047 } | 2052 } |
| 2048 } | 2053 } |
| OLD | NEW |