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.outline_builder; | 5 library fasta.outline_builder; |
6 | 6 |
7 import 'package:kernel/ast.dart' show ProcedureKind; | 7 import 'package:kernel/ast.dart' show ProcedureKind; |
8 | 8 |
9 import '../fasta_codes.dart' show FastaMessage, codeExpectedBlockToSkip; | 9 import '../fasta_codes.dart' show Message, codeExpectedBlockToSkip; |
10 | 10 |
11 import '../parser/parser.dart' show FormalParameterType, MemberKind, optional; | 11 import '../parser/parser.dart' show FormalParameterType, MemberKind, optional; |
12 | 12 |
13 import '../parser/identifier_context.dart' show IdentifierContext; | 13 import '../parser/identifier_context.dart' show IdentifierContext; |
14 | 14 |
15 import '../../scanner/token.dart' show Token; | 15 import '../../scanner/token.dart' show Token; |
16 | 16 |
17 import '../util/link.dart' show Link; | 17 import '../util/link.dart' show Link; |
18 | 18 |
19 import '../combinator.dart' show Combinator; | 19 import '../combinator.dart' show Combinator; |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 String uri = pop(); | 149 String uri = pop(); |
150 List<MetadataBuilder> metadata = pop(); | 150 List<MetadataBuilder> metadata = pop(); |
151 if (uri != null) { | 151 if (uri != null) { |
152 library.addImport(metadata, uri, conditionalUris, prefix, combinators, | 152 library.addImport(metadata, uri, conditionalUris, prefix, combinators, |
153 deferredKeyword != null, importKeyword.charOffset, prefixOffset); | 153 deferredKeyword != null, importKeyword.charOffset, prefixOffset); |
154 } | 154 } |
155 checkEmpty(importKeyword.charOffset); | 155 checkEmpty(importKeyword.charOffset); |
156 } | 156 } |
157 | 157 |
158 @override | 158 @override |
159 void handleRecoverExpression(Token token, FastaMessage message) { | 159 void handleRecoverExpression(Token token, Message message) { |
160 debugEvent("RecoverExpression"); | 160 debugEvent("RecoverExpression"); |
161 push(NullValue.Expression); | 161 push(NullValue.Expression); |
162 push(token.charOffset); | 162 push(token.charOffset); |
163 } | 163 } |
164 | 164 |
165 @override | 165 @override |
166 void endPart(Token partKeyword, Token semicolon) { | 166 void endPart(Token partKeyword, Token semicolon) { |
167 debugEvent("Part"); | 167 debugEvent("Part"); |
168 int charOffset = popCharOffset(); | 168 int charOffset = popCharOffset(); |
169 String uri = pop(); | 169 String uri = pop(); |
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
832 push(new Modifier.fromString(token.stringValue)); | 832 push(new Modifier.fromString(token.stringValue)); |
833 } | 833 } |
834 | 834 |
835 @override | 835 @override |
836 void handleModifiers(int count) { | 836 void handleModifiers(int count) { |
837 debugEvent("Modifiers"); | 837 debugEvent("Modifiers"); |
838 push(popList(count) ?? NullValue.Modifiers); | 838 push(popList(count) ?? NullValue.Modifiers); |
839 } | 839 } |
840 | 840 |
841 @override | 841 @override |
842 void handleRecoverableError(Token token, FastaMessage message) { | 842 void handleRecoverableError(Token token, Message message) { |
843 if (silenceParserErrors) { | 843 if (silenceParserErrors) { |
844 debugEvent("RecoverableError"); | 844 debugEvent("RecoverableError"); |
845 } else { | 845 } else { |
846 super.handleRecoverableError(token, message); | 846 super.handleRecoverableError(token, message); |
847 } | 847 } |
848 } | 848 } |
849 | 849 |
850 @override | 850 @override |
851 Token handleUnrecoverableError(Token token, FastaMessage message) { | 851 Token handleUnrecoverableError(Token token, Message message) { |
852 if (enableNative && message.code == codeExpectedBlockToSkip) { | 852 if (enableNative && message.code == codeExpectedBlockToSkip) { |
853 var target = library.loader.target; | 853 var target = library.loader.target; |
854 Token recover = target.skipNativeClause(token); | 854 Token recover = target.skipNativeClause(token); |
855 if (recover != null) { | 855 if (recover != null) { |
856 nativeMethodName = target.extractNativeMethodName(token); | 856 nativeMethodName = target.extractNativeMethodName(token); |
857 return recover; | 857 return recover; |
858 } | 858 } |
859 } | 859 } |
860 return super.handleUnrecoverableError(token, message); | 860 return super.handleUnrecoverableError(token, message); |
861 } | 861 } |
862 | 862 |
863 @override | 863 @override |
864 void addCompileTimeErrorFromMessage(FastaMessage message) { | 864 void addCompileTimeError(Message message, int charOffset) { |
865 library.deprecated_addCompileTimeError(message.charOffset, message.message, | 865 library.deprecated_addCompileTimeError(charOffset, message.message, |
866 fileUri: message.uri); | 866 fileUri: uri); |
867 } | 867 } |
868 | 868 |
869 @override | 869 @override |
870 Link<Token> handleMemberName(Link<Token> identifiers) { | 870 Link<Token> handleMemberName(Link<Token> identifiers) { |
871 if (!enableNative || identifiers.isEmpty) return identifiers; | 871 if (!enableNative || identifiers.isEmpty) return identifiers; |
872 return removeNativeClause(identifiers); | 872 return removeNativeClause(identifiers); |
873 } | 873 } |
874 | 874 |
875 @override | 875 @override |
876 void debugEvent(String name) { | 876 void debugEvent(String name) { |
877 // printEvent(name); | 877 // printEvent(name); |
878 } | 878 } |
879 } | 879 } |
OLD | NEW |