public ArrayIndexable(Cci.StatementList stmts) { this.members = new Cci.Statement[stmts.Count]; for (int i = 0; i < stmts.Count; i++) { this.members[i] = stmts[i]; } }
public override Block VisitBlock(Block block) { if (block == null) { return(null); } StatementList savedStatementList = this.CurrentStatementList; try{ StatementList oldStatements = block.Statements; int n = oldStatements == null ? 0 : oldStatements.Length; StatementList newStatements = this.CurrentStatementList = block.Statements = new StatementList(n); for (int i = 0; i < n; i++) { newStatements.Add((Statement)this.Visit(oldStatements[i])); } return(block); }finally{ this.CurrentStatementList = savedStatementList; } }
internal void Transfer(LocalsStack /*!*/ targetStack, StatementList /*!*/ statements) { Debug.Assert(targetStack != null); if (targetStack == this) { return; } int n = this.top; Debug.Assert(n == targetStack.top); for (int i = 0; i <= n; i++) { Local sloc = this.elements[i]; Local tloc = targetStack.elements[i]; if (sloc == tloc) { continue; } Debug.Assert(sloc != null && tloc != null); statements.Add(new AssignmentStatement(tloc, sloc)); } }
public override Statement VisitBranch(Branch branch) { if (branch == null) { return(null); } if (branch.Target == null) { return(null); } branch.Condition = this.VisitExpression(branch.Condition); int n = this.localsStack.top + 1; LocalsStack targetStack = (LocalsStack)this.StackLocalsAtEntry[branch.Target.UniqueKey]; if (targetStack == null) { this.StackLocalsAtEntry[branch.Target.UniqueKey] = this.localsStack.Clone(); return(branch); } // Target block has an entry stack that is different from the current stack. Need to copy stack // before branching. if (n <= 0) { return(branch); //Empty stack, no need to copy } StatementList statements = new StatementList(); this.localsStack.Transfer(targetStack, statements); statements.Add(branch); return(new Block(statements)); }
internal void VisitMethodBody(Block body) { if (body == null) { return; } StatementList statements = body.Statements; Block previousBlock = null; for (int i = 0, n = statements.Count; i < n; i++) { Block b = statements[i] as Block; if (b == null) { Debug.Assert(false); continue; } if (previousBlock != null && this.BlocksThatDropThrough[previousBlock.UniqueKey] != null) { this.SuccessorBlock[previousBlock.UniqueKey] = b; } this.VisitBlock(b); previousBlock = b; } }
public SnippetParser(Compiler defaultCompiler, ErrorNodeList errorNodes) { this.DefaultCompiler = defaultCompiler; this.ErrorNodes = errorNodes; this.CurrentStatementList = new StatementList(0); }
public abstract int ParseStatements(StatementList statements, int startColumn, string terminator, AuthoringSink sink);
public virtual void ParseStatements(StatementList statements) { this.ParseStatements(statements, 0, null, null); }