コード例 #1
0
ファイル: ClauseTest.cs プロジェクト: Wilbertz/Millenium
        public void Test_0005_Clone()
        {
            // Arrange
            Clause source = new Clause(new [] { 2, 3, 6 }, new [] { 1, 4 });

            // Act
            Clause clone = source.Clone() as Clause;

            // Assert
            Assert.IsNotNull(clone, "Could not clone instance.");

            clone.SubstituteAsTrue(1);
            clone.SubstituteAsFalse(2);
        }
コード例 #2
0
        public override Statement CloneStatement()
        {
            var ret = new ForStatement();

            for (int i = 0; i < NumConstDeclarations(); i++)
            {
                ret.AddConstDeclaration(GetConstDeclaration(i).Clone() as ConstDeclaration);
            }
            for (int i = 0; i < NumTypeDeclarations(); i++)
            {
                ret.AddTypeDeclaration(GetTypeDeclaration(i).Clone() as TypeDeclaration);
            }
            for (int i = 0; i < NumVarDeclarations(); i++)
            {
                ret.AddVarDeclaration(GetVarDeclaration(i).Clone() as VarDeclaration);
            }

            ret.Clause = Clause.Clone();
            ret.Body   = Body.Clone() as Block;

            return(ret);
        }