FoldKnownValues adds an Activation which provides known values for the folding evaluator Any values the activation provides will be used by the constant folder and turned into literals in the AST. Defaults to the NoVars() Activation
(knownValues Activation)
| 47 | // |
| 48 | // Defaults to the NoVars() Activation |
| 49 | func FoldKnownValues(knownValues Activation) ConstantFoldingOption { |
| 50 | return func(opt *constantFoldingOptimizer) (*constantFoldingOptimizer, error) { |
| 51 | if knownValues != nil { |
| 52 | opt.knownValues = knownValues |
| 53 | } else { |
| 54 | opt.knownValues = NoVars() |
| 55 | } |
| 56 | return opt, nil |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | // NewConstantFoldingOptimizer creates an optimizer which inlines constant scalar an aggregate |
| 61 | // literal values within function calls and select statements with their evaluated result. |