• Sigurd Schneider's avatar
    [torque] Introduce @abstract annotation for Torque classes · 4d05884e
    Sigurd Schneider authored
    This annotation indicates that the class itself is not instantiated,
    and does not have its own instance type: The instance types that
    logically belong to the class are the instance types of the derived
    classes.
    
    Currently, we need the indication @dirtyInstantiatedAbstractClass
    for several classes that are used as both, abstract base classes
    and concrete classes. The prime example is JSObject which is the
    base for many other classes, and also serves as the class to allocate
    plain JSObjects. The annotation is purposefully ugly because in the
    future we should refactor code to make it unnecessary.
    
    Another annotation we introduce is @hasSameInstanceTypeAsParent,
    which indicates another design pattern that currently occurs in the
    code-base: Some Torque classes have the same instance types as their
    parent class, but rename some fields, or possibly have a different map.
    In such cases, the parent class is not abstract and the derived classes
    can be seen as refinements of this class (that, for example, narrows the
    type of a field). In the future, Torque should accomodate this pattern
    better, but at moment we are content with just indicating where it is
    used.
    
    Bug: v8:7793
    Change-Id: I1892dcc7325250df75d80308bf3d767d6d43bcc2
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1607761
    Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
    Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#61495}
    4d05884e
js-collection.h 4.81 KB