Join new properties with empty rather than undefined (#414)

This commit is contained in:
Herman Venter 2017-04-17 14:32:18 -07:00 committed by GitHub
parent f99e4b4a75
commit fb14d00846
2 changed files with 8 additions and 3 deletions

View File

@ -309,15 +309,15 @@ export function joinDescriptors(realm: Realm,
throw new Error("TODO: join computed properties");
let dc = cloneDescriptor(d);
invariant(dc !== undefined);
dc.value = getAbstractValue(d.value, undefined);
dc.value = getAbstractValue(d.value, realm.intrinsics.empty);
return dc;
}
if (d1 === undefined) {
if (d2 === undefined) return undefined;
// d2 is a new property created in only one branch, join with undefined
// d2 is a new property created in only one branch, join with empty
return clone_with_abstract_value(d2);
} else if (d2 === undefined) {
// d1 is a new property created in only one branch, join with undefined
// d1 is a new property created in only one branch, join with empty
return clone_with_abstract_value(d1);
} else {
let d3 : Descriptor = { };

View File

@ -0,0 +1,5 @@
var c = global.__abstract ? __abstract("boolean", "false") : false;
a = {};
if (c) a.f = a;
inspect = function() { return 'f' in a; }