refactor: rewrite expression evaluation, fix #130

This commit is contained in:
harttle
2019-08-26 10:15:43 -05:00
committed by Jun Yang
parent 538610e169
commit 76019e9e18
31 changed files with 407 additions and 246 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
import { parseExp } from '../render/syntax'
import { Expression } from '../render/expression'
import { FilterArgs, Filter } from './filter/filter'
import { Context } from '../context/context'
@@ -48,7 +48,7 @@ export class Value {
this.filters.push(new Filter(name, args, this.strictFilters))
}
public value (ctx: Context) {
let val = parseExp(this.initial, ctx)
let val = new Expression(this.initial).evaluate(ctx)
for (const filter of this.filters) {
val = filter.render(val, ctx)
}