refactor: switch Context <-> Scope concepts

This commit is contained in:
harttle
2019-03-25 10:36:23 +08:00
parent 76345a64c3
commit 45e3c2bb8e
34 changed files with 272 additions and 272 deletions
+4 -4
View File
@@ -1,6 +1,6 @@
import { evalExp } from '../render/syntax'
import { FilterArgs, Filter } from './filter/filter'
import Scope from '../scope/scope'
import Context from '../context/context'
export default class Value {
private strictFilters: boolean
@@ -47,10 +47,10 @@ export default class Value {
}
this.filters.push(new Filter(name, args, this.strictFilters))
}
async value (scope: Scope) {
let val = await evalExp(this.initial, scope)
async value (ctx: Context) {
let val = await evalExp(this.initial, ctx)
for (const filter of this.filters) {
val = await filter.render(val, scope)
val = await filter.render(val, ctx)
}
return val
}