本文整理汇总了C#中Statement.AcceptVisitor方法的典型用法代码示例。如果您正苦于以下问题:C# Statement.AcceptVisitor方法的具体用法?C# Statement.AcceptVisitor怎么用?C# Statement.AcceptVisitor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Statement
的用法示例。
在下文中一共展示了Statement.AcceptVisitor方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConvertStatementInternal
object ConvertStatementInternal(Statement stmt)
{
Statement oldStatement = currentStatement;
currentStatement = stmt;
try {
return stmt.AcceptVisitor(this, null);
} finally {
currentStatement = oldStatement;
}
}
示例2: WriteEmbeddedStatement
void WriteEmbeddedStatement(Statement embeddedStatement)
{
if (embeddedStatement.IsNull) {
NewLine();
return;
}
BlockStatement block = embeddedStatement as BlockStatement;
if (block != null) {
VisitBlockStatement(block);
} else {
NewLine();
formatter.Indent();
embeddedStatement.AcceptVisitor(this);
formatter.Unindent();
}
}
示例3: Compile
public JsBlockStatement Compile(Statement statement) {
SetRegion(statement.GetRegion());
try {
_result = new List<JsStatement>();
statement.AcceptVisitor(this);
if (_result.Count == 1 && _result[0] is JsBlockStatement)
return (JsBlockStatement)_result[0];
else
return JsStatement.Block(_result);
}
catch (Exception ex) {
_errorReporter.InternalError(ex);
return JsStatement.EmptyBlock;
}
}
示例4: WriteEmbeddedStatement
/// <summary>
/// Writes an embedded statement.
/// </summary>
/// <param name="embeddedStatement">The statement to write.</param>
/// <param name="nlp">Determines whether a trailing newline should be written following a block.
/// Non-blocks always write a trailing newline.</param>
/// <remarks>
/// Blocks may or may not write a leading newline depending on StatementBraceStyle.
/// Non-blocks always write a leading newline.
/// </remarks>
protected virtual void WriteEmbeddedStatement(Statement embeddedStatement, NewLinePlacement nlp = NewLinePlacement.NewLine)
{
if (embeddedStatement.IsNull) {
NewLine();
return;
}
BlockStatement block = embeddedStatement as BlockStatement;
if (block != null) {
WriteBlock(block, policy.StatementBraceStyle);
if (nlp == NewLinePlacement.SameLine) {
Space(); // if not a trailing newline, then at least a trailing space
} else {
NewLine();
}
} else {
NewLine();
writer.Indent();
embeddedStatement.AcceptVisitor(this);
writer.Unindent();
}
}
示例5: WriteEmbeddedStatement
private void WriteEmbeddedStatement(Statement statement)
{
var blockStatement = statement as BlockStatement;
if (blockStatement != null)
{
VisitBlockStatement(blockStatement);
}
else
{
Formatter.WriteLine();
Formatter.Indent();
statement.AcceptVisitor(this);
Formatter.Unindent();
}
}
示例6: Compile
public JsBlockStatement Compile(Statement statement)
{
_filename = statement.GetRegion().FileName;
try {
_result = new List<JsStatement>();
statement.AcceptVisitor(this);
if (_result.Count == 1 && _result[0] is JsBlockStatement)
return (JsBlockStatement)_result[0];
else
return new JsBlockStatement(_result);
}
catch (Exception ex) {
_errorReporter.InternalError(ex, _filename, _location);
return new JsBlockStatement();
}
}
示例7: CreateMacro
B.MacroStatement CreateMacro(INode node, string name, Statement embedded, params Expression[] arguments)
{
B.MacroStatement macro = new B.MacroStatement(GetLexicalInfo(node));
macro.Name = name;
ConvertExpressions(arguments, macro.Arguments);
if (embedded is BlockStatement) {
macro.Body = ConvertBlock((BlockStatement)embedded);
} else {
macro.Body = new B.Block();
macro.Body.Add((B.Statement)embedded.AcceptVisitor(this, null));
}
return macro;
}