Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Commit

Permalink
Release Note: invalid argument error of __evaluatePureFunction functi…
Browse files Browse the repository at this point in the history
…on is changed from InvariantError to CompilerDiagnostics Error
  • Loading branch information
rahilvora committed Aug 12, 2018
1 parent 93d2026 commit 46c30a1
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/intrinsics/prepack/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,14 +227,20 @@ export default function(realm: Realm): void {
"__evaluatePureFunction",
0,
(context, [functionValue]) => {
invariant(functionValue instanceof ECMAScriptSourceFunctionValue);
invariant(typeof functionValue.$Call === "function");
let functionCall: Function = functionValue.$Call;
return realm.evaluatePure(
() => functionCall(realm.intrinsics.undefined, []),
/*bubbles*/ true,
/*reportSideEffectFunc*/ null
);
if (functionValue instanceof ECMAScriptSourceFunctionValue && typeof functionValue.$Call === "function") {
let functionCall: Function = functionValue.$Call;
return realm.evaluatePure(
() => functionCall(realm.intrinsics.undefined, []),
/*bubbles*/ true,
/*reportSideEffectFunc*/ null
);
} else {
let result = realm.handleError(
new CompilerDiagnostic(`CompilerDiagnostic Error`, realm.currentLocation, "PP1005", "Warning")
);
if (result === "Fail") throw new FatalError("CompilerDiagnostic Error");
else return realm.intrinsics.undefined;
}
}
),
writable: true,
Expand Down

0 comments on commit 46c30a1

Please sign in to comment.