void ProcessBlock (BlockStatement node)
		{
			var matcher = new ForMatcher ();
			matcher.Visit (node);

			if (!matcher.Match)
				return;

			var index = node.Statements.IndexOf (matcher.Initializer);
			node.Statements.RemoveAt (index); // initializer
			node.Statements.RemoveAt (index); // while
			node.Statements.Insert (index, matcher.For);
		}
Example #2
0
        void ProcessBlock(BlockStatement node)
        {
            var matcher = new ForMatcher();

            matcher.Visit(node);

            if (!matcher.Match)
            {
                return;
            }

            var index = node.Statements.IndexOf(matcher.Initializer);

            node.Statements.RemoveAt(index);              // initializer
            node.Statements.RemoveAt(index);              // while
            node.Statements.Insert(index, matcher.For);
        }
Example #3
0
		void ProcessBlock (BlockStatement node)
		{
			var matcher = new ForMatcher ();
			matcher.Visit (node);

			if (!matcher.Match)
				return;

			var index = node.Statements.IndexOf (matcher.Initializer);
            if (index == -1)
            {
                System.Diagnostics.Debug.WriteLine("in BuildForStatements.ProcessBlock: index == -1 (so aborting function)");
                return;
            }
            
			node.Statements.RemoveAt (index); // initializer
			node.Statements.RemoveAt (index); // while
			node.Statements.Insert (index, matcher.For);
		}
Example #4
0
        void ProcessBlock(BlockStatement node)
        {
            var matcher = new ForMatcher();

            matcher.Visit(node);

            if (!matcher.Match)
            {
                return;
            }

            var index = node.Statements.IndexOf(matcher.Initializer);

            if (index == -1)
            {
                System.Diagnostics.Debug.WriteLine("in BuildForStatements.ProcessBlock: index == -1 (so aborting function)");
                return;
            }

            node.Statements.RemoveAt(index);              // initializer
            node.Statements.RemoveAt(index);              // while
            node.Statements.Insert(index, matcher.For);
        }