本文整理汇总了C#中IScriptExtent类的典型用法代码示例。如果您正苦于以下问题:C# IScriptExtent类的具体用法?C# IScriptExtent怎么用?C# IScriptExtent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IScriptExtent类属于命名空间,在下文中一共展示了IScriptExtent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TryStatementAst
public TryStatementAst(IScriptExtent extent, StatementBlockAst body, IEnumerable<CatchClauseAst> catchClauses, StatementBlockAst @finally)
: base(extent)
{
this.Body = body;
this.CatchClauses = catchClauses.ToReadOnlyCollection();
this.Finally = @finally;
}
示例2: InvocationInfo
/// <summary>
/// Constructor for InvocationInfo object
/// </summary>
///
/// <param name="commandInfo">
/// The command information the invocation info represents.
/// </param>
///
/// <param name="scriptPosition">
/// The position representing the invocation, or the position representing the error.
/// </param>
///
/// <param name="context">
/// The context in which the InvocationInfo is being created.
/// </param>
///
internal InvocationInfo(CommandInfo commandInfo, IScriptExtent scriptPosition, ExecutionContext context)
{
MyCommand = commandInfo;
CommandOrigin = CommandOrigin.Internal;
_scriptPosition = scriptPosition;
ExecutionContext contextToUse = null;
if ((commandInfo != null) && (commandInfo.Context != null))
{
contextToUse = commandInfo.Context;
}
else if (context != null)
{
contextToUse = context;
}
// Populate the history ID of this command
if (contextToUse != null)
{
Runspaces.LocalRunspace localRunspace = contextToUse.CurrentRunspace as Runspaces.LocalRunspace;
if (localRunspace != null && localRunspace.History != null)
{
HistoryId = localRunspace.History.GetNextHistoryId();
}
}
}
示例3: DataStatementAst
public DataStatementAst(IScriptExtent extent, string variableName, IEnumerable<ExpressionAst> commandsAllowed, StatementBlockAst body) : base(extent)
{
this._tupleIndex = -1;
if (body == null)
{
throw PSTraceSource.NewArgumentNullException("body");
}
if (string.IsNullOrWhiteSpace(variableName))
{
variableName = null;
}
this.Variable = variableName;
if ((commandsAllowed != null) && commandsAllowed.Any<ExpressionAst>())
{
this.CommandsAllowed = new ReadOnlyCollection<ExpressionAst>(commandsAllowed.ToArray<ExpressionAst>());
base.SetParents((IEnumerable<Ast>) this.CommandsAllowed);
this.HasNonConstantAllowedCommand = (from ast in this.CommandsAllowed
where !(ast is StringConstantExpressionAst)
select ast).Any<ExpressionAst>();
}
else
{
this.CommandsAllowed = new ReadOnlyCollection<ExpressionAst>(EmptyCommandsAllowed);
}
this.Body = body;
base.SetParent(body);
}
示例4: ScriptBlockAst
public ScriptBlockAst(IScriptExtent extent, ParamBlockAst paramBlock, NamedBlockAst beginBlock, NamedBlockAst processBlock, NamedBlockAst endBlock, NamedBlockAst dynamicParamBlock) : base(extent)
{
if (paramBlock != null)
{
this.ParamBlock = paramBlock;
base.SetParent(paramBlock);
}
if (beginBlock != null)
{
this.BeginBlock = beginBlock;
base.SetParent(beginBlock);
}
if (processBlock != null)
{
this.ProcessBlock = processBlock;
base.SetParent(processBlock);
}
if (endBlock != null)
{
this.EndBlock = endBlock;
base.SetParent(endBlock);
}
if (dynamicParamBlock != null)
{
this.DynamicParamBlock = dynamicParamBlock;
base.SetParent(dynamicParamBlock);
}
}
示例5: CommandParameterAst
public CommandParameterAst(IScriptExtent extent, string parameterName, ExpressionAst argument, IScriptExtent errorPosition)
: base(extent)
{
this.ParameterName = parameterName;
this.Argument = argument;
this.ErrorPosition = errorPosition;
}
示例6: ExpandableStringExpressionAst
public ExpandableStringExpressionAst(IScriptExtent extent, string value, System.Management.Automation.Language.StringConstantType type) : base(extent)
{
if (value == null)
{
throw PSTraceSource.NewArgumentNullException("value");
}
if (((type != System.Management.Automation.Language.StringConstantType.DoubleQuoted) && (type != System.Management.Automation.Language.StringConstantType.DoubleQuotedHereString)) && (type != System.Management.Automation.Language.StringConstantType.BareWord))
{
throw PSTraceSource.NewArgumentException("type");
}
ExpressionAst ast = Parser.ScanString(value);
ExpandableStringExpressionAst ast2 = ast as ExpandableStringExpressionAst;
if (ast2 != null)
{
this.FormatExpression = ast2.FormatExpression;
this.NestedExpressions = ast2.NestedExpressions;
}
else
{
this.FormatExpression = "{0}";
this.NestedExpressions = new ReadOnlyCollection<ExpressionAst>(new ExpressionAst[] { ast });
}
this.Value = value;
this.StringConstantType = type;
}
示例7: ErrorStatementAst
internal ErrorStatementAst(IScriptExtent extent, Token kind, IEnumerable<KeyValuePair<string, Tuple<Token, Ast>>> flags, IEnumerable<Ast> conditions, IEnumerable<Ast> bodies) : base(extent)
{
if (kind == null)
{
throw PSTraceSource.NewArgumentNullException("kind");
}
this.Kind = kind;
if ((flags != null) && flags.Any<KeyValuePair<string, Tuple<Token, Ast>>>())
{
this.Flags = new Dictionary<string, Tuple<Token, Ast>>(StringComparer.OrdinalIgnoreCase);
foreach (KeyValuePair<string, Tuple<Token, Ast>> pair in flags)
{
if (!this.Flags.ContainsKey(pair.Key))
{
this.Flags.Add(pair.Key, pair.Value);
if (pair.Value.Item2 != null)
{
base.SetParent(pair.Value.Item2);
}
}
}
}
if ((conditions != null) && conditions.Any<Ast>())
{
this.Conditions = new ReadOnlyCollection<Ast>(conditions.ToArray<Ast>());
base.SetParents(conditions);
}
if ((bodies != null) && bodies.Any<Ast>())
{
this.Bodies = new ReadOnlyCollection<Ast>(bodies.ToArray<Ast>());
base.SetParents(bodies);
}
}
示例8: SwitchStatementAst
public SwitchStatementAst(IScriptExtent extent, string label, PipelineBaseAst condition, SwitchFlags flags, IEnumerable<Tuple<ExpressionAst, StatementBlockAst>> clauses, StatementBlockAst @default)
: base(extent, label, condition)
{
this.Flags = flags;
this.Clauses = clauses.ToReadOnlyCollection();
this.Default = @default;
}
示例9: FunctionDefinitionAst
public FunctionDefinitionAst(IScriptExtent extent, bool isFilter, bool isWorkflow, string name, IEnumerable<ParameterAst> parameters, ScriptBlockAst body) : base(extent)
{
if (string.IsNullOrEmpty(name))
{
throw PSTraceSource.NewArgumentNullException("name");
}
if (body == null)
{
throw PSTraceSource.NewArgumentNullException("body");
}
if (isFilter && isWorkflow)
{
throw PSTraceSource.NewArgumentException("isFilter");
}
this.IsFilter = isFilter;
this.IsWorkflow = isWorkflow;
this.Name = name;
if ((parameters != null) && parameters.Any<ParameterAst>())
{
this.Parameters = new ReadOnlyCollection<ParameterAst>(parameters.ToArray<ParameterAst>());
base.SetParents((IEnumerable<Ast>) this.Parameters);
}
this.Body = body;
base.SetParent(body);
}
示例10: ParseError
internal ParseError(IScriptExtent extent, string errorId, string message, bool incompleteInput)
{
this._extent = extent;
this._errorId = errorId;
this._message = message;
this._incompleteInput = incompleteInput;
}
示例11: ParameterAst
public ParameterAst(IScriptExtent extent, VariableExpressionAst name, IEnumerable<AttributeBaseAst> attributes, ExpressionAst defaultValue)
: base(extent)
{
this.Name = name;
this.Attributes = attributes.ToReadOnlyCollection();
this.DefaultValue = defaultValue;
}
示例12: SetUp
public void SetUp()
{
extent = Substitute.For<IScriptExtent>();
argument = new VariableExpressionAst(extent, "other", false);
visitor = new FindTypeDefinitionVisitor();
}
示例13: UpdatePositionExpr
public UpdatePositionExpr(IScriptExtent extent, int sequencePoint, SymbolDocumentInfo debugSymbolDocument, bool checkBreakpoints)
{
this._extent = extent;
this._checkBreakpoints = checkBreakpoints;
this._debugSymbolDocument = debugSymbolDocument;
this._sequencePoint = sequencePoint;
}
示例14: DataStatementAst
public DataStatementAst(IScriptExtent extent, string variableName, IEnumerable<ExpressionAst> commandsAllowed, StatementBlockAst body)
: base(extent)
{
this.Variable = variableName;
this.CommandsAllowed = commandsAllowed.ToReadOnlyCollection();
this.Body = body;
}
示例15: MemberExpressionAst
public MemberExpressionAst(IScriptExtent extent, ExpressionAst expression, CommandElementAst member, bool @static)
: base(extent)
{
this.Expression = expression;
this.Member = member;
this.Static = @static;
}