def GetFunctionRealm(
obj: FunctionObject,
): Normal[RealmRecord] | Abrupt {
if (! (= obj.Realm absent)) {
return obj.Realm
} else {}
// before this change, FunctionObject is not related with BoundFunctionExoticObject
// so this condition **was** evaluated as `Bot`, after fix, more analysis after this condition can be done.
if (? obj: "BoundFunctionExoticObject") {
let target = obj.BoundTargetFunction
call %0 = clo<GetFunctionRealm>(target)
return [? %0]
} else {}
...
PrepareForOrdinaryCall: just state diff
def PrepareForOrdinaryCall(
F: FunctionObject,
newTarget: Object | Undefined,
): ExecutionContext {
let callerContext = @EXECUTION_STACK[0]
let calleeContext = (new ExecutionContext())
calleeContext.Function = F
// before this change, both two subtype of FunctionObject (ECMAScriptFunctionObject, BuiltinFunctionObject) all have `Realm` internal slot.
// but BoundFunctionExoticObject doesn't have `Realm` internal slot and, in this fix, becomes subtype of `FunctionObject`.
// so F.Realm is now evaluated as `RealmRecord | Absent`, which was `RealmRecord` only.
let calleeRealm = F.Realm
Implements refining object on property assignment (diff with monkey-patched one)
error: 260 → 252 (-8)
# of analyzed nodes are same.
Reduced errors
These errors are resolved as subtype refinement.
4,6d3
< [ParamTypeMismatch] argument assignment to first parameter _F_ when function call from OrdinaryFunctionCreate (step 22, 23:20-49) to SetFunctionLength <Call[4555]>
< - expected: FunctionObject
< - actual : OrdinaryObject
658,660d654
< [ReturnTypeMismatch] return statement in ArrayCreate (step 7, 8:14-25) <Block[4797]>
< - expected: Normal[ArrayExoticObject] | Abrupt
< - actual : Normal[Object]
673,675d666
< [ReturnTypeMismatch] return statement in BoundFunctionCreate (step 10, 12:14-27) <Block[4766]>
< - expected: Normal[FunctionObject] | Abrupt
< - actual : Normal[Object]
685,687d675
< [ReturnTypeMismatch] return statement in CreateMappedArgumentsObject (step 22, 34:14-27) <Block[5021]>
< - expected: ArgumentsExoticObject
< - actual : Object
733,735d720
< [ReturnTypeMismatch] return statement in IntegerIndexedObjectCreate (step 11, 12:14-25) <Block[5112]>
< - expected: IntegerIndexedExoticObject
< - actual : Object
739,741d723
< [ReturnTypeMismatch] return statement in ModuleNamespaceCreate (step 10, 11:14-25) <Block[5218]>
< - expected: ModuleNamespaceExoticObject
< - actual : Object
760,762d741
< [ReturnTypeMismatch] return statement in ProxyCreate (step 8, 12:12-23) <Block[5578]>
< - expected: Normal[ProxyExoticObject] | Abrupt
< - actual : Normal[Object]
772,774d750
< [ReturnTypeMismatch] return statement in StringCreate (step 9, 10:14-25) <Block[4894]>
< - expected: StringExoticObject
< - actual : Object
Return type and state changes in analysis
Total 27 changes in return type
All of these changes seem valid, at least these are in subtype relations.
This PR includes two changes below:
BoundFunctionExoticObject
Each change makes diff in analysis:
Adds monkey-patching for
BoundFunctionExoticObject
iter: 70,202 → 70,209 nodes: 16,307 → 16,313/20,020 (81.45% → 81.48%)
GetFunctionRealm: more analysis done
PrepareForOrdinaryCall: just state diff
Implements refining object on property assignment (diff with monkey-patched one)
error: 260 → 252 (-8) # of analyzed nodes are same.
Reduced errors
These errors are resolved as subtype refinement.
Return type and state changes in analysis
Total 27 changes in return type All of these changes seem valid, at least these are in subtype relations.