| 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.body_builder; | 5 library fasta.body_builder; |
| 6 | 6 |
| 7 import 'package:kernel/ast.dart' | 7 import 'package:kernel/ast.dart' |
| 8 hide InvalidExpression, InvalidInitializer, InvalidStatement; | 8 hide InvalidExpression, InvalidInitializer, InvalidStatement; |
| 9 | 9 |
| 10 import 'package:kernel/class_hierarchy.dart' show ClassHierarchy; | 10 import 'package:kernel/class_hierarchy.dart' show ClassHierarchy; |
| (...skipping 2472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2483 | 2483 |
| 2484 @override | 2484 @override |
| 2485 void endLocalFunctionDeclaration(Token token) { | 2485 void endLocalFunctionDeclaration(Token token) { |
| 2486 debugEvent("LocalFunctionDeclaration"); | 2486 debugEvent("LocalFunctionDeclaration"); |
| 2487 Statement body = popStatement(); | 2487 Statement body = popStatement(); |
| 2488 AsyncMarker asyncModifier = pop(); | 2488 AsyncMarker asyncModifier = pop(); |
| 2489 if (functionNestingLevel != 0) { | 2489 if (functionNestingLevel != 0) { |
| 2490 exitLocalScope(); | 2490 exitLocalScope(); |
| 2491 } | 2491 } |
| 2492 FormalParameters formals = pop(); | 2492 FormalParameters formals = pop(); |
| 2493 List<TypeParameter> typeParameters = typeVariableBuildersToKernel(pop()); | |
| 2494 FunctionNode function = formals.addToFunction(new FunctionNode(body, | |
| 2495 typeParameters: typeParameters, asyncMarker: asyncModifier) | |
| 2496 ..fileOffset = formals.charOffset | |
| 2497 ..fileEndOffset = token.charOffset); | |
| 2498 exitLocalScope(); | 2493 exitLocalScope(); |
| 2499 var declaration = pop(); | 2494 var declaration = pop(); |
| 2500 var returnType = pop(); | 2495 var returnType = pop(); |
| 2501 var hasImplicitReturnType = returnType == null; | 2496 var hasImplicitReturnType = returnType == null; |
| 2502 returnType ??= const DynamicType(); | 2497 returnType ??= const DynamicType(); |
| 2503 pop(); // Modifiers. | 2498 pop(); // Modifiers. |
| 2504 exitFunction(); | 2499 exitFunction(); |
| 2500 List<TypeParameter> typeParameters = typeVariableBuildersToKernel(pop()); |
| 2501 FunctionNode function = formals.addToFunction(new FunctionNode(body, |
| 2502 typeParameters: typeParameters, asyncMarker: asyncModifier) |
| 2503 ..fileOffset = formals.charOffset |
| 2504 ..fileEndOffset = token.charOffset); |
| 2505 if (declaration is FunctionDeclaration) { | 2505 if (declaration is FunctionDeclaration) { |
| 2506 KernelFunctionDeclaration.setHasImplicitReturnType( | 2506 KernelFunctionDeclaration.setHasImplicitReturnType( |
| 2507 declaration, hasImplicitReturnType); | 2507 declaration, hasImplicitReturnType); |
| 2508 function.returnType = returnType; | 2508 function.returnType = returnType; |
| 2509 declaration.variable.type = function.functionType; | 2509 declaration.variable.type = function.functionType; |
| 2510 declaration.function = function; | 2510 declaration.function = function; |
| 2511 function.parent = declaration; | 2511 function.parent = declaration; |
| 2512 } else { | 2512 } else { |
| 2513 // If [declaration] isn't a [FunctionDeclaration], it must be because | 2513 // If [declaration] isn't a [FunctionDeclaration], it must be because |
| 2514 // there was a compile-time error. | 2514 // there was a compile-time error. |
| (...skipping 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3796 return AsyncMarker.Async; | 3796 return AsyncMarker.Async; |
| 3797 } else { | 3797 } else { |
| 3798 assert(identical(starToken.stringValue, "*")); | 3798 assert(identical(starToken.stringValue, "*")); |
| 3799 return AsyncMarker.AsyncStar; | 3799 return AsyncMarker.AsyncStar; |
| 3800 } | 3800 } |
| 3801 } else { | 3801 } else { |
| 3802 return unhandled(asyncToken.lexeme, "asyncMarkerFromTokens", | 3802 return unhandled(asyncToken.lexeme, "asyncMarkerFromTokens", |
| 3803 asyncToken.charOffset, null); | 3803 asyncToken.charOffset, null); |
| 3804 } | 3804 } |
| 3805 } | 3805 } |
| OLD | NEW |