public void CallingInheritedInterfaceFromInterfaceFields()
        {
            string program = TestUtil.GetInput();
            string expected = TestUtil.GetExpected();

            string program2 = @"
                    package Atom;
                    public interface IMaterial
                    {
                    }
                    public class IMaterial_Fields
                    {
                        public static int Atomic_Number;
                    }
                    public interface ISolid extends IMaterial
                    {
                    }";
            CompilationUnit cv = TestUtil.ParseProgram(program2);

            CompilationUnit cu = TestUtil.ParseProgram(program);

            TypesVisitor typesVisitor = new TypesVisitor();
            typesVisitor.CodeBase = CodeBase;
            typesVisitor.VisitCompilationUnit(cu, null);
            typesVisitor.VisitCompilationUnit(cv, null);

            ImportTransformer im = new ImportTransformer();
            im.VisitCompilationUnit(cu, null);

            CodeBase.References.Add("Atom.IMaterial", "Atom.IMaterial_Fields");

            VisitCompilationUnit(cu, null);
            TestUtil.CodeEqual(expected, TestUtil.GenerateCode(cu));
        }
Exemplo n.º 2
0
        public void CallingInheritedInterfaceFromInterfaceFields()
        {
            string program  = TestUtil.GetInput();
            string expected = TestUtil.GetExpected();

            string          program2 = @"
					package Atom;
					public interface IMaterial
					{
					}
					public class IMaterial_Fields
					{
						public static int Atomic_Number;
					}
					public interface ISolid extends IMaterial
					{
					}"                    ;
            CompilationUnit cv       = TestUtil.ParseProgram(program2);

            CompilationUnit cu = TestUtil.ParseProgram(program);

            TypesVisitor typesVisitor = new TypesVisitor();

            typesVisitor.CodeBase = CodeBase;
            typesVisitor.VisitCompilationUnit(cu, null);
            typesVisitor.VisitCompilationUnit(cv, null);

            ImportTransformer im = new ImportTransformer();

            im.VisitCompilationUnit(cu, null);

            CodeBase.References.Add("Atom.IMaterial", "Atom.IMaterial_Fields");

            VisitCompilationUnit(cu, null);
            TestUtil.CodeEqual(expected, TestUtil.GenerateCode(cu));
        }
Exemplo n.º 3
0
 public void SetUp()
 {
     importTransformer = new ImportTransformer();
 }
 public void SetUp()
 {
     importTransformer = new ImportTransformer();
 }