本文整理汇总了C#中ICSharpCode.NRefactory.Ast.LocalVariableDeclaration.GetTypeForVariable方法的典型用法代码示例。如果您正苦于以下问题:C# LocalVariableDeclaration.GetTypeForVariable方法的具体用法?C# LocalVariableDeclaration.GetTypeForVariable怎么用?C# LocalVariableDeclaration.GetTypeForVariable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICSharpCode.NRefactory.Ast.LocalVariableDeclaration
的用法示例。
在下文中一共展示了LocalVariableDeclaration.GetTypeForVariable方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VisitLocalVariableDeclaration
public override object VisitLocalVariableDeclaration(LocalVariableDeclaration localVariableDeclaration, object data)
{
for (int i = 0; i < localVariableDeclaration.Variables.Count; ++i) {
VariableDeclaration varDecl = (VariableDeclaration)localVariableDeclaration.Variables[i];
AddVariable(localVariableDeclaration.GetTypeForVariable(i),
varDecl.Name,
localVariableDeclaration.StartLocation,
CurrentEndLocation,
(localVariableDeclaration.Modifier & Modifiers.Const) == Modifiers.Const,
false, varDecl.Initializer, null, false, localVariableDeclaration.SemicolonPosition);
}
return base.VisitLocalVariableDeclaration(localVariableDeclaration, data);
}
示例2: VisitLocalVariableDeclaration
public override object VisitLocalVariableDeclaration(LocalVariableDeclaration localVariableDeclaration, object data)
{
CodeVariableDeclarationStatement declStmt = null;
for (int i = 0; i < localVariableDeclaration.Variables.Count; ++i) {
CodeTypeReference type = ConvType(localVariableDeclaration.GetTypeForVariable(i) ?? new TypeReference("object"));
VariableDeclaration var = (VariableDeclaration)localVariableDeclaration.Variables[i];
if (!var.Initializer.IsNull) {
declStmt = new CodeVariableDeclarationStatement(type,
var.Name,
(CodeExpression)((INode)var.Initializer).AcceptVisitor(this, data));
} else {
declStmt = new CodeVariableDeclarationStatement(type,
var.Name);
}
variables.Add(declStmt);
AddStmt(declStmt);
}
return declStmt;
}
示例3: VisitLocalVariableDeclaration
public override object VisitLocalVariableDeclaration(LocalVariableDeclaration localVariableDeclaration, object data)
{
for (int i = 0; i < localVariableDeclaration.Variables.Count; i++) {
VariableDeclaration decl = localVariableDeclaration.Variables[i];
if (AddDefaultValueInitializerToLocalVariableDeclarations &&
(localVariableDeclaration.Modifier & Modifiers.Static) == 0 &&
decl.FixedArrayInitialization.IsNull && decl.Initializer.IsNull) {
TypeReference type = localVariableDeclaration.GetTypeForVariable(i);
decl.Initializer = ExpressionBuilder.CreateDefaultValueForType(type);
}
if (decl.TypeReference.IsNull) {
if (OptionInfer && !(decl.Initializer is PrimitiveExpression && (decl.Initializer as PrimitiveExpression).Value == null))
decl.TypeReference = new TypeReference("var", true);
else if (OptionStrict)
decl.TypeReference = new TypeReference("System.Object", true);
else
decl.TypeReference = new TypeReference("dynamic", true);
}
}
return base.VisitLocalVariableDeclaration(localVariableDeclaration, data);
}
示例4: VisitLocalVariableDeclaration
public override object VisitLocalVariableDeclaration(LocalVariableDeclaration localVariableDeclaration, object data)
{
if (AddDefaultValueInitializerToLocalVariableDeclarations) {
for (int i = 0; i < localVariableDeclaration.Variables.Count; i++) {
VariableDeclaration decl = localVariableDeclaration.Variables[i];
if (decl.FixedArrayInitialization.IsNull && decl.Initializer.IsNull) {
TypeReference type = localVariableDeclaration.GetTypeForVariable(i);
decl.Initializer = ExpressionBuilder.CreateDefaultValueForType(type);
}
}
}
return base.VisitLocalVariableDeclaration(localVariableDeclaration, data);
}
示例5: VisitLocalVariableDeclaration
public object VisitLocalVariableDeclaration(LocalVariableDeclaration lvd, object data)
{
ArrayList list = new ArrayList();
for (int i = 0; i < lvd.Variables.Count; i++) {
B.DeclarationStatement varDecl = new B.DeclarationStatement(GetLexicalInfo(lvd));
varDecl.Declaration = new B.Declaration(GetLexicalInfo(lvd.Variables[i]), lvd.Variables[i].Name, ConvertTypeReference(lvd.GetTypeForVariable(i)));
varDecl.Initializer = ConvertExpression(lvd.Variables[i].Initializer);
list.Add(varDecl);
}
return list;
}