[torque] add const references and disallow const class field writes
- Allow type expression for abstract type supertypes. For consistency, and ease of implementation, also allow this for enums. - Allow subtyping of structs. This requires changing all places where we checked for struct types and instead check if we have a subtype of a struct type. - This allows defining two subtypes of the Reference<T> struct for mutable and constant references. Mutable references are a subtype of constant references. - &T desugars to MutableReference<T> const &T desugars to ConstReference<T> - A const field of a class produces a constant reference. A const field of a mutable reference to a struct is const. A mutable field of a const reference to a struct is const. - It is possible to assign a new struct value to a mutable reference to a struct, even if the struct contains const fields. This is analogous to allowing assignments of let-bound structs with constant fields. Not in this CL: - A notion of const slices. - Applying const to appropriate class fields. Bug: v8:7793 Change-Id: I6e7b09d44f54db25f8bf812be5f3b554b80414e0 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2096615Reviewed-by: Nico Hartmann <nicohartmann@chromium.org> Commit-Queue: Tobias Tebbi <tebbi@chromium.org> Cr-Commit-Position: refs/heads/master@{#66759}
Showing
This diff is collapsed.
Please
register
or
sign in
to comment