本文整理汇总了C#中ImmutableStack类的典型用法代码示例。如果您正苦于以下问题:C# ImmutableStack类的具体用法?C# ImmutableStack怎么用?C# ImmutableStack使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ImmutableStack类属于命名空间,在下文中一共展示了ImmutableStack类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BVE5Resolver
public BVE5Resolver(BVE5Compilation compilation, SimpleTypeResolveContext context, Dictionary<string, ResolveResult> nameLookupCache, ImmutableStack<IVariable> stack)
{
this.compilation = compilation;
this.context = context;
user_defined_name_lookup_cache = nameLookupCache;
local_variable_stack = stack;
}
示例2: CreateNewStateValue
private State CreateNewStateValue(ImmutableStack<Tuple<int, string>> finallyStack, string finallyHandlerToPush = null) {
int value = _nextStateIndex++;
finallyStack = finallyHandlerToPush != null ? finallyStack.Push(Tuple.Create(value, finallyHandlerToPush)) : finallyStack;
var result = new State(_currentLoopLabel, value, finallyStack);
_allStates.Add(result);
return result;
}
示例3: GetOrCreateStateForLabel
private State GetOrCreateStateForLabel(string labelName, ImmutableStack<Tuple<int, string>> finallyStack) {
State result;
if (_labelStates.TryGetValue(labelName, out result))
return result;
_labelStates[labelName] = result = CreateNewStateValue(finallyStack);
return result;
}
示例4: RemainingBlock
public RemainingBlock(ImmutableStack<StackEntry> stack, ImmutableStack<Tuple<string, State>> breakStack, ImmutableStack<Tuple<string, State>> continueStack, State stateValue, State returnState) {
Stack = stack;
BreakStack = breakStack;
ContinueStack = continueStack;
StateValue = stateValue;
ReturnState = returnState;
}
示例5: Turtle
public Turtle(Vector pos, double angle, ImmutableStack<TurtleState> stack, Action<int, int, int, int, Color> drawLine, Color c)
{
this.Position = pos;
this.Angle = angle;
this.Stack = stack;
this.DrawLine = drawLine;
this.DrawColor = c;
}
示例6: ActivationRecord
/// <summary>
/// Initializes a new instance of the <see cref="ActivationRecord"/> class.
/// </summary>
/// <param name="type">
/// The routine type.
/// </param>
/// <param name="programCounter">
/// The program counter.
/// </param>
/// <param name="argumentCount">
/// The argument count.
/// </param>
/// <param name="localVariables">
/// The local variables.
/// </param>
/// <param name="evaluationStack">
/// The evaluation stack.
/// </param>
public ActivationRecord(RoutineType type, int programCounter, byte argumentCount, ImmutableArray<int> localVariables, ImmutableStack<int> evaluationStack)
{
this.argumentCount = argumentCount;
this.type = type;
this.localVariables = localVariables;
this.programCounter = programCounter;
this.evaluationStack = evaluationStack;
}
示例7: SetFilePathStack
public static IMarkdownContext SetFilePathStack(this IMarkdownContext context, ImmutableStack<string> filePathStack)
{
if (context == null)
{
throw new ArgumentNullException(nameof(context));
}
return context.CreateContext(context.Variables.SetItem(FilePathStackKey, filePathStack));
}
示例8: Enqueue
private void Enqueue(ImmutableStack<StackEntry> stack, ImmutableStack<Tuple<string, State>> breakStack, ImmutableStack<Tuple<string, State>> continueStack, State stateValue, State returnState)
{
if (_processedStates.Contains(stateValue))
throw new InvalidOperationException("Duplicate enqueueing of " + stateValue);
_processedStates.Add(stateValue);
if (stack.IsEmpty)
throw new InvalidOperationException("Empty stack for state " + stateValue);
_remainingBlocks.Enqueue(new RemainingBlock(stack, breakStack, continueStack, stateValue, returnState));
}
示例9: Dispose
public void Dispose()
{
foreach (var item in _disposables)
{
item.Dispose();
}
_disposables = ImmutableStack<IDisposable>.Empty;
}
示例10: CppResolver
private CppResolver(ICompilation compilation, Conversions conversions, CppTypeResolveContext context, bool checkForOverflow, bool isWithinLambdaExpression, TypeDefinitionCache currentTypeDefinitionCache, ImmutableStack<IVariable> localVariableStack, ObjectInitializerContext objectInitializerStack)
{
this.compilation = compilation;
this.conversions = conversions;
this.context = context;
this.checkForOverflow = checkForOverflow;
this.isWithinLambdaExpression = isWithinLambdaExpression;
this.currentTypeDefinitionCache = currentTypeDefinitionCache;
this.localVariableStack = localVariableStack;
this.objectInitializerStack = objectInitializerStack;
}
示例11: InternalMarkup
internal string InternalMarkup(string src, ImmutableStack<string> parents, HashSet<string> dependency)
{
using (GetFileScope(parents))
{
return InternalMarkup(
src,
Context
.SetFilePathStack(parents)
.SetDependency(dependency));
}
}
示例12: PositionNewUnit
public static PositionedUnit PositionNewUnit(int width, ImmutableStack<Unit> nextUnits)
{
if (nextUnits.IsEmpty) return PositionedUnit.Null;
var u = nextUnits.Peek();
var topmostY = u.Displacements[0].Min(m => m.ToMap().Y);
var pos = new PositionedUnit(u, 0, new Point(0, -topmostY));
var leftMargin = pos.Members.Min(m => m.X);
var rightMargin = width - 1 - pos.Members.Max(m => m.X);
var newX = (rightMargin - leftMargin) / 2;
return new PositionedUnit(u, 0, new Point(newX, -topmostY));
}
示例13: Map
public Map(int id, bool[,] filled, PositionedUnit unit, ImmutableStack<Unit> nextUnits, ImmutableHashSet<PositionedUnit> usedPositions, Scores scores, bool died = false)
{
Id = id;
NextUnits = nextUnits;
Width = filled.GetLength(0);
Height = filled.GetLength(1);
Filled = filled;
Unit = IsValidPosition(unit) ? unit : PositionedUnit.Null;
UsedPositions = usedPositions.Add(Unit);
Scores = scores;
Died = died;
}
示例14: GetFileScope
private static LoggerFileScope GetFileScope(ImmutableStack<string> parents)
{
if (!parents.IsEmpty)
{
var path = StringExtension.ToDisplayPath(parents.Peek());
if (!string.IsNullOrEmpty(path))
{
return new LoggerFileScope(path);
}
}
return null;
}
示例15: Blender
public Blender(Lexer lexer, CSharp.CSharpSyntaxNode oldTree, IEnumerable<TextChangeRange> changes)
{
Debug.Assert(lexer != null);
_lexer = lexer;
_changes = ImmutableStack.Create<TextChangeRange>();
if (changes != null)
{
// TODO: Consider implementing NormalizedChangeCollection for TextSpan. the real
// reason why we are collapsing is because we want to extend change ranges and
// cannot allow them to overlap. This does not seem to be a big deal since multiple
// changes are infrequent and typically close to each other. However if we have
// NormalizedChangeCollection for TextSpan we can have both - we can extend ranges
// and not require collapsing them. NormalizedChangeCollection would also ensure
// that changes are always normalized.
// TODO: this is a temporary measure to prevent individual change spans from
// overlapping after they are widened to effective width (+1 token at the start).
// once we have normalized collection for TextSpan we will not need to collapse all
// the change spans.
var collapsed = TextChangeRange.Collapse(changes);
// extend the change to its affected range. This will make it easier
// to filter out affected nodes since we will be able simply check
// if node intersects with a change.
var affectedRange = ExtendToAffectedRange(oldTree, collapsed);
_changes = _changes.Push(affectedRange);
}
if (oldTree == null)
{
// start at lexer current position if no nodes specified
_oldTreeCursor = new Cursor();
_newPosition = lexer.TextWindow.Position;
}
else
{
_oldTreeCursor = Cursor.FromRoot(oldTree).MoveToFirstChild();
_newPosition = 0;
}
_changeDelta = 0;
_newDirectives = default(DirectiveStack);
_oldDirectives = default(DirectiveStack);
_newLexerDrivenMode = 0;
}