• Daniel Clifford's avatar
    [torque]: Implement structs · 1062ffb9
    Daniel Clifford authored
    Struct are bundles of value types. They are essentially just shorthand
    for passing around a group of individually defined values.
    
    Struct types are declared like this:
    
      struct A {
        x: Smi;
        y: int32;
      }
    
    and can be constructed explicitly like this:
    
      A{0, 0}
    
    Structs can be used wherever other types are used (e.g. variables,
    parameters, return values) except for parameter/return types of
    builtins and runtime functions.
    
    Struct use field access notation to set/get their values like this:
    
      let a: A = A{0, 0};
      let b: Smi = a.x;
      a.y = 0;
    
    Change-Id: I9fd36a6514c37882831256a49a50809c5db75b56
    Reviewed-on: https://chromium-review.googlesource.com/1122133
    Commit-Queue: Daniel Clifford <danno@chromium.org>
    Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#54501}
    1062ffb9
declarable.cc 2.36 KB