本文整理汇总了C#中Unicoen.Processor.VisitorArgument.Set方法的典型用法代码示例。如果您正苦于以下问题:C# VisitorArgument.Set方法的具体用法?C# VisitorArgument.Set怎么用?C# VisitorArgument.Set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Unicoen.Processor.VisitorArgument
的用法示例。
在下文中一共展示了VisitorArgument.Set方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Visit
public override bool Visit(
UnifiedBinaryExpression element, VisitorArgument arg)
{
var paren = GetRequiredParen(element);
Writer.Write(paren.Item1);
element.LeftHandSide.TryAccept(this, arg.Set(Paren));
Writer.Write(" ");
element.Operator.TryAccept(this, arg);
Writer.Write(" ");
element.RightHandSide.TryAccept(this, arg.Set(Paren));
Writer.Write(paren.Item2);
return false;
}
示例2: Visit
//配列orオブジェクトのインスタンス化式
public override bool Visit(UnifiedNew element, VisitorArgument arg)
{
//配列 : e.g. var a = [1, 2, 3] の [1, 2, 3];
if (element.InitialValue != null) {
element.InitialValue.TryAccept(this, arg.Set(Brace));
return true;
}
//オブジェクト : e.g. var a = new X();
Writer.Write("new ");
element.Target.TryAccept(this, arg);
element.Arguments.TryAccept(this, arg.Set(Paren));
return true;
}
示例3: Visit
public override bool Visit(
UnifiedNamespaceDefinition element, VisitorArgument arg)
{
element.Annotations.TryAccept(this, arg);
Writer.Write("namespace ");
element.Name.Accept(this, arg);
Writer.Write(" ");
element.Body.Accept(this, arg.Set(ForBlock));
return false;
}
示例4: Visit
// enum定義(UnifiedEnumDefinition)
public override bool Visit(
UnifiedEnumDefinition element, VisitorArgument arg)
{
// enum COLOR {RED, BLUE, YELLOW};
element.Modifiers.TryAccept(this, arg);
Writer.Write("enum ");
element.Name.TryAccept(this, arg);
Writer.Write(" ");
element.Body.TryAccept(this, arg.Set(ForBlock));
return true;
}
示例5: Visit
// e.g. (Int)a or (int)(a + b)
public override bool Visit(UnifiedCast element, VisitorArgument arg)
{
// ((TestCase)(test)).setName(name); などに対応するため括弧を出力
Writer.Write("(");
Writer.Write("(");
element.Type.TryAccept(this, arg);
Writer.Write(")");
element.Expression.TryAccept(this, arg.Set(Paren));
Writer.Write(")");
return true;
}
示例6: Visit
// If文(UnifiedIf)
public override bool Visit(UnifiedIf element, VisitorArgument arg)
{
Writer.Write("if (");
element.Condition.TryAccept(this, arg);
Writer.Write(")");
element.Body.TryAccept(this, arg.Set(ForBlock));
if (element.ElseBody != null) {
Writer.WriteLine(); //if(cond){ }の後の改行
WriteIndent(arg);
Writer.Write("else");
element.ElseBody.TryAccept(this, arg.Set(ForBlock));
}
return false;
}
示例7: Visit
public override bool Visit(UnifiedFor element, VisitorArgument arg)
{
Writer.Write("for(");
element.Initializer.TryAccept(this, arg.Set(CommaDelimiter));
Writer.Write("; ");
element.Condition.TryAccept(this, arg.Set(CommaDelimiter));
Writer.Write(";");
element.Step.TryAccept(this, arg.Set(CommaDelimiter));
Writer.Write(")");
element.Body.TryAccept(this, arg.Set(ForBlock));
return false;
}
示例8: Visit
//TODO 辞書リテラル : JavaScriptでは出現しない?
public override bool Visit(
UnifiedMapLiteral element, VisitorArgument arg)
{
Writer.Write("{");
VisitCollection(element, arg.Set(CommaDelimiter));
WriteIndent(arg.IndentDepth);
Writer.Write("}");
return false;
}