MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / eval

Method eval

src/ast/ast_const_folding.cpp:336–351  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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);

Callers

nothing calls this directly

Calls 3

simulateExpressionFunction · 0.85
evalWithCatchMethod · 0.80
v_zeroFunction · 0.50

Tested by

no test coverage detected