This commit is contained in:
harttle
2018-07-16 15:02:31 +08:00
parent d0fb5ccece
commit 02806b2257
2 changed files with 20 additions and 12 deletions
+11 -9
View File
@@ -56,15 +56,17 @@ var Scope = {
}
var key = paths.shift()
var value = getValueFromScopes(key, scopes)
return paths.reduce(
(value, key) => {
if (_.isNil(value)) {
throw new TypeError('undefined variable: ' + key)
}
return getValueFromParent(key, value)
},
value
)
if (_.isNil(value)) {
throw new TypeError('undefined variable: ' + key)
}
while (paths.length) {
key = paths.shift()
value = getValueFromParent(key, value)
if (_.isNil(value)) {
throw new TypeError('undefined variable: ' + key)
}
}
return value
},
/*