本文整理汇总了C#中TokenKind.HasTrait方法的典型用法代码示例。如果您正苦于以下问题:C# TokenKind.HasTrait方法的具体用法?C# TokenKind.HasTrait怎么用?C# TokenKind.HasTrait使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TokenKind
的用法示例。
在下文中一共展示了TokenKind.HasTrait方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NamedBlockAst
public NamedBlockAst(IScriptExtent extent, TokenKind blockName, StatementBlockAst statementBlock, bool unnamed) : base(extent)
{
if (!blockName.HasTrait(TokenFlags.ScriptBlockBlockName) || (unnamed && ((blockName == TokenKind.Begin) || (blockName == TokenKind.Dynamicparam))))
{
throw PSTraceSource.NewArgumentException("blockName");
}
if (statementBlock == null)
{
throw PSTraceSource.NewArgumentNullException("statementBlock");
}
this.Unnamed = unnamed;
this.BlockKind = blockName;
ReadOnlyCollection<StatementAst> statements = statementBlock.Statements;
this.Statements = statements;
foreach (StatementAst ast in statements)
{
ast.ClearParent();
}
base.SetParents((IEnumerable<Ast>) statements);
ReadOnlyCollection<TrapStatementAst> traps = statementBlock.Traps;
if ((traps != null) && traps.Any<TrapStatementAst>())
{
this.Traps = traps;
foreach (TrapStatementAst ast2 in traps)
{
ast2.ClearParent();
}
base.SetParents((IEnumerable<Ast>) traps);
}
if (!unnamed)
{
InternalScriptExtent extent2 = statementBlock.Extent as InternalScriptExtent;
if (extent2 != null)
{
this.OpenCurlyExtent = new InternalScriptExtent(extent2.PositionHelper, extent2.StartOffset, extent2.StartOffset + 1);
this.CloseCurlyExtent = new InternalScriptExtent(extent2.PositionHelper, extent2.EndOffset - 1, extent2.EndOffset);
}
}
}