Inheritance: System.Compiler.Statement
Exemple #1
0
 private AssertStatement VisitAssert(AssertStatement assert)
 {
     assert.booleanExpr = this.VisitExpression(assert.booleanExpr);
     return assert;
 }
Exemple #2
0
 private AssertStatement VisitAssert(AssertStatement assert)
 {
     if (assert.Comment != null)
     {
         WriteStart("assert(");
         this.VisitExpression(assert.booleanExpr);
         Write(", @\"{0}\"", assert.Comment.Replace("\"", "\"\""));
         WriteFinish(");");
     }
     else
     {
         WriteStart("assert");
         this.VisitParenthesizedExpression(assert.booleanExpr);
         WriteFinish(";");
     }
     return assert;
 }
Exemple #3
0
        //
        // Handle code generation unique to various Zing statements
        //
        private Statement VisitAssert(AssertStatement assert)
        {
            Statement assertStmt;

            assertStmt = Templates.GetStatementTemplate(
                assert.Comment != null ? "AssertWithComment" : "AssertWithoutComment");

            Replacer.Replace(assertStmt, "_exprString", new Literal(assert.booleanExpr.SourceContext.SourceText, SystemTypes.String));
            Replacer.Replace(assertStmt, "_expr", this.VisitExpression(assert.booleanExpr));

            if (assert.Comment != null)
                Replacer.Replace(assertStmt, "_comment", new Literal(assert.Comment, SystemTypes.String));

            return assertStmt;
        }
Exemple #4
0
 private AssertStatement VisitAssert(AssertStatement assert)
 {
     if (assert == null) return null;
     AssertStatement result = (AssertStatement)assert.Clone();
     result.booleanExpr = this.VisitExpression(assert.booleanExpr);
     return result;
 }
Exemple #5
0
        private AssertStatement VisitAssert(AssertStatement assert)
        {
            BasicBlock block = AddBlock(new BasicBlock(assert, CurrentContinuation));
            CurrentContinuation = block;

            return assert;
        }
Exemple #6
0
        private AssertStatement VisitAssert(AssertStatement assert)
        {
            if (assert == null) return null;
            assert.booleanExpr = this.VisitExpression(assert.booleanExpr);

            if (assert.booleanExpr == null)
                return null;

            if (assert.booleanExpr.Type != SystemTypes.Boolean)
            {
                this.HandleError(assert, Error.BooleanExpressionRequired);
                return null;
            }
            return assert;
        }
Exemple #7
0
 private AssertStatement VisitAssert(AssertStatement assert)
 {
     if (assert == null) return null;
     assert.booleanExpr = this.VisitExpression(assert.booleanExpr);
     return assert;
 }