| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 /// This file declares a "shadow hierarchy" of concrete classes which extend | 5 /// This file declares a "shadow hierarchy" of concrete classes which extend |
| 6 /// the kernel class hierarchy, adding methods and fields needed by the | 6 /// the kernel class hierarchy, adding methods and fields needed by the |
| 7 /// BodyBuilder. | 7 /// BodyBuilder. |
| 8 /// | 8 /// |
| 9 /// Instances of these classes may be created using the factory methods in | 9 /// Instances of these classes may be created using the factory methods in |
| 10 /// `ast_factory.dart`. | 10 /// `ast_factory.dart`. |
| (...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 800 implements KernelStatement { | 800 implements KernelStatement { |
| 801 bool _hasImplicitReturnType = false; | 801 bool _hasImplicitReturnType = false; |
| 802 | 802 |
| 803 KernelFunctionDeclaration(VariableDeclaration variable, FunctionNode function) | 803 KernelFunctionDeclaration(VariableDeclaration variable, FunctionNode function) |
| 804 : super(variable, function); | 804 : super(variable, function); |
| 805 | 805 |
| 806 @override | 806 @override |
| 807 void _inferStatement(KernelTypeInferrer inferrer) { | 807 void _inferStatement(KernelTypeInferrer inferrer) { |
| 808 inferrer.listener.functionDeclarationEnter(this); | 808 inferrer.listener.functionDeclarationEnter(this); |
| 809 inferrer.inferLocalFunction(function, null, false, fileOffset, | 809 inferrer.inferLocalFunction(function, null, false, fileOffset, |
| 810 _hasImplicitReturnType ? null : function.returnType, true); | 810 _hasImplicitReturnType ? null : function.returnType); |
| 811 variable.type = function.functionType; | 811 variable.type = function.functionType; |
| 812 inferrer.listener.functionDeclarationExit(this); | 812 inferrer.listener.functionDeclarationExit(this); |
| 813 } | 813 } |
| 814 | 814 |
| 815 static void setHasImplicitReturnType( | 815 static void setHasImplicitReturnType( |
| 816 KernelFunctionDeclaration declaration, bool hasImplicitReturnType) { | 816 KernelFunctionDeclaration declaration, bool hasImplicitReturnType) { |
| 817 declaration._hasImplicitReturnType = hasImplicitReturnType; | 817 declaration._hasImplicitReturnType = hasImplicitReturnType; |
| 818 } | 818 } |
| 819 } | 819 } |
| 820 | 820 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 844 collector.recordNotImmediatelyEvident(fileOffset); | 844 collector.recordNotImmediatelyEvident(fileOffset); |
| 845 } | 845 } |
| 846 } | 846 } |
| 847 | 847 |
| 848 @override | 848 @override |
| 849 DartType _inferExpression( | 849 DartType _inferExpression( |
| 850 KernelTypeInferrer inferrer, DartType typeContext, bool typeNeeded) { | 850 KernelTypeInferrer inferrer, DartType typeContext, bool typeNeeded) { |
| 851 typeNeeded = inferrer.listener.functionExpressionEnter(this, typeContext) || | 851 typeNeeded = inferrer.listener.functionExpressionEnter(this, typeContext) || |
| 852 typeNeeded; | 852 typeNeeded; |
| 853 var inferredType = inferrer.inferLocalFunction( | 853 var inferredType = inferrer.inferLocalFunction( |
| 854 function, typeContext, typeNeeded, fileOffset, null, false); | 854 function, typeContext, typeNeeded, fileOffset, null); |
| 855 inferrer.listener.functionExpressionExit(this, inferredType); | 855 inferrer.listener.functionExpressionExit(this, inferredType); |
| 856 return inferredType; | 856 return inferredType; |
| 857 } | 857 } |
| 858 } | 858 } |
| 859 | 859 |
| 860 /// Concrete shadow object representing an if-null expression. | 860 /// Concrete shadow object representing an if-null expression. |
| 861 /// | 861 /// |
| 862 /// An if-null expression of the form `a ?? b` is represented as the kernel | 862 /// An if-null expression of the form `a ?? b` is represented as the kernel |
| 863 /// expression: | 863 /// expression: |
| 864 /// | 864 /// |
| (...skipping 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2357 } | 2357 } |
| 2358 | 2358 |
| 2359 transformChildren(v) { | 2359 transformChildren(v) { |
| 2360 return internalError("Internal error: Unsupported operation."); | 2360 return internalError("Internal error: Unsupported operation."); |
| 2361 } | 2361 } |
| 2362 | 2362 |
| 2363 visitChildren(v) { | 2363 visitChildren(v) { |
| 2364 return internalError("Internal error: Unsupported operation."); | 2364 return internalError("Internal error: Unsupported operation."); |
| 2365 } | 2365 } |
| 2366 } | 2366 } |
| OLD | NEW |