本文整理汇总了C#中IStatement.Token方法的典型用法代码示例。如果您正苦于以下问题:C# IStatement.Token方法的具体用法?C# IStatement.Token怎么用?C# IStatement.Token使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IStatement
的用法示例。
在下文中一共展示了IStatement.Token方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EmitSourceContext
private void EmitSourceContext(IStatement statement) {
if (statement is IEmptyStatement) return;
var tok = statement.Token();
string fileName = null;
int lineNumber = 0;
if (this.parent.PdbReader != null) {
var slocs = this.parent.PdbReader.GetClosestPrimarySourceLocationsFor(statement.Locations);
foreach (var sloc in slocs) {
fileName = sloc.Document.Location;
lineNumber = sloc.StartLine;
this.parent.lastSourceLocation = sloc;
break;
}
if (fileName != null) {
var attrib = new Bpl.QKeyValue(tok, "sourceLine", new List<object> { Bpl.Expr.Literal((int)lineNumber) }, null);
attrib = new Bpl.QKeyValue(tok, "sourceFile", new List<object> { fileName }, attrib);
attrib = new Bpl.QKeyValue(tok, "first", new List<object>(), attrib);
this.parent.StmtBuilder.Add(
new Bpl.AssertCmd(tok, Bpl.Expr.True, attrib)
);
}
}
}
示例2: Visit
public override void Visit(IStatement statement) {
EmitSourceContext(statement);
if (this.parent.sink.Options.captureState) {
var tok = statement.Token();
var state = String.Format("s{0}", StatementTraverser.captureStateCounter++);
var attrib = new Bpl.QKeyValue(tok, "captureState ", new List<object> { state }, null);
this.parent.StmtBuilder.Add(
new Bpl.AssumeCmd(tok, Bpl.Expr.True, attrib)
);
}
}