| 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 AsyncMarker, ProcedureKind; | 7 import 'package:kernel/ast.dart' show AsyncMarker, ProcedureKind; |
| 8 | 8 |
| 9 import '../parser/parser.dart' show FormalParameterType, optional; | 9 import '../parser/parser.dart' show FormalParameterType, optional; |
| 10 | 10 |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 void endLibraryName(Token libraryKeyword, Token semicolon) { | 192 void endLibraryName(Token libraryKeyword, Token semicolon) { |
| 193 debugEvent("endLibraryName"); | 193 debugEvent("endLibraryName"); |
| 194 String name = pop(); | 194 String name = pop(); |
| 195 List<MetadataBuilder> metadata = pop(); | 195 List<MetadataBuilder> metadata = pop(); |
| 196 library.name = name; | 196 library.name = name; |
| 197 library.metadata = metadata; | 197 library.metadata = metadata; |
| 198 } | 198 } |
| 199 | 199 |
| 200 @override | 200 @override |
| 201 void beginClassDeclaration(Token begin, Token name) { | 201 void beginClassDeclaration(Token begin, Token name) { |
| 202 library.beginNestedDeclaration(name.value); | 202 library.beginNestedDeclaration(name.lexeme); |
| 203 } | 203 } |
| 204 | 204 |
| 205 @override | 205 @override |
| 206 void endClassDeclaration( | 206 void endClassDeclaration( |
| 207 int interfacesCount, | 207 int interfacesCount, |
| 208 Token beginToken, | 208 Token beginToken, |
| 209 Token classKeyword, | 209 Token classKeyword, |
| 210 Token extendsKeyword, | 210 Token extendsKeyword, |
| 211 Token implementsKeyword, | 211 Token implementsKeyword, |
| 212 Token endToken) { | 212 Token endToken) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 223 List<MetadataBuilder> metadata = pop(); | 223 List<MetadataBuilder> metadata = pop(); |
| 224 library.addClass(metadata, modifiers, name, typeVariables, supertype, | 224 library.addClass(metadata, modifiers, name, typeVariables, supertype, |
| 225 interfaces, beginToken.charOffset); | 225 interfaces, beginToken.charOffset); |
| 226 checkEmpty(beginToken.charOffset); | 226 checkEmpty(beginToken.charOffset); |
| 227 } | 227 } |
| 228 | 228 |
| 229 ProcedureKind computeProcedureKind(Token token) { | 229 ProcedureKind computeProcedureKind(Token token) { |
| 230 if (token == null) return ProcedureKind.Method; | 230 if (token == null) return ProcedureKind.Method; |
| 231 if (optional("get", token)) return ProcedureKind.Getter; | 231 if (optional("get", token)) return ProcedureKind.Getter; |
| 232 if (optional("set", token)) return ProcedureKind.Setter; | 232 if (optional("set", token)) return ProcedureKind.Setter; |
| 233 return internalError("Unhandled: ${token.value}"); | 233 return internalError("Unhandled: ${token.lexeme}"); |
| 234 } | 234 } |
| 235 | 235 |
| 236 @override | 236 @override |
| 237 void beginTopLevelMethod(Token token, Token name) { | 237 void beginTopLevelMethod(Token token, Token name) { |
| 238 library.beginNestedDeclaration(name.value, hasMembers: false); | 238 library.beginNestedDeclaration(name.lexeme, hasMembers: false); |
| 239 } | 239 } |
| 240 | 240 |
| 241 @override | 241 @override |
| 242 void endTopLevelMethod(Token beginToken, Token getOrSet, Token endToken) { | 242 void endTopLevelMethod(Token beginToken, Token getOrSet, Token endToken) { |
| 243 debugEvent("endTopLevelMethod"); | 243 debugEvent("endTopLevelMethod"); |
| 244 MethodBody kind = pop(); | 244 MethodBody kind = pop(); |
| 245 AsyncMarker asyncModifier = pop(); | 245 AsyncMarker asyncModifier = pop(); |
| 246 List<FormalParameterBuilder> formals = pop(); | 246 List<FormalParameterBuilder> formals = pop(); |
| 247 List<TypeVariableBuilder> typeVariables = pop(); | 247 List<TypeVariableBuilder> typeVariables = pop(); |
| 248 String name = pop(); | 248 String name = pop(); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 274 } | 274 } |
| 275 | 275 |
| 276 @override | 276 @override |
| 277 void handleFunctionBodySkipped(Token token) { | 277 void handleFunctionBodySkipped(Token token) { |
| 278 debugEvent("handleFunctionBodySkipped"); | 278 debugEvent("handleFunctionBodySkipped"); |
| 279 push(MethodBody.Regular); | 279 push(MethodBody.Regular); |
| 280 } | 280 } |
| 281 | 281 |
| 282 @override | 282 @override |
| 283 void beginMethod(Token token, Token name) { | 283 void beginMethod(Token token, Token name) { |
| 284 library.beginNestedDeclaration(name.value, hasMembers: false); | 284 library.beginNestedDeclaration(name.lexeme, hasMembers: false); |
| 285 } | 285 } |
| 286 | 286 |
| 287 @override | 287 @override |
| 288 void endMethod(Token getOrSet, Token beginToken, Token endToken) { | 288 void endMethod(Token getOrSet, Token beginToken, Token endToken) { |
| 289 debugEvent("Method"); | 289 debugEvent("Method"); |
| 290 MethodBody bodyKind = pop(); | 290 MethodBody bodyKind = pop(); |
| 291 if (bodyKind == MethodBody.RedirectingFactoryBody) { | 291 if (bodyKind == MethodBody.RedirectingFactoryBody) { |
| 292 // This will cause an error later. | 292 // This will cause an error later. |
| 293 pop(); | 293 pop(); |
| 294 } | 294 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 @override | 331 @override |
| 332 void endMixinApplication(Token withKeyword) { | 332 void endMixinApplication(Token withKeyword) { |
| 333 debugEvent("MixinApplication"); | 333 debugEvent("MixinApplication"); |
| 334 List<TypeBuilder> mixins = pop(); | 334 List<TypeBuilder> mixins = pop(); |
| 335 TypeBuilder supertype = pop(); | 335 TypeBuilder supertype = pop(); |
| 336 push(library.addMixinApplication(supertype, mixins, -1)); | 336 push(library.addMixinApplication(supertype, mixins, -1)); |
| 337 } | 337 } |
| 338 | 338 |
| 339 @override | 339 @override |
| 340 void beginNamedMixinApplication(Token begin, Token name) { | 340 void beginNamedMixinApplication(Token begin, Token name) { |
| 341 library.beginNestedDeclaration(name.value, hasMembers: false); | 341 library.beginNestedDeclaration(name.lexeme, hasMembers: false); |
| 342 } | 342 } |
| 343 | 343 |
| 344 @override | 344 @override |
| 345 void endNamedMixinApplication(Token beginToken, Token classKeyword, | 345 void endNamedMixinApplication(Token beginToken, Token classKeyword, |
| 346 Token equals, Token implementsKeyword, Token endToken) { | 346 Token equals, Token implementsKeyword, Token endToken) { |
| 347 debugEvent("endNamedMixinApplication"); | 347 debugEvent("endNamedMixinApplication"); |
| 348 List<TypeBuilder> interfaces = popIfNotNull(implementsKeyword); | 348 List<TypeBuilder> interfaces = popIfNotNull(implementsKeyword); |
| 349 TypeBuilder mixinApplication = pop(); | 349 TypeBuilder mixinApplication = pop(); |
| 350 List<TypeVariableBuilder> typeVariables = pop(); | 350 List<TypeVariableBuilder> typeVariables = pop(); |
| 351 String name = pop(); | 351 String name = pop(); |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 void handleModifiers(int count) { | 681 void handleModifiers(int count) { |
| 682 debugEvent("Modifiers"); | 682 debugEvent("Modifiers"); |
| 683 push(popList(count) ?? NullValue.Modifiers); | 683 push(popList(count) ?? NullValue.Modifiers); |
| 684 } | 684 } |
| 685 | 685 |
| 686 @override | 686 @override |
| 687 Token handleUnrecoverableError(Token token, ErrorKind kind, Map arguments) { | 687 Token handleUnrecoverableError(Token token, ErrorKind kind, Map arguments) { |
| 688 if (isDartLibrary && kind == ErrorKind.ExpectedBlockToSkip) { | 688 if (isDartLibrary && kind == ErrorKind.ExpectedBlockToSkip) { |
| 689 Token recover = skipNativeClause(token); | 689 Token recover = skipNativeClause(token); |
| 690 if (recover != null) { | 690 if (recover != null) { |
| 691 nativeMethodName = unescapeString(token.next.value); | 691 nativeMethodName = unescapeString(token.next.lexeme); |
| 692 return recover; | 692 return recover; |
| 693 } | 693 } |
| 694 } | 694 } |
| 695 return super.handleUnrecoverableError(token, kind, arguments); | 695 return super.handleUnrecoverableError(token, kind, arguments); |
| 696 } | 696 } |
| 697 | 697 |
| 698 @override | 698 @override |
| 699 Link<Token> handleMemberName(Link<Token> identifiers) { | 699 Link<Token> handleMemberName(Link<Token> identifiers) { |
| 700 if (!isDartLibrary || identifiers.isEmpty) return identifiers; | 700 if (!isDartLibrary || identifiers.isEmpty) return identifiers; |
| 701 return removeNativeClause(identifiers); | 701 return removeNativeClause(identifiers); |
| 702 } | 702 } |
| 703 | 703 |
| 704 @override | 704 @override |
| 705 void debugEvent(String name) { | 705 void debugEvent(String name) { |
| 706 // printEvent(name); | 706 // printEvent(name); |
| 707 } | 707 } |
| 708 } | 708 } |
| OLD | NEW |