@@ -22,7 +22,7 @@ private void VisitParameter(ParameterSyntax p)
2222 Parameter . Create ( Context , symbol , this ) ;
2323 }
2424
25- private Lambda ( ExpressionNodeInfo info , CSharpSyntaxNode body , IEnumerable < ParameterSyntax > @params )
25+ private Lambda ( ExpressionNodeInfo info , CSharpSyntaxNode body , IEnumerable < ParameterSyntax > @params , TypeSyntax ? @return )
2626 : base ( info )
2727 {
2828 if ( Context . GetModel ( info . Node ) . GetSymbolInfo ( info . Node ) . Symbol is IMethodSymbol symbol )
@@ -40,6 +40,13 @@ private Lambda(ExpressionNodeInfo info, CSharpSyntaxNode body, IEnumerable<Param
4040 foreach ( var param in @params )
4141 VisitParameter ( param ) ;
4242
43+ if ( @return is not null )
44+ {
45+ var symbol = Context . GetType ( @return ) ;
46+ var type = Entities . Type . Create ( Context , symbol ) ;
47+ var trapFile = Context . TrapWriter . Writer ;
48+ trapFile . lambda_expr_return_type ( this , type . TypeRef ) ;
49+ }
4350 if ( body is ExpressionSyntax exprBody )
4451 Create ( Context , exprBody , this , 0 ) ;
4552 else if ( body is BlockSyntax blockBody )
@@ -50,17 +57,17 @@ private Lambda(ExpressionNodeInfo info, CSharpSyntaxNode body, IEnumerable<Param
5057 }
5158
5259 private Lambda ( ExpressionNodeInfo info , ParenthesizedLambdaExpressionSyntax node )
53- : this ( info . SetKind ( ExprKind . LAMBDA ) , node . Body , node . ParameterList . Parameters ) { }
60+ : this ( info . SetKind ( ExprKind . LAMBDA ) , node . Body , node . ParameterList . Parameters , node . ReturnType ) { }
5461
5562 public static Lambda Create ( ExpressionNodeInfo info , ParenthesizedLambdaExpressionSyntax node ) => new Lambda ( info , node ) ;
5663
5764 private Lambda ( ExpressionNodeInfo info , SimpleLambdaExpressionSyntax node )
58- : this ( info . SetKind ( ExprKind . LAMBDA ) , node . Body , Enumerators . Singleton ( node . Parameter ) ) { }
65+ : this ( info . SetKind ( ExprKind . LAMBDA ) , node . Body , Enumerators . Singleton ( node . Parameter ) , null ) { }
5966
6067 public static Lambda Create ( ExpressionNodeInfo info , SimpleLambdaExpressionSyntax node ) => new Lambda ( info , node ) ;
6168
6269 private Lambda ( ExpressionNodeInfo info , AnonymousMethodExpressionSyntax node ) :
63- this ( info . SetKind ( ExprKind . ANONYMOUS_METHOD ) , node . Body , node . ParameterList is null ? Enumerable . Empty < ParameterSyntax > ( ) : node . ParameterList . Parameters )
70+ this ( info . SetKind ( ExprKind . ANONYMOUS_METHOD ) , node . Body , node . ParameterList is null ? Enumerable . Empty < ParameterSyntax > ( ) : node . ParameterList . Parameters , null )
6471 { }
6572
6673 public static Lambda Create ( ExpressionNodeInfo info , AnonymousMethodExpressionSyntax node ) => new Lambda ( info , node ) ;
0 commit comments