public override Evaluation VisitFixedStatement(FixedStatementSyntax node) { node.Declaration?.Accept <Evaluation>(this); node.Statement?.Accept <Evaluation>(this); return(base.VisitFixedStatement(node)); }
public override void VisitFixedStatement(FixedStatementSyntax node) { base.VisitFixedStatement(node); StatementsAnalyzer statementsAnalyzer = this; statementsAnalyzer.counter = checked (statementsAnalyzer.counter + 1); }
protected override void VisitFixedStatementDeclarations(FixedStatementSyntax node) { foreach (var declarator in node.Declaration.Variables) { this.builder.Add(declarator); } }
private static FixedStatementSyntax AddStatementWithoutEmptyStatements(this FixedStatementSyntax fixedStatement, StatementSyntax childStatement) { if (fixedStatement.Statement.IsKind(SyntaxKind.EmptyStatement)) { return(fixedStatement.WithStatement(childStatement)); } BlockSyntax block; if (fixedStatement.Statement.IsKind(SyntaxKind.Block)) { block = (BlockSyntax)fixedStatement.Statement; if (block.Statements.Count == 0) { return(fixedStatement.WithStatement(childStatement)); } } else { block = SyntaxFactory.Block(fixedStatement.Statement); } if (childStatement.IsKind(SyntaxKind.Block)) { block = block.WithStatements(block.Statements.AddRange(((BlockSyntax)childStatement).Statements)); } else { block = block.AddStatements(childStatement); } return(fixedStatement.WithStatement(block)); }
public static Doc Print(FixedStatementSyntax node) { var groupId = Guid.NewGuid().ToString(); return(Doc.Concat( ExtraNewLines.Print(node), Token.PrintLeadingTrivia(node.FixedKeyword), Doc.Group( Token.PrintWithoutLeadingTrivia(node.FixedKeyword), " ", Token.Print(node.OpenParenToken), Doc.GroupWithId( groupId, Doc.Indent(Doc.SoftLine, Node.Print(node.Declaration)), Doc.SoftLine ), Token.Print(node.CloseParenToken), Doc.IfBreak(Doc.Null, Doc.SoftLine) ), node.Statement is BlockSyntax blockSyntax ? Block.PrintWithConditionalSpace(blockSyntax, groupId) : Node.Print(node.Statement) )); }
protected override void VisitFixedStatementDeclarations(FixedStatementSyntax node) { // Expecting N variable locals followed by N temporaries. var declarators = node.Declaration.Variables; int n = declarators.Count; int startOffset = this.offset; for (int i = 0; i < n; i++) { var declarator = declarators[i]; TryGetSlotIndex(declarator.Identifier.ValueText); this.offset++; } int endOffset = this.offset; this.offset = startOffset; for (int i = 0; i < n; i++) { var declarator = declarators[i]; if (!IsSlotIndex(TempKind.FixedString)) { break; } AddLocal(TempKind.FixedString); this.offset++; } Debug.Assert(this.offset <= endOffset); this.offset = endOffset; }
public override void VisitFixedStatement(FixedStatementSyntax node) { node.Declaration?.Accept(this); node.Statement?.Accept(this); base.VisitFixedStatement(node); }
private void BuildFixedStatement(FixedStatementSyntax fixedStatement) { currentBlock = CreateBlock(currentBlock); BuildStatement(fixedStatement.Statement); currentBlock = CreateJumpBlock(fixedStatement, currentBlock); BuildVariableDeclaration(fixedStatement.Declaration); }
public override void VisitFixedStatement(FixedStatementSyntax node) { var binder = new FixedStatementBinder(this.method, enclosing, node); AddToMap(node, binder); VisitPossibleEmbeddedStatement(node.Statement, binder); }
public override void VisitFixedStatement(FixedStatementSyntax node) { using (Context.WithFlag("fixed")) { HandleVariableDeclaration(node.Declaration); } Visit(node.Statement); }
public override void VisitFixedStatement(FixedStatementSyntax node) { if (RootStmtOpt != node) { return; } Visit(node.Declaration); }
public override void VisitFixedStatement(FixedStatementSyntax node) { Debug.Assert((object)_method == _enclosing.ContainingMemberOrLambda); var binder = new FixedStatementBinder(_enclosing, node); AddToMap(node, binder); VisitPossibleEmbeddedStatement(node.Statement, binder); }
public override void VisitFixedStatement(FixedStatementSyntax node) { if (entryPoint.IsMethodLevel() && node.IsParent <AnonymousFunctionExpressionSyntax>()) { return; } noscounter++; base.VisitFixedStatement(node); }
public static bool ContainsEmbeddedStatement(FixedStatementSyntax fixedStatement) { if (fixedStatement == null) { throw new ArgumentNullException(nameof(fixedStatement)); } return(fixedStatement.Statement?.IsKind(SyntaxKind.Block) == false); }
public override SyntaxNode VisitFixedStatement(FixedStatementSyntax node) { if (node != this.ContainerOfStatementsOrFieldToReplace) { return(base.VisitFixedStatement(node)); } return(node.WithDeclaration(VisitNode(node.Declaration)) .WithStatement(ReplaceStatementIfNeeded(node.Statement))); }
public static void WriteFixedStatement(OutputWriter writer, FixedStatementSyntax statement) { // writer.WriteIndent(); writer.WriteLine("//fixed() Scope"); writer.OpenBrace(); Write(writer, statement.Declaration); Write(writer, statement.Statement); writer.CloseBrace(); // writer.Write(";\r\n"); }
private Doc PrintFixedStatementSyntax(FixedStatementSyntax node) { return(Concat( this.PrintSyntaxToken(node.FixedKeyword, " "), this.PrintSyntaxToken(node.OpenParenToken), this.Print(node.Declaration), this.PrintSyntaxToken(node.CloseParenToken), this.Print(node.Statement) )); }
public override void VisitFixedStatement(FixedStatementSyntax node) { if (entryPoint.IsMethodLevel() && node.IsParent <AnonymousFunctionExpressionSyntax>()) { return; } IncreaseHeight(); EmbeddednessConsideredToIncrease(); base.VisitFixedStatement(node); currentNL--; EmbeddednessConsideredToDecrease(); }
public override void VisitFixedStatement(FixedStatementSyntax node) { if (entryNode is AnonymousFunctionExpressionSyntax && embeddedNode is AnonymousFunctionExpressionSyntax) { return; } if (_weComeFromMethod && _weInAnonymousMethod) { return; } InsertLLOCMap(node.GetLocation()); base.VisitFixedStatement(node); }
public override LuaSyntaxNode VisitFixedStatement(FixedStatementSyntax node) { LuaStatementListSyntax statements = new LuaStatementListSyntax(); statements.Statements.Add(new LuaShortCommentStatement(" " + node.FixedKeyword)); LuaBlockStatementSyntax block = new LuaBlockStatementSyntax(); var declaration = (LuaStatementSyntax)node.Declaration.Accept(this); block.Statements.Add(declaration); WriteStatementOrBlock(node.Statement, block); statements.Statements.Add(block); return(statements); }
public override UstNode VisitFixedStatement(FixedStatementSyntax node) { var statements = new List <Statement>(); var varDec = (VariableDeclarationExpression)VisitVariableDeclaration(node.Declaration); statements.Add(new ExpressionStatement(varDec)); statements.AddRange(GetChildStatements(node.Statement)); var result = new BlockStatement(statements, node.GetTextSpan(), FileNode); return(result); }
public override void VisitFixedStatement(FixedStatementSyntax node) { if (!PreVisit(node)) { return; } node.Declaration?.Accept(this); node.Statement?.Accept(this); base.VisitFixedStatement(node); PostVisit(node); }
public override void VisitFixedStatement(FixedStatementSyntax node) { Debug.Assert((object)_containingMemberOrLambda == _enclosing.ContainingMemberOrLambda); var binder = new FixedStatementBinder(_enclosing, node); AddToMap(node, binder); if (node.Declaration != null) { Visit(node.Declaration, binder); } VisitPossibleEmbeddedStatement(node.Statement, binder); }
public override void VisitFixedStatement(FixedStatementSyntax node) { if (debug) { Console.WriteLine(node.ToFullString()); } Todo("FixedStatement"); var nl = OurLine.NewLine(LineKind.Decl, "FixedStatement"); nl.Source = node.ToFullString(); nl.ParentKind = node.Parent.RawKind; nl.RawKind = node.RawKind; LogCommand(nl); StartBlock("FixedStatement"); base.VisitFixedStatement(node); EndBlock("FixedStatement"); }
async Task <Solution> AddAdressOfOperator(Document document, FixedStatementSyntax fixedStatement, CancellationToken cancellationToken) { var root = await document.GetSyntaxRootAsync().ConfigureAwait(false); var declaratorList = new SeparatedSyntaxList <VariableDeclaratorSyntax>(); foreach (var variable in fixedStatement.Declaration.Variables) { var declarator = CreateDeclarator(variable); declaratorList = declaratorList.Add(declarator); } var fixedDeclaration = SyntaxFactory.VariableDeclaration(fixedStatement.Declaration.Type, declaratorList); root = root.ReplaceNode(fixedStatement.Declaration, fixedDeclaration); return(document.Project.Solution.WithDocumentSyntaxRoot(document.Id, root)); }
private static FixedStatementSyntax AddStatementWithoutEmptyStatements(this FixedStatementSyntax fixedStatement, StatementSyntax childStatement) { if (fixedStatement.Statement.IsKind(SyntaxKind.EmptyStatement)) { return(fixedStatement.WithStatement(childStatement)); } if (fixedStatement.Statement.IsKind(SyntaxKind.Block)) { var block = (BlockSyntax)fixedStatement.Statement; if (block.Statements.Count == 0) { return(fixedStatement.WithStatement(childStatement)); } return(fixedStatement.WithStatement(block.AddStatements(childStatement))); } return(fixedStatement.WithStatement(SyntaxFactory.Block(fixedStatement.Statement, childStatement))); }
public override SyntaxNode VisitFixedStatement(FixedStatementSyntax node) { node = (FixedStatementSyntax)base.VisitFixedStatement(node); if (!node.CloseParenToken.IsMissing && node.Statement.Kind != SyntaxKind.Block) { return CodeAnnotations.Formatting.AddAnnotationTo( Syntax.FixedStatement( node.FixedKeyword, node.OpenParenToken, node.Declaration, node.CloseParenToken, WrapStatementWithBlock(node.Statement))); } else { return node; } }
public override void VisitFixedStatement(FixedStatementSyntax node) { Debug.Assert((object)_containingMemberOrLambda == _enclosing.ContainingMemberOrLambda); var binder = new FixedStatementBinder(_enclosing, node); AddToMap(node, binder); if (node.Declaration != null) { VisitRankSpecifiers(node.Declaration.Type, binder); foreach (VariableDeclaratorSyntax declarator in node.Declaration.Variables) { Visit(declarator, binder); } } VisitPossibleEmbeddedStatement(node.Statement, binder); }
public static bool IsCloseParenInStatement(this SyntaxToken token) { if (!(token.Parent is StatementSyntax statement)) { return(false); } return(statement switch { IfStatementSyntax ifStatement => ifStatement.CloseParenToken.Equals(token), SwitchStatementSyntax switchStatement => switchStatement.CloseParenToken.Equals(token), WhileStatementSyntax whileStatement => whileStatement.CloseParenToken.Equals(token), DoStatementSyntax doStatement => doStatement.CloseParenToken.Equals(token), ForStatementSyntax forStatement => forStatement.CloseParenToken.Equals(token), CommonForEachStatementSyntax foreachStatement => foreachStatement.CloseParenToken.Equals(token), LockStatementSyntax lockStatement => lockStatement.CloseParenToken.Equals(token), UsingStatementSyntax usingStatement => usingStatement.CloseParenToken.Equals(token), FixedStatementSyntax fixedStatement => fixedStatement.CloseParenToken.Equals(token), _ => false, });
public FixedStatementBinder(Binder enclosing, FixedStatementSyntax syntax) : base(enclosing) { Debug.Assert(syntax != null); _syntax = syntax; }
private Block BuildFixedStatement(FixedStatementSyntax fixedStatement, Block currentBlock) { var fixedStatementBlock = BuildStatement(fixedStatement.Statement, CreateBlock(currentBlock)); return(BuildVariableDeclaration(fixedStatement.Declaration, CreateJumpBlock(fixedStatement, fixedStatementBlock))); }
public FixedBinder(FixedStatementSyntax syntax, MethodSymbol owner, Binder enclosing) : base(owner, enclosing) { this.syntax = syntax; }