Ejemplo n.º 1
0
 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];
     }
 }
Ejemplo n.º 2
0
        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;
            }
        }
Ejemplo n.º 3
0
            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));
                }
            }
Ejemplo n.º 4
0
        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));
        }
Ejemplo n.º 5
0
            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;
                }
            }
Ejemplo n.º 6
0
 public SnippetParser(Compiler defaultCompiler, ErrorNodeList errorNodes)
 {
     this.DefaultCompiler      = defaultCompiler;
     this.ErrorNodes           = errorNodes;
     this.CurrentStatementList = new StatementList(0);
 }
Ejemplo n.º 7
0
 public abstract int ParseStatements(StatementList statements, int startColumn, string terminator, AuthoringSink sink);
Ejemplo n.º 8
0
 public virtual void ParseStatements(StatementList statements)
 {
     this.ParseStatements(statements, 0, null, null);
 }