Skip to content

Commit

Permalink
Remove getter existence check from assignCommonNamespaceHandlerTraps(…
Browse files Browse the repository at this point in the history
…) error guard. [closes #773]
  • Loading branch information
jdalton committed Mar 30, 2019
1 parent 0799513 commit a48ba8a
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -708,10 +708,16 @@ function assignCommonNamespaceHandlerTraps(handler, entry, proxy) {
const getter = getters[name]
const hasGetter = getter !== void 0

const errored =
! hasGetter ||
entry._namespaceFinalized !== NAMESPACE_FINALIZATION_COMPLETED ||
getter() === ERROR_GETTER
let getterValue
let errored = entry._namespaceFinalized !== NAMESPACE_FINALIZATION_COMPLETED
let getterCalled = false

if (! errored &&
hasGetter) {
getterCalled = true
getterValue = getter()
errored = getterValue === ERROR_GETTER
}

if (errored &&
typeof name === "string" &&
Expand All @@ -728,7 +734,9 @@ function assignCommonNamespaceHandlerTraps(handler, entry, proxy) {
}

if (hasGetter) {
return getter()
return getterCalled
? getterValue
: getter()
}

if (receiver === proxy) {
Expand Down

0 comments on commit a48ba8a

Please sign in to comment.