localvariabledeclaration.cs
来自「全功能c#编译器」· CS 代码 · 共 85 行
CS
85 行
using System;
using System.Diagnostics;
using System.Collections.Generic;
namespace ICSharpCode.CsVbRefactory.Parser.AST
{
public class LocalVariableDeclaration : Statement
{
TypeReference typeReference;
Modifier modifier = Modifier.None;
List<VariableDeclaration> variables = new List<VariableDeclaration>(1);
BlockStatement block = BlockStatement.Null; // the block in witch the variable is declared; needed for the LookupTable
public TypeReference TypeReference {
get {
return typeReference;
}
set {
typeReference = value == null ? TypeReference.Null : value;
}
}
public Modifier Modifier {
get {
return modifier;
}
set {
modifier = value;
}
}
public List<VariableDeclaration> Variables {
get {
return variables;
}
}
public BlockStatement Block {
get {
return block;
}
set {
Debug.Assert(value != null);
block = value;
}
}
public LocalVariableDeclaration(TypeReference typeReference)
{
this.TypeReference = typeReference;
}
public LocalVariableDeclaration(TypeReference typeReference, Modifier modifier)
{
this.TypeReference = typeReference;
this.modifier = modifier;
}
public VariableDeclaration GetVariableDeclaration(string variableName)
{
foreach (VariableDeclaration variableDeclaration in variables) {
if (variableDeclaration.Name == variableName) {
return variableDeclaration;
}
}
return null;
}
public override object AcceptVisitor(IASTVisitor visitor, object data)
{
return visitor.Visit(this, data);
}
public override string ToString()
{
return String.Format("[LocalVariableDeclaration: Type={0}, Modifier ={1} Variables={2}]",
typeReference,
modifier,
GetCollectionString(variables));
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?