v8/src/torque
Daniel Clifford 62a3280563 [torque] Indexed class field initialization
Indexed fields in classes can now be initialized using iterators
and a spread syntax, e.g.:

  class Foo {
    length: Smi;
    elements[length]: Object;
  }

  new Foo{length: 5, elements: ...iter};

where iter implements Torque's iterator protocol. This protocol
requires the definition of a method with the following signature:

  Next(): <type> labels NoMore;

Where <type> is the Torque type of the values to be iterated.
In the case of indexed field initialization, the type must be
the field's type or a subtype thereof.

Field initialization with spread is desugared into a loop that
calls the spread iterator's Next method and assigns each
returned value in order to the corresponding indexed field
element.

The general machinery for the spread syntax has been added to
the ast and parser, however, it can currently only be used in
the specific context of indexed field initialization. Spread
operators used in any other context will cause an error.

Bug: v8:7793
Change-Id: If071e61db8166573c28d13318879c88ba96f6d98
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1550407
Commit-Queue: Daniel Clifford <danno@chromium.org>
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60639}
2019-04-04 17:58:59 +00:00
..
ls Revert "[torque] Throw exception instead of aborting if something goes wrong" 2019-03-28 16:26:24 +00:00
ast.h [torque] Indexed class field initialization 2019-04-04 17:58:59 +00:00
cfg.cc [torque] compute fixed-point when typing Torque IR 2018-11-13 15:06:20 +00:00
cfg.h [torque] compute fixed-point when typing Torque IR 2018-11-13 15:06:20 +00:00
contextual.h v8: Fix -Wextra-semi warnings, enable warning. 2019-02-13 14:11:28 +00:00
csa-generator.cc [torque] Remove constexpr from Arguments object type 2019-04-03 12:12:56 +00:00
csa-generator.h Reland "[Torque] Add source positions for Torque files" 2019-02-18 12:20:07 +00:00
declarable.cc [torque] Add SourcePosition field to TypeAlias 2019-03-04 14:20:51 +00:00
declarable.h [torque] Add SourcePosition field to TypeAlias 2019-03-04 14:20:51 +00:00
declaration-visitor.cc [torque]: Allow const-qualified struct and class fields 2019-04-03 10:55:33 +00:00
declaration-visitor.h [torque] Add SourcePosition field to TypeAlias 2019-03-04 14:20:51 +00:00
declarations.cc [torque-ls] Support "goto-definition" for Types in extends clause 2019-03-12 09:21:44 +00:00
declarations.h [torque-ls] Support "goto-definition" for Types in extends clause 2019-03-12 09:21:44 +00:00
earley-parser.cc [torque-ls] Port tests from cctest to unittest 2019-03-04 17:04:02 +00:00
earley-parser.h [torque] named arguments for constructors 2019-04-04 06:26:51 +00:00
file-visitor.cc [torque] cleanup generics and scopes 2018-11-05 11:49:40 +00:00
file-visitor.h [torque] Implement methods and constructors for structs and classes 2019-01-16 17:13:13 +00:00
global-context.h [torque] Introduce LanguageServerData class 2019-02-28 12:11:24 +00:00
implementation-visitor.cc [torque] Indexed class field initialization 2019-04-04 17:58:59 +00:00
implementation-visitor.h [torque] Indexed class field initialization 2019-04-04 17:58:59 +00:00
instructions.cc [torque]: Class declarations 2019-01-10 14:32:50 +00:00
instructions.h Reland "[build][torque] remove workarounds for clang bug" 2019-01-25 10:55:36 +00:00
parameter-difference.h
server-data.cc [torque] Introduce LanguageServerData class 2019-02-28 12:11:24 +00:00
server-data.h [torque-ls] Port tests from cctest to unittest 2019-03-04 17:04:02 +00:00
source-positions.cc
source-positions.h [torque-ls] Allow compilation of plain std::string inputs 2019-03-06 08:50:52 +00:00
torque-compiler.cc Revert "[torque] Throw exception instead of aborting if something goes wrong" 2019-03-28 16:26:24 +00:00
torque-compiler.h Revert "[torque] Throw exception instead of aborting if something goes wrong" 2019-03-28 16:26:24 +00:00
torque-parser.cc [torque] Indexed class field initialization 2019-04-04 17:58:59 +00:00
torque-parser.h [torque]: Class declarations 2019-01-10 14:32:50 +00:00
torque.cc Revert "[torque] Throw exception instead of aborting if something goes wrong" 2019-03-28 16:26:24 +00:00
type-oracle.cc
type-oracle.h [torque] Implement simple automatic index operators 2019-02-18 10:04:34 +00:00
types.cc [torque] Simplify class and struct construction 2019-02-27 17:36:37 +00:00
types.h [torque] Indexed class field initialization 2019-04-04 17:58:59 +00:00
utils.cc [torque] named arguments for constructors 2019-04-04 06:26:51 +00:00
utils.h Revert "[torque] Throw exception instead of aborting if something goes wrong" 2019-03-28 16:26:24 +00:00