mirror of
https://github.com/facebookarchive/prepack.git
synced 2024-08-17 10:30:32 +03:00
Compose subsequent effects with currently applied affects (#2271)
Summary: Release note: none This fixes a problem reported as a comment in PR #2258. The underlying problem was that Realm.evaluateForEffects would just append the normal effects, captured since the last non complete join, into the saved partially normal completion that becomes the result of the returned Effects. This is not quite right because applying the resulting Effects should restore the complete set of normal effects that were in force when evaluateForEffects completed. Pull Request resolved: https://github.com/facebook/prepack/pull/2271 Differential Revision: D8870763 Pulled By: hermanventer fbshipit-source-id: 027924f2b250174393c60d90c2feefdb5a55eec3
This commit is contained in:
parent
bad3985f54
commit
2dc8607269
@ -306,7 +306,7 @@ function callNativeFunctionValue(
|
||||
mightBecomeAnObject(contextVal)
|
||||
);
|
||||
let completion = f.callCallback(
|
||||
// this is to get around Flow not understand the above invariant
|
||||
// this is to get around Flow not understanding the above invariant
|
||||
((contextVal: any): AbstractObjectValue | ObjectValue | NullValue | UndefinedValue),
|
||||
argumentsList,
|
||||
env.environmentRecord.$NewTarget
|
||||
|
@ -877,6 +877,7 @@ export class Realm {
|
||||
this.stopEffectCaptureAndUndoEffects(c);
|
||||
Join.updatePossiblyNormalCompletionWithSubsequentEffects(this, c, subsequentEffects);
|
||||
this.savedCompletion = undefined;
|
||||
this.applyEffects(subsequentEffects, "subsequentEffects", true);
|
||||
}
|
||||
|
||||
invariant(this.generator !== undefined);
|
||||
|
19
test/serializer/optimized-functions/ObjectAssign9.js
Normal file
19
test/serializer/optimized-functions/ObjectAssign9.js
Normal file
@ -0,0 +1,19 @@
|
||||
function fn2(shouldError) {
|
||||
if (shouldError) {
|
||||
throw new Error("Error");
|
||||
}
|
||||
return {
|
||||
thisValueShouldExist: true,
|
||||
};
|
||||
}
|
||||
|
||||
function fn(shouldError) {
|
||||
var a = Object.assign({}, fn2(shouldError));
|
||||
return a.thisValueShouldExist;
|
||||
}
|
||||
|
||||
this.__optimize && __optimize(fn);
|
||||
|
||||
inspect = function() {
|
||||
return fn(false);
|
||||
};
|
Loading…
Reference in New Issue
Block a user