Skip to content

Remove uninit value#303

Merged
jhnaldo merged 1 commit intodevfrom
rm-uninit
Jul 22, 2025
Merged

Remove uninit value#303
jhnaldo merged 1 commit intodevfrom
rm-uninit

Conversation

@jhnaldo
Copy link
Copy Markdown
Contributor

@jhnaldo jhnaldo commented Jul 22, 2025

Instead of using the uninit value for not-yet-initialized fields for records, we initialize fields with undefined as described Object Internal Methods and Internal Slots in ECMA-262:

Unless specified otherwise, the initial value of an internal slot is the value undefined.

While it describes the initial value only for internal slots of objects, we apply this interpretation to fields of any records. Therefore, this PR updates the contains check for field types as follows:

 def contains(v: Option[Value], heap: Heap): Boolean = v match
    case Some(Undef)        => true // Undef represents uninitialized value
    case Some(value: Value) => this.value.contains(value, heap)
    case None               => this.absent
}

@jhnaldo jhnaldo merged commit b579434 into dev Jul 22, 2025
6 checks passed
@jhnaldo jhnaldo deleted the rm-uninit branch July 22, 2025 17:33
@stonechoe stonechoe mentioned this pull request Jul 31, 2025
@jhnaldo jhnaldo added area:ir Related to intermediate representation (IR) refactor Refactor the code labels Jan 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ir Related to intermediate representation (IR) refactor Refactor the code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant