| 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 | 7 import 'package:kernel/ast.dart' show |
| 8 AsyncMarker, | 8 AsyncMarker, |
| 9 ProcedureKind; | 9 ProcedureKind; |
| 10 | 10 |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 } | 203 } |
| 204 | 204 |
| 205 ProcedureKind computeProcedureKind(Token token) { | 205 ProcedureKind computeProcedureKind(Token token) { |
| 206 if (token == null) return ProcedureKind.Method; | 206 if (token == null) return ProcedureKind.Method; |
| 207 if (optional("get", token)) return ProcedureKind.Getter; | 207 if (optional("get", token)) return ProcedureKind.Getter; |
| 208 if (optional("set", token)) return ProcedureKind.Setter; | 208 if (optional("set", token)) return ProcedureKind.Setter; |
| 209 return internalError("Unhandled: ${token.value}"); | 209 return internalError("Unhandled: ${token.value}"); |
| 210 } | 210 } |
| 211 | 211 |
| 212 @override | 212 @override |
| 213 void beginTopLevelMethod(Token token, Token name) { |
| 214 library.beginNestedScope(hasMembers: false); |
| 215 } |
| 216 |
| 217 @override |
| 213 ProcedureBuilder endTopLevelMethod( | 218 ProcedureBuilder endTopLevelMethod( |
| 214 Token beginToken, Token getOrSet, Token endToken) { | 219 Token beginToken, Token getOrSet, Token endToken) { |
| 215 debugEvent("endTopLevelMethod"); | 220 debugEvent("endTopLevelMethod"); |
| 216 MethodBody kind = pop(); | 221 MethodBody kind = pop(); |
| 217 AsyncMarker asyncModifier = pop(); | 222 AsyncMarker asyncModifier = pop(); |
| 218 List<FormalParameterBuilder> formals = pop(); | 223 List<FormalParameterBuilder> formals = pop(); |
| 219 List<TypeVariableBuilder> typeVariables = pop(); | 224 List<TypeVariableBuilder> typeVariables = pop(); |
| 220 String name = pop(); | 225 String name = pop(); |
| 221 TypeBuilder returnType = pop(); | 226 TypeBuilder returnType = pop(); |
| 222 int modifiers = Modifier.validate(pop(), | 227 int modifiers = Modifier.validate(pop(), |
| (...skipping 10 matching lines...) Expand all Loading... |
| 233 push(MethodBody.Abstract); | 238 push(MethodBody.Abstract); |
| 234 } | 239 } |
| 235 | 240 |
| 236 @override | 241 @override |
| 237 void handleFunctionBodySkipped(Token token) { | 242 void handleFunctionBodySkipped(Token token) { |
| 238 debugEvent("handleFunctionBodySkipped"); | 243 debugEvent("handleFunctionBodySkipped"); |
| 239 push(MethodBody.Regular); | 244 push(MethodBody.Regular); |
| 240 } | 245 } |
| 241 | 246 |
| 242 @override | 247 @override |
| 248 void beginMethod(Token token, Token name) { |
| 249 library.beginNestedScope(hasMembers: false); |
| 250 } |
| 251 |
| 252 @override |
| 243 void endMethod(Token getOrSet, Token beginToken, Token endToken) { | 253 void endMethod(Token getOrSet, Token beginToken, Token endToken) { |
| 244 debugEvent("Method"); | 254 debugEvent("Method"); |
| 245 MethodBody kind = pop(); | 255 MethodBody kind = pop(); |
| 246 if (kind == MethodBody.RedirectingFactoryBody) { | 256 if (kind == MethodBody.RedirectingFactoryBody) { |
| 247 // This will cause an error later. | 257 // This will cause an error later. |
| 248 pop(); | 258 pop(); |
| 249 } | 259 } |
| 250 AsyncMarker asyncModifier = pop(); | 260 AsyncMarker asyncModifier = pop(); |
| 251 List<FormalParameterBuilder> formals = pop(); | 261 List<FormalParameterBuilder> formals = pop(); |
| 252 List<TypeVariableBuilder> typeVariables = pop(); | 262 List<TypeVariableBuilder> typeVariables = pop(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 265 @override | 275 @override |
| 266 void endMixinApplication() { | 276 void endMixinApplication() { |
| 267 debugEvent("MixinApplication"); | 277 debugEvent("MixinApplication"); |
| 268 List<TypeBuilder> mixins = pop(); | 278 List<TypeBuilder> mixins = pop(); |
| 269 TypeBuilder supertype = pop(); | 279 TypeBuilder supertype = pop(); |
| 270 push(library.addMixinApplication(supertype, mixins)); | 280 push(library.addMixinApplication(supertype, mixins)); |
| 271 } | 281 } |
| 272 | 282 |
| 273 @override | 283 @override |
| 274 void beginNamedMixinApplication(Token token) { | 284 void beginNamedMixinApplication(Token token) { |
| 275 library.beginNestedScope(); | 285 library.beginNestedScope(hasMembers: false); |
| 276 } | 286 } |
| 277 | 287 |
| 278 @override | 288 @override |
| 279 void endNamedMixinApplication( | 289 void endNamedMixinApplication( |
| 280 Token classKeyword, Token implementsKeyword, Token endToken) { | 290 Token classKeyword, Token implementsKeyword, Token endToken) { |
| 281 debugEvent("endNamedMixinApplication"); | 291 debugEvent("endNamedMixinApplication"); |
| 282 List<TypeBuilder> interfaces = popIfNotNull(implementsKeyword); | 292 List<TypeBuilder> interfaces = popIfNotNull(implementsKeyword); |
| 283 TypeBuilder mixinApplication = pop(); | 293 TypeBuilder mixinApplication = pop(); |
| 284 List<TypeVariableBuilder> typeVariables = pop(); | 294 List<TypeVariableBuilder> typeVariables = pop(); |
| 285 String name = pop(); | 295 String name = pop(); |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 Link<Token> handleMemberName(Link<Token> identifiers) { | 561 Link<Token> handleMemberName(Link<Token> identifiers) { |
| 552 if (!isDartLibrary || identifiers.isEmpty) return identifiers; | 562 if (!isDartLibrary || identifiers.isEmpty) return identifiers; |
| 553 return removeNativeClause(identifiers); | 563 return removeNativeClause(identifiers); |
| 554 } | 564 } |
| 555 | 565 |
| 556 @override | 566 @override |
| 557 void debugEvent(String name) { | 567 void debugEvent(String name) { |
| 558 // printEvent(name); | 568 // printEvent(name); |
| 559 } | 569 } |
| 560 } | 570 } |
| OLD | NEW |