public virtual Statement visit(LabelledStatement labelledStatement)
        {
            labelledStatement.identifier = visitIdentifier(labelledStatement.identifier);
            labelledStatement.statement  = visitStatement(labelledStatement.statement);

            return(labelledStatement);
        }
        public void Equality_Default()
        {
            var a = new LabelledStatement();
            var b = new LabelledStatement();

            Assert.AreEqual(a, b);
            Assert.AreEqual(a.GetHashCode(), b.GetHashCode());
        }
        public void SettingValues()
        {
            var sut = new LabelledStatement {
                Label = "a", Statement = new BreakStatement()
            };

            Assert.AreEqual("a", sut.Label);
            Assert.AreEqual(new BreakStatement(), sut.Statement);
        }
        public void DefaultValues()
        {
            var sut = new LabelledStatement();

            Assert.AreEqual("", sut.Label);
            Assert.AreEqual(new UnknownStatement(), sut.Statement);
            Assert.AreNotEqual(0, sut.GetHashCode());
            Assert.AreNotEqual(1, sut.GetHashCode());
        }
        public void Equality_DifferentStatement()
        {
            var a = new LabelledStatement {
                Statement = new ContinueStatement()
            };
            var b = new LabelledStatement {
                Statement = new BreakStatement()
            };

            Assert.AreNotEqual(a, b);
            Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode());
        }
        public void Equality_DifferentLabel()
        {
            var a = new LabelledStatement {
                Label = "a"
            };
            var b = new LabelledStatement {
                Label = "b"
            };

            Assert.AreNotEqual(a, b);
            Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode());
        }
        public void Equality_ReallyTheSame()
        {
            var a = new LabelledStatement {
                Label = "a", Statement = new BreakStatement()
            };
            var b = new LabelledStatement {
                Label = "a", Statement = new BreakStatement()
            };

            Assert.AreEqual(a, b);
            Assert.AreEqual(a.GetHashCode(), b.GetHashCode());
        }
示例#8
0
        public Completion ExecuteLabelledStatement(LabelledStatement labelledStatement)
        {
            labelledStatement.Body.LabelSet = labelledStatement.Label.Name;
            var result = ExecuteStatement(labelledStatement.Body);

            if (result.Type == Completion.Break && result.Identifier == labelledStatement.Label.Name)
            {
                return(new Completion(Completion.Normal, result.Value, null));
            }

            return(result);
        }
        public void LabelledStatement()
        {
            var sst = new LabelledStatement
            {
                Label     = "L",
                Statement = new ContinueStatement()
            };

            AssertPrint(
                sst,
                "L:",
                "continue;");
        }
示例#10
0
 public override void VisitLabelledStatement(LabelledStatement labelledStatement)
 {
     Program.Add(new NoOperation(labelledStatement.Label));
     Visit(labelledStatement.Statement);
 }
示例#11
0
 public virtual Statement visit(LabelledStatement statement)
 {
     return(statement);
 }
示例#12
0
 public void VisitLabelledStatement(LabelledStatement labelledStatement)
 {
     VisitStatement(labelledStatement.Statement);
 }
示例#13
0
 protected abstract void Visit(LabelledStatement node);
        public void VisitorIsImplemented()
        {
            var sut = new LabelledStatement();

            sut.Accept(23).Verify(v => v.Visit(sut, 23));
        }
 public override void VisitLabelledStatement(LabelledStatement labelledStatement)
 {
     Visit(labelledStatement.Statement);
 }
 public override void VisitLabelledStatement(LabelledStatement labelledStatement)
 {
     Write(labelledStatement.Label + ": ");
     Visit(labelledStatement.Statement);
 }
示例#17
0
 public virtual void VisitLabelledStatement(LabelledStatement labelledStatement)
 {
     DefaultVisit(labelledStatement);
 }
示例#18
0
 public virtual T VisitLabelledStatement(LabelledStatement labelledStatement)
 {
     return(DefaultVisit(labelledStatement));
 }
示例#19
0
 protected override void Visit(LabelledStatement node)
 {
     Encode(node, Member("label", node.Label), Member("body", node.Body));
 }