@@ -22,7 +22,7 @@ private void VisitParameter(ParameterSyntax p)
22
22
Parameter . Create ( Context , symbol , this ) ;
23
23
}
24
24
25
- private Lambda ( ExpressionNodeInfo info , CSharpSyntaxNode body , IEnumerable < ParameterSyntax > @params )
25
+ private Lambda ( ExpressionNodeInfo info , CSharpSyntaxNode body , IEnumerable < ParameterSyntax > @params , TypeSyntax ? @return )
26
26
: base ( info )
27
27
{
28
28
if ( Context . GetModel ( info . Node ) . GetSymbolInfo ( info . Node ) . Symbol is IMethodSymbol symbol )
@@ -40,6 +40,13 @@ private Lambda(ExpressionNodeInfo info, CSharpSyntaxNode body, IEnumerable<Param
40
40
foreach ( var param in @params )
41
41
VisitParameter ( param ) ;
42
42
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
+ }
43
50
if ( body is ExpressionSyntax exprBody )
44
51
Create ( Context , exprBody , this , 0 ) ;
45
52
else if ( body is BlockSyntax blockBody )
@@ -50,17 +57,17 @@ private Lambda(ExpressionNodeInfo info, CSharpSyntaxNode body, IEnumerable<Param
50
57
}
51
58
52
59
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 ) { }
54
61
55
62
public static Lambda Create ( ExpressionNodeInfo info , ParenthesizedLambdaExpressionSyntax node ) => new Lambda ( info , node ) ;
56
63
57
64
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 ) { }
59
66
60
67
public static Lambda Create ( ExpressionNodeInfo info , SimpleLambdaExpressionSyntax node ) => new Lambda ( info , node ) ;
61
68
62
69
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 )
64
71
{ }
65
72
66
73
public static Lambda Create ( ExpressionNodeInfo info , AnonymousMethodExpressionSyntax node ) => new Lambda ( info , node ) ;
0 commit comments