Skip to content

Commit

Permalink
Solve special case of previous fix
Browse files Browse the repository at this point in the history
The case when the lambda function is not declared within a class.
  • Loading branch information
roberthusak committed Nov 29, 2017
1 parent ab70477 commit 7250b75
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Peachpie.CodeAnalysis/CodeGen/CodeGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,10 @@ internal void BlockGenerated(BoundBlock block)
/// <summary>
/// Type of the caller context (the class declaring current method) or null.
/// </summary>
public TypeSymbol CallerType => (_routine is SourceMethodSymbol || _routine is SourceLambdaSymbol) ? _routine.ContainingType : null;
public TypeSymbol CallerType =>
(_routine is SourceMethodSymbol) ? _routine.ContainingType :
(_routine is SourceLambdaSymbol) ? _routine.ContainingType as SourceTypeSymbol :

This comment has been minimized.

Copy link
@jakubmisek

jakubmisek Nov 29, 2017

Member

Not correct, would disallow runtime scope change
#96

This comment has been minimized.

Copy link
@roberthusak

roberthusak Nov 29, 2017

Author Contributor

I see.. created issue #114 to target the problem this fix was aimed at. Can I keep it as a workaround in this branch for the time being, until there's a better solution?

This comment has been minimized.

Copy link
@roberthusak

roberthusak Dec 12, 2017

Author Contributor

Reverted in 7bff730.

null;

public SourceFileSymbol ContainingFile => _containingFile;
SourceFileSymbol _containingFile;
Expand Down

0 comments on commit 7250b75

Please sign in to comment.