Description
I have a question about how to determine the type of an object with uninitialized fields, as a continuation of the discussion in PR #3383.
Let’s assume the execution process of the program below:
new Promise(function () {});
This program follows the step of 27.2.3.1 Promise ( executor ) during execution. In step 8, it calls 27.2.1.3 CreateResolvingFunctions( promise ) with an argument _promise_
, whose [[PromiseResult]]
field is uninitialized. In this example, the annotated parameter type of the callee is a Promise, and 27.2.6 Properties of Promise Instances says the [[PromiseResult]]
field of a promise instance should hold an ECMAScript language value.
I'm unsure if we can interpret the actual argument above as a Promise.
Similarly, the same JavaScript program also follows the steps of 27.5.3.8 CreateIteratorFromClosure ( closure, generatorBrand, generatorPrototype [ , extraSlots ] ). It calls27.5.3.1 GeneratorStart ( generator, generatorBody ) in step 14. The passed argument _generator_
has an uninitialized [[GeneratorContext]]
field, which should be initialized in this case.
Additionally, I'm aware of the following statement:
Unless specified otherwise, the initial value of an internal slot is the value undefined.
which is specified in 6.1.7.2 Object Internal Methods and Internal Slots. Does this statement mean that the value of uninitialized field should be considered as undefined
in case of type determination of an object?