Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/topic/robin/gh-1063-sink-docs'
Browse files Browse the repository at this point in the history
* origin/topic/robin/gh-1063-sink-docs:
  Document arguments to `new` operator.
  • Loading branch information
rsmmr committed Oct 21, 2024
2 parents 393f524 + a20cd28 commit fff3531
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 13 deletions.
6 changes: 6 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
1.12.0-dev.156 | 2024-10-21 15:50:46 +0200

* GH-1063: Document arguments to `new` operator. (Robin Sommer, Corelight)

* GH-1858: Fix the literals parsers not following coercions. (Robin Sommer, Corelight)

1.12.0-dev.152 | 2024-10-18 15:31:40 +0200

* GH-1891: Fix GCC 11 compilation failure. (Evan Typanski, Corelight)
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.12.0-dev.152
1.12.0-dev.156
8 changes: 5 additions & 3 deletions doc/autogen/types/generic-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
Returns a :ref:`reference <type_reference>` to an instance of a type
newly allocated on the heap. If ``T`` is a type, a default instance of
that type will be allocated. If ``T`` is a constant, an instance of
its type will be allocated and initialized with the value. Other types
of expressions are not allowed.
that type will be allocated. If the type expects any parameters, they
must be provided through a corresponding argument tuple: ``new
T(ARG_1, ... ,ARG_N)``. If ``T`` is a constant, an instance of its
type will be allocated and initialized with the value. Other types of
expressions are not allowed.

8 changes: 5 additions & 3 deletions doc/autogen/types/generic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
Returns a :ref:`reference <type_reference>` to an instance of a type
newly allocated on the heap. If ``T`` is a type, a default instance of
that type will be allocated. If ``T`` is a constant, an instance of
its type will be allocated and initialized with the value. Other types
of expressions are not allowed.
that type will be allocated. If the type expects any parameters, they
must be provided through a corresponding argument tuple: ``new
T(ARG_1, ... ,ARG_N)``. If ``T`` is a constant, an instance of its
type will be allocated and initialized with the value. Other types of
expressions are not allowed.

.. spicy:operator:: generic::Pack bytes pack <sp> t:tuple
Expand Down
2 changes: 1 addition & 1 deletion doc/programming/parsing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1971,7 +1971,7 @@ Here's a basic example of two units types chained through a sink:
Let's see what's going on here. First, there's ``sink b`` inside the
declaration of ``A``. That's the connector, kept as state inside
``A``. When parsing for ``A`` is about to begin, the ``%init`` hook
connects the sink to a new instance of ``B``; that'll be the receiver
connects the sink to a :ref:`new instance <operator_new>` of ``B``; that'll be the receiver
for data that ``A`` is going to write into the sink. That writing
happens inside the field hook for ``data``: once we have parsed that
field, we write what will go to the sink using its built-in
Expand Down
12 changes: 7 additions & 5 deletions hilti/toolchain/src/ast/operators/generic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,13 @@ class New : public Operator {
.result_doc = "T&",
.ns = "generic",
.doc = R"(
Returns a :ref:`reference <type_reference>` to an instance of a type newly
allocated on the heap. If ``T`` is a type, a default instance of that type will
be allocated. If ``T`` is a constant, an instance of its type will be
allocated and initialized with the value. Other types of expressions are not
allowed.
Returns a :ref:`reference <type_reference>` to an instance of a type
newly allocated on the heap. If ``T`` is a type, a default instance of
that type will be allocated. If the type expects any parameters, they
must be provided through a corresponding argument tuple: ``new
T(ARG_1, ... ,ARG_N)``. If ``T`` is a constant, an instance of its type
will be allocated and initialized with the value. Other types of
expressions are not allowed.
)",
};
}
Expand Down

0 comments on commit fff3531

Please sign in to comment.