eclipse / n4js

Eclipse Public License 1.0
30 stars 27 forks source link

As a developer I want support for the ES2018 spread operator in object literals #1337

Open mor-n4 opened 5 years ago

mor-n4 commented 5 years ago

As a developer I want to make use of the ES2015 spread operator in object literals (not in array literals #1378 or call expressions #1377).

Syntax is already in place (see #46). This task is about adding support in the type system, transpiler, etc.

See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax

NOTE: the challenge is to find a good way to deal with the properties created from such a spread operator within the internal representation of the types model (see TStructuralType in Types.xcore). One possible solution might(!) be to let a TStructuralType refer to the types that were "patched in" via spread, similar to inheritance.

ACs

  1. Adjust type system.
  2. Adjust transpiler.
    • Discuss whether we should transpiler spread in object literals to ES6.
  3. Remove obsolete "unsupported feature" error message for spread operator.
  4. Make sure hyperlinks, content assist, etc. are working (as far as possible) with types created from object literals that contain a spread operator.
  5. Tests.
  6. Update documentation.
mor-n4 commented 5 years ago

Note: some places in the code are already marked with TODO GH-1337.