| 334 | }; |
| 335 | |
| 336 | vec4f FoldingVisitor::eval ( Expression * expr, bool & failed ) { |
| 337 | ctx.restart(); |
| 338 | ctx.thisProgram = program; |
| 339 | auto node = simulateExpression(ctx, expr); |
| 340 | ctx.restart(); |
| 341 | auto fb = program->folding; |
| 342 | vec4f result = ctx.evalWithCatch(node); |
| 343 | program->folding = fb; |
| 344 | if ( ctx.getException() ) { |
| 345 | failed = true; |
| 346 | return v_zero(); |
| 347 | } else { |
| 348 | failed = false; |
| 349 | return result; |
| 350 | } |
| 351 | } |
| 352 | |
| 353 | ExpressionPtr FoldingVisitor::evalAndFold ( Expression * expr ) { |
| 354 | if ( expr->type->baseType == Type::tString ) return evalAndFoldString(expr); |
nothing calls this directly
no test coverage detected