|
|
@ -235,29 +235,6 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver |
|
|
|
return new CSharpResolver(compilation, conversions, context, checkForOverflow, isWithinLambdaExpression, currentTypeDefinitionCache, stack, objectInitializerStack); |
|
|
|
return new CSharpResolver(compilation, conversions, context, checkForOverflow, isWithinLambdaExpression, currentTypeDefinitionCache, stack, objectInitializerStack); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Opens a new scope for local variables.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
public CSharpResolver PushBlock() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return WithLocalVariableStack(localVariableStack.Push(null)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Closes the current scope for local variables; removing all variables in that scope.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
public CSharpResolver PopBlock() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
var stack = localVariableStack; |
|
|
|
|
|
|
|
IVariable removedVar; |
|
|
|
|
|
|
|
do |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
removedVar = stack.Peek(); |
|
|
|
|
|
|
|
stack = stack.Pop(); |
|
|
|
|
|
|
|
} while (removedVar != null); |
|
|
|
|
|
|
|
return WithLocalVariableStack(stack); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Adds a new variable or lambda parameter to the current block.
|
|
|
|
/// Adds a new variable or lambda parameter to the current block.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
@ -268,16 +245,6 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver |
|
|
|
return WithLocalVariableStack(localVariableStack.Push(variable)); |
|
|
|
return WithLocalVariableStack(localVariableStack.Push(variable)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Removes the variable that was just added.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
public CSharpResolver PopLastVariable() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (localVariableStack.Peek() == null) |
|
|
|
|
|
|
|
throw new InvalidOperationException("There is no variable within the current block."); |
|
|
|
|
|
|
|
return WithLocalVariableStack(localVariableStack.Pop()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Gets all currently visible local variables and lambda parameters.
|
|
|
|
/// Gets all currently visible local variables and lambda parameters.
|
|
|
|
/// Does not include method parameters.
|
|
|
|
/// Does not include method parameters.
|
|
|
|