提交 f63640d2 编写于 作者: C ChuckStoner

Added LocalSymbol.CanScheduleToStack property (changeset 1342014)

上级 97ce79c8
......@@ -1592,8 +1592,7 @@ private void RecordVarWrite(LocalSymbol local)
private static bool CanScheduleToStack(LocalSymbol local)
{
// cannot schedule constants and pinned locals
return !(local.IsConst || local.IsPinned);
return local.CanScheduleToStack;
}
private void DeclareLocals(ImmutableArray<LocalSymbol> locals, int stack)
......
......@@ -23,6 +23,11 @@ protected LocalSymbol()
get;
}
internal virtual bool CanScheduleToStack
{
get { return !IsConst && !IsPinned; }
}
internal abstract SyntaxToken IdentifierToken
{
get;
......
......@@ -1169,9 +1169,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGen
End Sub
Private Shared Function CanScheduleToStack(local As LocalSymbol) As Boolean
' cannot schedule constants and catch variables
' in theory catch vars could be scheduled, but are not worth the trouble.
Return Not (local.IsConst OrElse local.IsCatch)
Return local.CanScheduleToStack
End Function
Private Sub DeclareLocals(locals As ImmutableArray(Of LocalSymbol), stack As Integer)
......
......@@ -248,6 +248,14 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
End Get
End Property
Friend Overridable ReadOnly Property CanScheduleToStack As Boolean
Get
' cannot schedule constants and catch variables
' in theory catch vars could be scheduled, but are not worth the trouble.
Return Not IsConst AndAlso Not IsCatch
End Get
End Property
Public ReadOnly Property IsStatic As Boolean
Get
Return Me.DeclarationKind = LocalDeclarationKind.Static
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册