本文整理汇总了C#中ImmutableStack类的典型用法代码示例。如果您正苦于以下问题:C# ImmutableStack类的具体用法?C# ImmutableStack怎么用?C# ImmutableStack使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ImmutableStack类属于命名空间,在下文中一共展示了ImmutableStack类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:hazama-yuinyan,项目名称:sharpdevelop-bvebinding,代码行数:7,代码来源:BVE5Resolver.cs
示例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;
}
开发者ID:n9,项目名称:SaltarelleCompiler,代码行数:7,代码来源:StateMachineRewriter.cs
示例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;
}
开发者ID:n9,项目名称:SaltarelleCompiler,代码行数:7,代码来源:StateMachineRewriter.cs
示例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;
}
开发者ID:ShuntaoChen,项目名称:SaltarelleCompiler,代码行数:7,代码来源:RemainingBlock.cs
示例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;
}
开发者ID:GyrosOfWar,项目名称:LSystemCSharp,代码行数:8,代码来源:Turtle.cs
示例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;
}
开发者ID:DevTheo,项目名称:IFControlDemo,代码行数:26,代码来源:ActivationRecord.cs
示例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));
}
开发者ID:dotnet,项目名称:docfx,代码行数:8,代码来源:DfmContextExtensions.cs
示例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));
}
开发者ID:mattleibow,项目名称:SaltarelleCompiler,代码行数:9,代码来源:SingleStateMachineRewriter.cs
示例9: Dispose
public void Dispose()
{
foreach (var item in _disposables)
{
item.Dispose();
}
_disposables = ImmutableStack<IDisposable>.Empty;
}
开发者ID:NaseUkolyCZ,项目名称:HarshPoint,代码行数:9,代码来源:HarshDisposableBag.cs
示例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;
}
开发者ID:KAW0,项目名称:Alter-Native,代码行数:11,代码来源:CppResolver.cs
示例11: InternalMarkup
internal string InternalMarkup(string src, ImmutableStack<string> parents, HashSet<string> dependency)
{
using (GetFileScope(parents))
{
return InternalMarkup(
src,
Context
.SetFilePathStack(parents)
.SetDependency(dependency));
}
}
开发者ID:vicancy,项目名称:docfx,代码行数:11,代码来源:DfmEngine.cs
示例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));
}
开发者ID:xoposhiy,项目名称:icfpc2015,代码行数:11,代码来源:Map.cs
示例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;
}
开发者ID:xoposhiy,项目名称:icfpc2015,代码行数:12,代码来源:Map.cs
示例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;
}
开发者ID:vicancy,项目名称:docfx,代码行数:14,代码来源:DfmEngine.cs
示例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;
}
开发者ID:GloryChou,项目名称:roslyn,代码行数:47,代码来源:Blender.cs
示例16: RecEnumerateOutcomes
RecEnumerateOutcomes(
ImmutableStack<Func<DiscriminatedUnionCaseParameter, DestructureMethodParameter>> results,
Func<DiscriminatedUnionCaseParameter, DestructureMethodParameter>[] resultTypes,
int numIterations)
{
if (results.Count() >= numIterations)
{
yield return results;
}
else
{
foreach (var resultType in resultTypes)
{
foreach (var a in RecEnumerateOutcomes(results.Push(resultType), resultTypes, numIterations))
{
yield return a;
}
}
}
}
开发者ID:Richiban,项目名称:Richiban.CSharpTranslator,代码行数:20,代码来源:DestructureMethodCollection.cs
示例17: AppendAbbreviation
/// <summary>
/// Appends an abbreviation to the given zscii text.
/// </summary>
/// <param name="zcharacter">
/// The zcharacter.
/// </param>
/// <param name="calledRecursively">
/// A value which indicates whether the method was called recursively.
/// </param>
/// <param name="zcharacters">
/// The zcharacters.
/// </param>
/// <param name="zsciiText">
/// The zscii text.
/// </param>
protected void AppendAbbreviation(byte zcharacter, bool calledRecursively, ref ImmutableStack<byte> zcharacters, ref ImmutableStack<Zscii> zsciiText)
{
if (calledRecursively)
{
this.FrontEnd.ErrorNotification(ErrorCondition.NestedAbbreviation, "Nested abbreviation detected.");
return;
}
if (zcharacters != null)
{
var abbreviationNumber = ((zcharacter - 1) * 32) + zcharacters.Top;
zcharacters = zcharacters.Tail;
var abbreviationsTableAddress = this.Memory.ReadWord(24);
var abbreviationAddress = 2 * this.Memory.ReadWord(abbreviationsTableAddress + (2 * abbreviationNumber));
var abbreviation = this.ZCharactersToZscii(true, this.EncodedTextToZCharacters(ref abbreviationAddress));
foreach (var zsciiCharacter in abbreviation.Enumerable())
{
zsciiText = zsciiText.Add(zsciiCharacter);
}
}
}
开发者ID:DevTheo,项目名称:IFControlDemo,代码行数:36,代码来源:ZmachineV2.cs
示例18: Add
public void Add(IDisposable disposable)
{
if (disposable == null)
{
throw Logger.Fatal.ArgumentNull(nameof(disposable));
}
_disposables = _disposables.Push(disposable);
}
开发者ID:NaseUkolyCZ,项目名称:HarshPoint,代码行数:9,代码来源:HarshDisposableBag.cs
示例19: Start
public static void Start(ActivityScope scope)
{
var parent = ActivityStack.Any() ? ActivityStack.Peek() : null;
if (parent != null)
scope.ParentId = parent.Id;
ActivityStack = ActivityStack.Push(scope);
}
开发者ID:CorrelatorSharp,项目名称:CorrelatorSharp,代码行数:9,代码来源:ActivityTracker.cs
示例20: Reader
public Reader(Blender blender)
{
this.lexer = blender.lexer;
this.oldTreeCursor = blender.oldTreeCursor;
this.changes = blender.changes;
this.newPosition = blender.newPosition;
this.changeDelta = blender.changeDelta;
this.newDirectives = blender.newDirectives;
this.oldDirectives = blender.oldDirectives;
this.newLexerDrivenMode = blender.newLexerDrivenMode;
}
开发者ID:EkardNT,项目名称:Roslyn,代码行数:11,代码来源:Blender.Reader.cs
注:本文中的ImmutableStack类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论