Ejemplo n.º 1
0
        public MethodTree Walk()
        {
            var method = new MethodTree();

            for (int i = 0; i < node.ChildCount; i++)
            {
                ITree child = node.GetChild(i);

                if (child.IsStatement())
                {
                    method.Add(new StatementTranslator(child).Walk());
                }
                else if (child.IsTypeDeclaration())
                {
                    //TODO: Special Case!
                    new TypeDeclarationTranslator(child).Walk();
                }
                else if (child.IsVarDeclaration())
                {
                    List<VarDeclarationNode> decls = new VarDeclarationTranslator(child).Walk();

                    foreach (VarDeclarationNode decl in decls)
                    {
                        method.Add(decl);
                    }
                }
                else
                {
                    throw new NotImplementedException();
                }
            }

            return method;
        }
Ejemplo n.º 2
0
        private static MethodTree WalkInit(ITree initNode)
        {
            Debug.Assert(initNode.Type == (int)JavaNodeType.FOR_INIT);

            if (initNode.ChildCount == 0)
            {
                return null;
            }

            var child = initNode.GetChild(0);

            var exprs = new MethodTree();
            if (child.Type == (int)JavaNodeType.VAR_DECLARATION)
            {
                new VarDeclarationTranslator(child).Walk().ForEach(exprs.Add);
            }
            else
            {

                for (var i = 0; i < initNode.ChildCount; i++)
                {
                    exprs.Add(new ExpressionTranslator(initNode.GetChild(i)).Walk());
                }

            }
            return exprs;
        }
Ejemplo n.º 3
0
        public void RunAllTestsButtonClicked(object sender, EventArgs e)
        {
            OutputMessage.Instance.ResetMessage(outputText);

            if (reflectedObject == null)
            {
                reflectedObject = GetReflectedObject(selectedType);
            }

            FixtureSetup(reflectedObject);

            foreach (var item in MethodList)
            {
                TreeNode treeNode = MethodTree.FirstOrDefault(x => x.Value == item).Key;
                if (treeNode != null)
                {
                    currentNode = treeNode;
                }

                RunTest(item);
            }
            FixtureTearDown(reflectedObject);

            OutputMessage.Instance.CommitMessage(outputText);
        }
Ejemplo n.º 4
0
        private void RunTest()
        {
            if (MethodTree == null || this.currentNode == null)
            {
                return;
            }

            MethodInfo methodInfo = null;

            if (MethodTree.ContainsKey(this.currentNode))
            {
                MethodTree.TryGetValue(this.currentNode, out methodInfo);
            }

            RunTest(methodInfo);

            OutputMessage.Instance.CommitMessage(outputText);
        }
Ejemplo n.º 5
0
        private static MethodTree WalkUpdater(ITree updaterNode)
        {
            Debug.Assert(updaterNode.Type == (int)JavaNodeType.FOR_UPDATE);

            var exprs = new MethodTree();

            for (var i = 0; i < updaterNode.ChildCount; i++)
            {
                exprs.Add(new ExpressionTranslator(updaterNode.GetChild(i)).Walk());
            }

            return exprs;
        }
 public ConstructorBlockCompiler(MethodTree tree)
 {
     this.tree = tree;
 }
Ejemplo n.º 7
0
 public void PopulateMethodTree(TreeNode node, MethodInfo methodInfo)
 {
     MethodTree.Add(node, methodInfo);
 }
Ejemplo n.º 8
0
 public BlockCompiler(MethodTree tree)
 {
     this.tree = tree;
 }