docs: Consistent index entries for literals, denominations, free functions

This commit is contained in:
Kamil Śliwak 2023-04-13 17:12:35 +02:00
parent bc18af91bb
commit cab88290c2
8 changed files with 21 additions and 11 deletions

View File

@ -1,4 +1,4 @@
.. index:: ! functions .. index:: ! functions, ! function;free
.. _functions: .. _functions:

View File

@ -1,4 +1,4 @@
.. index:: ! using for, library, ! operator; user-defined .. index:: ! using for, library, ! operator;user-defined, function;free
.. _using-for: .. _using-for:

View File

@ -173,7 +173,6 @@ parameters from the function declaration, but can be in arbitrary order.
function set(uint key, uint value) public { function set(uint key, uint value) public {
data[key] = value; data[key] = value;
} }
} }
Omitted Names in Function Definitions Omitted Names in Function Definitions

View File

@ -130,6 +130,7 @@ If the array is shorter than the target type, it will be padded with zeros at th
} }
} }
.. index:: ! literal;conversion, literal;rational, literal;hexadecimal number
.. _types-conversion-literals: .. _types-conversion-literals:
Conversions between Literals and Elementary Types Conversions between Literals and Elementary Types
@ -152,6 +153,8 @@ that is large enough to represent it without truncation:
converted to an integer type. From 0.8.0, such explicit conversions are as strict as implicit converted to an integer type. From 0.8.0, such explicit conversions are as strict as implicit
conversions, i.e., they are only allowed if the literal fits in the resulting range. conversions, i.e., they are only allowed if the literal fits in the resulting range.
.. index:: literal;string, literal;hexadecimal
Fixed-Size Byte Arrays Fixed-Size Byte Arrays
---------------------- ----------------------
@ -182,6 +185,8 @@ if their number of characters matches the size of the bytes type:
bytes2 e = "x"; // not allowed bytes2 e = "x"; // not allowed
bytes2 f = "xyz"; // not allowed bytes2 f = "xyz"; // not allowed
.. index:: literal;address
Addresses Addresses
--------- ---------

View File

@ -235,7 +235,7 @@ with the :ref:`default value<default-value>`.
} }
} }
.. index:: ! array;literals, ! inline;arrays .. index:: ! literal;array, ! inline;arrays
Array Literals Array Literals
^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^

View File

@ -423,7 +423,7 @@ Dynamically-sized byte array
``string``: ``string``:
Dynamically-sized UTF-8-encoded string, see :ref:`arrays`. Not a value-type! Dynamically-sized UTF-8-encoded string, see :ref:`arrays`. Not a value-type!
.. index:: address, literal;address .. index:: address, ! literal;address
.. _address_literals: .. _address_literals:
@ -439,7 +439,7 @@ an error. You can prepend (for integer types) or append (for bytesNN types) zero
.. note:: .. note::
The mixed-case address checksum format is defined in `EIP-55 <https://github.com/ethereum/EIPs/blob/master/EIPS/eip-55.md>`_. The mixed-case address checksum format is defined in `EIP-55 <https://github.com/ethereum/EIPs/blob/master/EIPS/eip-55.md>`_.
.. index:: literal, literal;rational .. index:: integer, rational number, ! literal;rational
.. _rational_literals: .. _rational_literals:
@ -517,7 +517,7 @@ regardless of the type of the right (exponent) operand.
uint128 a = 1; uint128 a = 1;
uint128 b = 2.5 + a + 0.5; uint128 b = 2.5 + a + 0.5;
.. index:: literal, literal;string, string .. index:: ! literal;string, string
.. _string_literals: .. _string_literals:
String Literals and Types String Literals and Types
@ -564,6 +564,8 @@ character sequence ``abcdef``.
Any Unicode line terminator which is not a newline (i.e. LF, VF, FF, CR, NEL, LS, PS) is considered to Any Unicode line terminator which is not a newline (i.e. LF, VF, FF, CR, NEL, LS, PS) is considered to
terminate the string literal. Newline only terminates the string literal if it is not preceded by a ``\``. terminate the string literal. Newline only terminates the string literal if it is not preceded by a ``\``.
.. index:: ! literal;unicode
Unicode Literals Unicode Literals
---------------- ----------------
@ -574,7 +576,7 @@ They also support the very same escape sequences as regular string literals.
string memory a = unicode"Hello 😃"; string memory a = unicode"Hello 😃";
.. index:: literal, bytes .. index:: ! literal;hexadecimal, bytes
Hexadecimal Literals Hexadecimal Literals
-------------------- --------------------

View File

@ -1,8 +1,10 @@
.. index:: ! denomination
************************************** **************************************
Units and Globally Available Variables Units and Globally Available Variables
************************************** **************************************
.. index:: wei, finney, szabo, gwei, ether .. index:: ! wei, ! finney, ! szabo, ! gwei, ! ether, ! denomination;ether
Ether Units Ether Units
=========== ===========
@ -21,7 +23,7 @@ The only effect of the subdenomination suffix is a multiplication by a power of
.. note:: .. note::
The denominations ``finney`` and ``szabo`` have been removed in version 0.7.0. The denominations ``finney`` and ``szabo`` have been removed in version 0.7.0.
.. index:: time, seconds, minutes, hours, days, weeks, years .. index:: ! seconds, ! minutes, ! hours, ! days, ! weeks, ! years, ! denomination;time
Time Units Time Units
========== ==========
@ -52,7 +54,7 @@ interpret a function parameter in days, you can in the following way:
function f(uint start, uint daysAfter) public { function f(uint start, uint daysAfter) public {
if (block.timestamp >= start + daysAfter * 1 days) { if (block.timestamp >= start + daysAfter * 1 days) {
// ... // ...
} }
} }

View File

@ -166,6 +166,8 @@ Inside a code block, the following elements can be used
Multiple syntactical elements can follow each other simply separated by Multiple syntactical elements can follow each other simply separated by
whitespace, i.e. there is no terminating ``;`` or newline required. whitespace, i.e. there is no terminating ``;`` or newline required.
.. index:: ! literal;in Yul
Literals Literals
-------- --------