pineforge-codegen 1.11.0__tar.gz → 1.12.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/CHANGELOG.md +82 -1
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/PKG-INFO +1 -1
- pineforge_codegen-1.12.0/VERSION +1 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/docs/reference/file-map.md +3 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/docs/reference/known-codegen-quirks.md +5 -2
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/docs/reference/support-contracts.md +9 -2
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/analyzer/base.py +297 -41
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/analyzer/call_handlers.py +86 -36
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/analyzer/callable_history_names.py +118 -16
- pineforge_codegen-1.12.0/pineforge_codegen/analyzer/v6_forms.py +116 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/analyzer/value_bindings.py +6 -1
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/block_locals.py +56 -20
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/base.py +67 -25
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/checked_settings.py +9 -11
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/constant_values.py +69 -4
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/emit_top.py +65 -3
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/helpers.py +35 -1
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/input.py +33 -1
- pineforge_codegen-1.12.0/pineforge_codegen/codegen/retained_alias.py +315 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/security.py +15 -1
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/ta.py +13 -8
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/tables.py +45 -3
- pineforge_codegen-1.12.0/pineforge_codegen/codegen/tv_string_units.py +122 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/types.py +32 -10
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/visit_call.py +5 -1
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/visit_expr.py +23 -5
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/diagnostics_catalog.json +6 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/method_binding.py +7 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/parser.py +23 -4
- pineforge_codegen-1.11.0/VERSION +0 -1
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/.gitignore +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/CONTRIBUTING.md +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/LEGAL.md +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/LICENSE +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/README.md +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/docs/PUBLIC_CONTRACT.md +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/docs/ci.md +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/docs/codegen-coverage-gaps.md +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/docs/engine-main-ci.md +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/docs/pine-cap-activation.md +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/docs/reference/adding-a-pine-function.md +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/docs/reference/conventions.md +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/docs/reference/pipeline.md +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/__init__.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/analyzer/__init__.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/analyzer/contracts.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/analyzer/diagnostics.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/analyzer/operators.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/analyzer/qualifiers.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/analyzer/tables.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/analyzer/types.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/array_binding.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/ast_nodes.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/builtin_keywords.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/__init__.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/array_field_width.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/array_slice.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/ascii.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/bool_text.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/capabilities.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/capacities.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/closed_trade_fold.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/collection_history.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/color_constants.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/constant_fold.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/drawing.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/endless_for.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/for_loops.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/graph_journal.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/helpers_syminfo.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/history_sharing.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/host_members.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/id_sites.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/order_shapes.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/run_stops.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/session_market.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/strategy_declaration.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/timeframe_values.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/tv_number_format.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/visit_stmt.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/collection_history.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/cpp_allowlist.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/cpp_names.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/diagnostic_codes.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/drawing_all.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/errors.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/external_requests.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/finite_ta_length.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/function_overloads.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/input_keys.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/intrinsic_binding.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/lexer.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/library_inline.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/library_modules.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/library_v5.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/limits.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/loop_types.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/matrix_overloads.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/pine_libraries.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/pine_spelling.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/pragmas.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/request_discovery.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/request_feed_inventory.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/security_contexts.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/session_reads.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/signatures.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/support_checker.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/symbols.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/timeframe_token_cli.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/tokens.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pineforge_codegen/tv_input_choices.py +0 -0
- {pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/pyproject.toml +0 -0
|
@@ -22,16 +22,70 @@ supported as exact pairs; on the 0.x line they are independent. See the
|
|
|
22
22
|
|
|
23
23
|
## Unreleased (next release)
|
|
24
24
|
|
|
25
|
+
- Pine v6 reports located errors for a missing `color.new` transparency,
|
|
26
|
+
`fill(transp=...)`, calendar-number timestamp defaults in `input.time` with
|
|
27
|
+
a time zone string as the first timestamp argument or a `timezone` keyword,
|
|
28
|
+
literal plot widths below one, and variable or function declarations named
|
|
29
|
+
`range`.
|
|
30
|
+
- `input.string`, `input.timeframe`, `input.symbol`, `input.session` and
|
|
31
|
+
`input.text_area` carry never-reassigned global string literals into defaults
|
|
32
|
+
and options, including var declarations; an unproven variable default is now
|
|
33
|
+
a located error instead of a silent empty default, while an option that
|
|
34
|
+
cannot be proven keeps the existing unsupported marker in the manifest.
|
|
35
|
+
- Untyped history parameters now infer the enclosing call's primitive type
|
|
36
|
+
through immutable plain locals, fixed-result builtins and user-call variants
|
|
37
|
+
whose result the callee body proves, to the same type family as an explicit
|
|
38
|
+
parameter declaration.
|
|
39
|
+
- Pine v6 now refuses an `if` or `while` condition whose numeric value comes
|
|
40
|
+
from a `ta.*` call or a built-in variable such as `strategy.position_size`,
|
|
41
|
+
as TradingView does. Use a comparison such as `ta.change(t) != 0` for a bool
|
|
42
|
+
condition. Bool overloads and Pine v5 libraries keep their existing behavior. (#361)
|
|
43
|
+
- A Pine string literal that holds a NUL now keeps its whole length. Codegen
|
|
44
|
+
built every string literal with `std::string("...")`, which is made from a C
|
|
45
|
+
string and ends at the first NUL, so "a", NUL, "b" had length 1 (TradingView
|
|
46
|
+
gives 3), equalled its own one-letter prefix, and two literals that differed
|
|
47
|
+
only after the NUL compared equal. A literal with a NUL is now built with the
|
|
48
|
+
number of bytes it stands for; a literal without one is spelled as before, so
|
|
49
|
+
the generated code of every other script is unchanged. Not covered, and still
|
|
50
|
+
cut at the first NUL as before: the default and the options of the string
|
|
51
|
+
inputs (`input.string`, `input.symbol`, `input.session`, `input.timeframe`,
|
|
52
|
+
`input.text_area`), which the settings receipt and the manifest equal, an
|
|
53
|
+
input title, and the timeframe and footprint-column literals. One comparison
|
|
54
|
+
changes with it: a string input whose default holds a NUL no longer equals
|
|
55
|
+
the literal it was given, because the default is cut and the literal is not
|
|
56
|
+
(the two were equal before only because both were cut). A `var` that is read
|
|
57
|
+
with history and starts from a literal with a NUL was refused (its first
|
|
58
|
+
value put the NUL byte itself into the generated code); it now translates
|
|
59
|
+
and keeps the whole literal.
|
|
60
|
+
- Direct retained record fields built from stable `var` arrays, and direct
|
|
61
|
+
plain `var` array aliases, stay live through their creation bar and then
|
|
62
|
+
keep their own copy of the array as it stood at the end of that bar; two
|
|
63
|
+
holders built from one array do not share it. `copy()` of such a record
|
|
64
|
+
keeps its existing compile error. Requested evaluations, collection
|
|
65
|
+
history, nested records and intrabar recalculations keep their previous
|
|
66
|
+
lowering. Regenerate C++ and relink affected strategies.
|
|
25
67
|
- `str.format_time` now uses TradingView's documented defaults when arguments
|
|
26
68
|
are omitted: `"yyyy-MM-dd'T'HH:mm:ssZ"` for the format and the exchange time
|
|
27
69
|
zone (`syminfo.timezone`) for the timezone. Pass `"yyyy-MM-dd"` and `"UTC"`
|
|
28
70
|
explicitly to restore the previous output. Regenerate C++ and relink
|
|
29
71
|
affected strategies.
|
|
72
|
+
- `str.split(source, "")` with an empty separator now returns one part per
|
|
73
|
+
UTF-16 unit, as TradingView does: "axb" gives three parts, an accent or a CJK
|
|
74
|
+
character between two letters three, an emoji between two letters four (an
|
|
75
|
+
emoji is a high and a low surrogate, each kept as its own three-byte part).
|
|
76
|
+
It returned the whole string as one part, even for plain ASCII. The empty
|
|
77
|
+
text still has one part, as in TradingView. A separator that is not empty
|
|
78
|
+
splits as before, through the engine.
|
|
30
79
|
- A `when` argument on a strategy order call in Pine v6 now reports `PF-E2081`,
|
|
31
80
|
explaining that v6 removed the argument and recommending an `if` statement
|
|
32
81
|
around the call. Other unknown keywords keep `PF-E2027`.
|
|
33
82
|
- Pine identifiers spelled like generated state members or helpers use the C++ name allocator, including history-bearing locals in requested helpers.
|
|
34
|
-
- A
|
|
83
|
+
- A script variable spelled like one of the generator's tuple element bindings (`_tuple_result_0_elem_0`) now gets a private name instead of redeclaring the binding.
|
|
84
|
+
- A local declared in a function or method and spelled like a built-in variable now keeps its own type, history storage and reads. Exceptions: a string local spelled like a price field (`open`, `high`, `low`, `close`, `hl2`, `hlc3`, `hlcc4`, `ohlc4`, `volume`) that is read with history in a function requested through `request.security` is still refused, as before; the support check still warns that `bar_index`, `last_bar_index` and `timenow` diverge from TradingView at every read of a local with that name; a script that declares the same built-in name in several callable shapes is accepted where an ordinary name is refused by the shared-Series check; and the confirmed-bar request receipt of a request inside the declaring function names the local by its internal storage spelling.
|
|
85
|
+
- A function-local string read with history now keeps its string type in concatenations, so the emitted C++ joins the current and previous values without applying `std::to_string` to a string (#354).
|
|
86
|
+
- A function or method parameter spelled like a built-in variable (`close`,
|
|
87
|
+
`high`, ...) now keeps its `[n]` history operator and gives the same values
|
|
88
|
+
as when the parameter has another name (#360).
|
|
35
89
|
- History retention can be selected with keyword-only `history_capacity`
|
|
36
90
|
in `transpile()`, `transpile_full()`, `transpile_with_request_inventory()`
|
|
37
91
|
and `gate/glue.py::transpile_json()`. The JavaScript worker template does
|
|
@@ -58,6 +112,8 @@ supported as exact pairs; on the 0.x line they are independent. See the
|
|
|
58
112
|
option. Capacities outside the native int64 domain are refused even for
|
|
59
113
|
scripts without drawings. Regenerate C++ and relink affected strategies.
|
|
60
114
|
- Typed `array.from()` initializers now match their declared element type, including function-local `var` and `varip` arrays of timestamps.
|
|
115
|
+
- A `var` declared in one block no longer shares storage with a plain variable
|
|
116
|
+
of the same name in a sibling block, so it keeps its value across runs (#359).
|
|
61
117
|
- Variables initialized from `backadjustment.*`, `settlement_as_close.*` and
|
|
62
118
|
`adjustment.*` constants now use integer storage in emitted C++.
|
|
63
119
|
- `int(x)` of a floating value, and a stored `math.floor(x)`, `math.ceil(x)`
|
|
@@ -77,6 +133,11 @@ supported as exact pairs; on the 0.x line they are independent. See the
|
|
|
77
133
|
(`int(strategy.equity)`) and a float field of a record (`int(b.v)`) count as
|
|
78
134
|
floating values too. This changes generated C++ for scripts that use these
|
|
79
135
|
forms: regenerate and relink affected strategies.
|
|
136
|
+
- A float setting of a built-in indicator computed from an input now keeps
|
|
137
|
+
its fraction, as on TradingView: the multiplier of `ta.bb`, `ta.bbw`,
|
|
138
|
+
`ta.kc`, `ta.kcw` and the `ta.vwap` bands, the factor of `ta.supertrend`,
|
|
139
|
+
the arguments of `ta.sar`, and the offset and sigma of `ta.alma` (#362).
|
|
140
|
+
Regenerate C++ and relink affected strategies.
|
|
80
141
|
- Repeated explicit input titles now have separate override keys: the first
|
|
81
142
|
keeps the bare title, and later inputs use `<title>#<n>`, starting at 2 and
|
|
82
143
|
skipping authored titles and keys already assigned. The manifest, effective
|
|
@@ -265,6 +326,26 @@ supported as exact pairs; on the 0.x line they are independent. See the
|
|
|
265
326
|
TradingView accepts a namespace call after an expired block local with the
|
|
266
327
|
same name; PineForge's analysis no longer refuses it, but code generation
|
|
267
328
|
still rejects some such calls (a known gap).
|
|
329
|
+
- `str.length`, `str.pos` and `str.substring` now count and cut text in UTF-16
|
|
330
|
+
code units, as TradingView does: an emoji is two units and every other
|
|
331
|
+
character one. They counted UTF-8 bytes, so an accent counted 2, a CJK
|
|
332
|
+
character 3 and an emoji 4, and a position or a cut after such a character
|
|
333
|
+
was off by the extra bytes. The helpers are emitted into the generated file
|
|
334
|
+
only when its code calls one of the three functions (a call that is only a
|
|
335
|
+
plot argument emits nothing), so every other script keeps the text it had;
|
|
336
|
+
the engine is not involved. A cut between the two units of an emoji keeps
|
|
337
|
+
each half as its own three-byte sequence (the length of a half is one unit),
|
|
338
|
+
the form `str.split` gives its parts. Such a half never occurs inside a text
|
|
339
|
+
that holds the whole character, so three things differ from TradingView:
|
|
340
|
+
joining the two halves again, with `+` or `array.join`, does not give back
|
|
341
|
+
the original four bytes, so the joined text does not equal the original text;
|
|
342
|
+
a search for a half in the text it was cut from finds nothing (`str.pos`
|
|
343
|
+
returns -1, where the one byte the old cut gave was found at the same
|
|
344
|
+
position, and `str.contains` returns false); and a half is not equal to, or
|
|
345
|
+
at the start or end of, a part of that text that holds the whole character.
|
|
346
|
+
A begin position that lies inside the bytes of a text but past its units
|
|
347
|
+
(5 on "a", an emoji, "b") now stops the run; before, it returned the bytes
|
|
348
|
+
after that position.
|
|
268
349
|
|
|
269
350
|
## 1.9.1 — 2026-10-31
|
|
270
351
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: pineforge-codegen
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.12.0
|
|
4
4
|
Summary: PineScript v6 to C++ transpiler that targets the pineforge-engine runtime.
|
|
5
5
|
Project-URL: Homepage, https://github.com/pineforge-4pass/pineforge-codegen-oss
|
|
6
6
|
Project-URL: Issues, https://github.com/pineforge-4pass/pineforge-codegen-oss/issues
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1.12.0
|
|
@@ -122,6 +122,9 @@ pineforge_codegen/
|
|
|
122
122
|
│ enum is too coarse for.
|
|
123
123
|
├── tv_number_format.py TU-local numeric formatter emitted for
|
|
124
124
|
│ str.tostring / str.format / log.*.
|
|
125
|
+
├── tv_string_units.py TU-local UTF-16 unit counting and cutting
|
|
126
|
+
│ emitted for str.length / str.pos /
|
|
127
|
+
│ str.substring.
|
|
125
128
|
├── session_market.py session.ismarket of a chart bar in a run
|
|
126
129
|
│ without a timeframe: the engine's session
|
|
127
130
|
│ calendar asked at the bar's open time,
|
{pineforge_codegen-1.11.0 → pineforge_codegen-1.12.0}/docs/reference/known-codegen-quirks.md
RENAMED
|
@@ -283,6 +283,9 @@ you delete or weaken the special case, the test will tell you.
|
|
|
283
283
|
(`_collect_known_var`), where the reset read the alias's own member
|
|
284
284
|
before the body set it, an EMA of length 0 for the whole run
|
|
285
285
|
(`tests/test_e2e_alias_ta_length.py`, tapes `fixtures/alias_len_tv`).
|
|
286
|
+
Where a runtime constructor argument was narrowed to an integer, a float
|
|
287
|
+
signature slot instead retains its fraction, including VWAP band
|
|
288
|
+
multipliers; integer slots keep their narrowing and preserve `na`.
|
|
286
289
|
14. **String escapes are the Pine manual's.** The lexer (`_read_quoted`)
|
|
287
290
|
reads `\n` / `\t` as U+000A / U+0009 and `\\`, `\"`, `\'` as the
|
|
288
291
|
character; any other `\X` reads as `X` ("the character's meaning does
|
|
@@ -362,7 +365,7 @@ you delete or weaken the special case, the test will tell you.
|
|
|
362
365
|
`tests/test_e2e_cgint7_compositions.py`).
|
|
363
366
|
16. **Every call argument is evaluated once.** Pine evaluates each argument
|
|
364
367
|
of a call exactly once per execution; only `and` / `or` and the `?:` arms
|
|
365
|
-
are lazy (a
|
|
368
|
+
are lazy (a TradingView counting-probe tape, `fixtures/w2_trio_tv/eval_counts`,
|
|
366
369
|
shows every builtin slot below once per bar). A lowering template that
|
|
367
370
|
reads an argument twice, or once per loop iteration, re-runs its C++, so a
|
|
368
371
|
stateful call in it (a `ta.*` compute(), a user function with state) runs
|
|
@@ -442,7 +445,7 @@ you delete or weaken the special case, the test will tell you.
|
|
|
442
445
|
handle shapes.
|
|
443
446
|
18. **A script variable read through history in a function body reads its
|
|
444
447
|
call site's history.** TradingView builds the history of a series used
|
|
445
|
-
in a function through each call of it (
|
|
448
|
+
in a function through each call of it (BINANCE:ETHUSDT.P 15,
|
|
446
449
|
`tests/fixtures/function_global_history`): in a plain UDF, `x[k]` on a
|
|
447
450
|
script variable (`var` or not) or on `bar_index` is `x` as that call site
|
|
448
451
|
saw it at its latest call at or before `k` bars ago -- one slot per chart
|
|
@@ -213,7 +213,14 @@ Checked settings string defaults and options use only known C++ string literals
|
|
|
213
213
|
from the existing builtin lowering, never inert visual integer codes. Only the
|
|
214
214
|
`currency.*` and `format.*` members inventoried in `NAME_ECHO_STRING_MEMBERS`
|
|
215
215
|
may publish their own names, matching the body's existing lowering; unlisted
|
|
216
|
-
members remain unsupported even when the body echoes their names.
|
|
216
|
+
members remain unsupported even when the body echoes their names. A default or
|
|
217
|
+
option held by a global variable, declared with or without `var`, is published
|
|
218
|
+
as its string when that variable is declared once, before the input, with a
|
|
219
|
+
string literal (or a constant expression of literals) and is never reassigned;
|
|
220
|
+
this applies to `input.string`, `input.timeframe`, `input.symbol`,
|
|
221
|
+
`input.session` and `input.text_area`. A default held by a variable that cannot
|
|
222
|
+
be proven this way is refused with PF-E5096 instead of becoming an empty
|
|
223
|
+
default; an option that cannot be proven keeps the rule below. An unknown
|
|
217
224
|
string default or option marks the
|
|
218
225
|
input `supported=false` and publishes no choices; its unavailable default is
|
|
219
226
|
empty. Transpile-time input manifests reuse that descriptor's `supported`
|
|
@@ -321,7 +328,7 @@ The taxonomy:
|
|
|
321
328
|
| Color na conversions | Packed colors use `int64_t` storage, including typed scalar, array and matrix paths, so their `na<int64_t>()` sentinel survives. `array.from` of colors is a `std::vector<int64_t>`: a color literal, a `color.*` constant, a `color.new` / `rgb` / `from_gradient` call, a conditional selecting one or a script variable bound to one types the element on both sides (`_is_color_value`, the analyzer's `_is_color_constructor`); it was read as a float, and `var array<color> A = array.from(...)` did not compile (`tests/test_e2e_color_arrays.py`, tape `fixtures/silent2_tv/cgs2_color_arrays`). `color.new` preserves an `na` base; `na` transparency becomes 100; an `na` `color.rgb` channel becomes zero. The covered TradingView color probes are pinned by `tests/test_na_truthiness.py`. A finite transparency reaches the engine's `new_color` as a double, whose alpha byte is the nearest to 255 * (100 - t) / 100, as TradingView's for an input or a series transparency and `color.rgb`'s: `color.new(c, t)` at t = 10.5 reads back 11 (a truncating cast read 10; an integer literal keeps its `(int)` spelling). TradingView truncates a constant `color.new` transparency (`color.new(color.red, 10.5)` and `10.6` read 10, `99.5` reads 99), which PineForge still reads through the byte (pinned: `tests/test_e2e_cgint6_compositions.py`, tape `fixtures/cgint6_tv/cgint6_const_transp`). `tests/test_e2e_color_tapes.py` replays the engine's `w11-color-v6-eth15` tape (`fixtures/color_tv`). `color.new(color, transp)`, `color.rgb(red, green, blue, transp)` and `color.r` / `g` / `b` / `t(color)` bind a keyword argument to its parameter's slot, in parameter order (`_color_arg_nodes`; a keyword transparency is converted as a positional one): a keyword was dropped, so `color.new(c, transp = 40)` lowered to the color 0 (`tests/test_e2e_color_keyword_arguments.py`, tape `fixtures/silent2_tv/cgs2_color_keywords`). |
|
|
322
329
|
| Epoch ints | A Pine `int` slot an epoch reaches is `int64_t`: a name whose declaration or any reassignment gives it a wide value (an epoch builtin, a wide name or parameter, or an expression `_expr_returns_wide_int` traces to one), and a declared-`int` or untyped parameter a written call feeds one (`types._wide_int_provenance`, a fixed point keyed by spelling). The width used to stop at the first copy: `int sel = switch k => E2` over `const int E2 = timestamp(...)`, `alias = firstT` over `firstT := time`, and `f(int t)` called with `time` held 32 bits (1743468300000 read -288422176), and `int(x)` of an epoch casts to `int64_t` (`int(time)` was a 32-bit cast). A function's or method's local declared `float` keeps a float series when an epoch reaches it (`float x = time`: `_callable_series_local_symbol` reads the function's scope, `method_<Type>_<name>` for a method, which the global lookup missed): its `Series<int64_t>` read the integer sentinel for a missing `x[1]`, so `x - x[1]` was a garbage number on the first bar instead of na (`tests/test_e2e_float_time_local.py`, tapes `fixtures/silent2_tv/cgs2_float_time_local` and `cgs2_float_time_method`). `tests/test_e2e_krunerr_int64_provenance.py` replays TradingView's tape (`fixtures/krunerr_tv`). A method call's arguments do not widen its parameters. Integer arithmetic over literals and the constants emitted as literals keeps 64 bits too: `400 * MS` over `const int MS = 7200000` is 2880000000 (it was the C++ `int` product, -1414967296), folded where the tree is literal after the names are inlined (`_pure_int_literal_value`, `_inlined_int_constant`) and where the emitted C++ is (`_fold_int32_overflow_cpp`: a `request.security` payload expands a global into its declaration), and the slot a top-level declaration of an int constant past int32 initializes is `int64_t`, reassigned or not (`g = 3000000000`, `var int e = 300 * MS`: `_literal_wide_global`); a literal's width (`g = 3000000000`) reaches a declaration reading it while it is never reassigned (`h = g`) but does not travel by spelling into a reassignment (`k := g`), parameters, arrays, `request.security` helper state or a callable's local of the same name, which keep the types they compiled with, while constant arithmetic (`300 * MS`) is a 64-bit product too, whose width travels as the next sentences say. `tests/test_e2e_int64_constants.py` replays TradingView's tape (`fixtures/silent_tv`). An integer `+ - *` those folds leave, whose operands are both 32-bit C++ ints, is computed in 64 bits at run time when its magnitude can leave int32 (`_int_arith_leaves_int32`: literals and inlined constants exactly, an `input.int` by its declared range, else its default and 2**24, `bar_index`, a counted loop's binder, a `for ... in` binder whose spec is `int` (an int element, map value or index; a float element is a double: `v * 1000` over one was truncated) and any other runtime integer name 2**24 (a call's result does not widen); a callable's name resolves in its own callable, a declared `int` local included, whichever callable is being emitted; a reassigned top-level constant past int32, whose slot is `int64_t`, is no 32-bit operand, and an input's named bound reads the top-level constant), and its value is an epoch-like wide value for the slots above: `days * 86400000` over `days = input.int(30)` and `bar_index * 7200000` overflowed. An operand that can be na (a parameter, a local, a script variable) makes the value na: a double (`_wide_int_arith_cpp`, exact to 2**53; the widening cast read `na<int>()` as -2147483648) that every integer store narrows na-preserving, a slot, a parameter, an array element, a map or matrix value. In a `request.security` payload a side the builder re-evaluates as a double computes in double and a name a helper binds keeps its spelling; the rest widens as on the chart, and the payload's copy of a script variable only such arithmetic makes wide is `int64_t` too (`_security_copy_is_arithmetic_wide`, stored na-preserving, a compound `%=` through `std::fmod`); an epoch's or an int-literal product's keeps its `int` copy, as it always did. A tuple element and a function's or method's result holding a constant past int32 (`_holds_wide_int_constant`), and a read of a UDT `int` field (`int64_t` storage) some write fills with one (`_wide_udt_int_fields`), are `int64_t` too. A `map<..., int>` value, `matrix<int>` element or element of an int array only such a value reaches (only an epoch widens an array, `_wide_int_array_names`: a declared `array<int>` parameter, result or field does not bind a `std::vector<int64_t>`) keeps its C++ `int` (its type also types the handle's parameters and its `values()` / `row()` arrays), narrows the value na-preserving and warns where it stores one (`tests/test_e2e_int64_products.py`, tapes `fixtures/silent2_tv/cgs2_int64_products`, `cgs2_int64_followup` and `cgs2_int64_followup2`). |
|
|
323
330
|
| Array and matrix history | `a[k]` of an array or a matrix variable is TradingView's read-only copy of the collection as the variable left it at the end of its scope's execution k executions back: the bar k bars back for the top level, its block's previous run for a block's local (`tests/fixtures/array_history_tv`). A `var` array's history is the copy, one element shorter than the array it grows (`ahist_ref`), and a `var` matrix's holds the previous bar's value (`ahist_mtx`). The variable keeps its own `std::vector` or matrix member, so every other operation keeps its C++; `_pf_collection_hist_<name>` (`_PFCollectionHistory`, `pineforge_codegen/collection_history.py`) keeps the copies of one declaration: each execution of the declaration (each bar, for a top-level `var`) opens a slot and the bar's end closes it with a copy. Sibling blocks declaring the same name share its member, so each declaration gets a history of its own (`_pf_collection_hist_1_<name>`, ..., which no Pine name spells) and first closes the others' with the array their block left (`ahist_sibling`: one shared history read the other block's array, 336 of 336 exits wrong). `CollectionHistoryChecker.decide` gives every read one outcome. Supported, for a variable of the top level or one of its blocks: a built-in reads it (`(a[1]).size()`, `array.get(a[1], 0)`, `(m[1]).get(0, 0)`, `matrix.det(m[1])`; a matrix function's new matrix has the variable's type, `matrix.copy(mi[1])` of a `matrix<int>` too); a built-in that changes it stops the run with TradingView's RE10051 text (`(a[1]).push(x)`; a zero offset is the variable itself, which changes); `na()` asks whether a copy exists; a `for...in` loop over it iterates the variable's current array, as TradingView's does (`ahist_loop`: `for v in b[1]` sums the current array); a variable bound to it holds a nullable reference to a copy (`_PFArrayHistoryValue` for arrays, the native na matrix for matrices), including a binding read only through `na()` or both through `na()` and array methods -- unless the value reaches a user function's or method's parameter, directly (`f(a[1])`, `(a[1]).m()`) or through a bound name (`pb = a[1]`, `f(pb)`, `pb.m()`): that stays the copy it was before the nullable value (`.value(k)`, an empty array before the variable has a history, where TradingView's is na: the callee's parameter is a `std::vector&` that holds no na array), and a callee that also reads it through `na()` keeps the earlier refusal (`NameUses.crosses_parameter`; `tests/test_arrseg_review_fixes.py`). An unavailable literal or dynamic offset yields an na ID, distinct from an empty collection. Aliases and array-valued ternary selections preserve that ID; an array method materializing it stops with the existing na-array error. Array-ID unwrapping retains temporary values for range loops. A method on a na history stops the run (RE10052, RE10053). Refused by name, what TradingView refuses: a method straight after the history (`a[1].size()`: CE10011), an object's array, matrix or map field's history (`h.xs[1]`, `(h.xs)[1]`: CE10290, in the analyzer), an array where a number, a condition, a string or an element is expected (CE10123: an operator, `nz`, `math.*`, a value slot of an array function such as `c.push(a[1])` or `array.new<float>(2, a[1])`, `log.info`'s message, `label.new`'s text, `str.tostring` of colors; CE10173: a scalar variable or field; CE10101: an if or while condition; CE10122: `array.from`, `str.format` of colors; CE10009: a bare statement of the top level). Every other read keeps the lowering it had where that compiled -- an element of the current array (`na()` and `str.tostring()` in a function, a request payload, a loop, a block's `var`; a selection's history), a parameter's current array (a namespace call, a for...in loop, a typed copy), each with a warning, and anything in a function no call names, which the codegen does not emit (it emits every method and every function a call names, an uncalled function's call included: a read there is decided as any, and one an uncalled function hands to such a function's untyped parameter by how that body uses it) -- and is refused where it did not, as probes of every use and every array function in every scope and for every element type against the previous build showed (`_ELEMENT_LOWERING_FAILS` and its siblings): a collection use of a number element (a method, any `array.*` read but `array.copy` into a namespace call or a loop's local, a typed parameter or binding, a loop over a number) and the string ones `std::string` lacks, `na()` or `str.tostring()` of a parameter's array and its array-returning reads, a change through a variable or a slice bound to the history (TradingView stops there, RE10051; PineForge would change a copy), a matrix's history outside the scopes kept, a call's result's history. Whether an earlier lowering compiled often turns on the consumer of an array function's value, which the tags carry (`_array_result_consumer`: a method on the new array, a function returning it, rendering it, a member holding it; `_value_consumer`: a string value returned or bound), and an overloaded method given the history keeps the earlier lowering. `xs[k] := v`, which TradingView refuses (CE10009, CE10013), keeps its element assignment with checked bounds. Other legacy current-element reads keep their warning and return element na outside the array instead of indexing unchecked. `tests/test_collection_history_missing.py` compiles and runs missing-history witnesses for arrays, matrices, UDTs and drawings, na methods, aliases, dynamic offsets and legacy paths. An object's array or matrix field read through the object's history (`(h[1]).xs.size()`) is the field as it is now (`ahist_field`), as it compiled before. Map history stays refused. Two gaps keep the C++ the previous build emitted, which does not compile: an element function's value of a string array's history the earlier lowering reads (`f() => str.length(array.first(s[1]))`: a character of the current array's string, held as a number, which most string consumers do not take; the probes measured a value bound or returned), and the history of a variable or a call the analyzer does not type as an array or a matrix (a method's or `matrix.row`'s new array, a selection of arrays, a tuple's element, an array of drawings), which the checker never sees. `tests/test_array_history.py` compiles every shape and pins the refusals and the earlier lowerings; `tests/test_e2e_array_history.py` replays six tapes and the runtime stops. |
|
|
324
|
-
| syminfo na-gap warning | `SUPPORTED_SYMINFO` = every `SYMINFO_MEMBER_MAP` key, but members whose emission is `na<T>()` or a `get_syminfo_metadata(...)` lookup (root/pricescale/minmove/mincontract/current_contract/expiration_date/isin/sector/industry + fundamentals/recommendations/target_price_*) form `_SYMINFO_SILENT_GAP_FIELDS` (derived from the emission table, so new na-accept fields can't drift out): every read WARNS that the value is na until a data feed injects it. `syminfo.timezone` spells an empty or `UTC` exchange zone `Etc/UTC`, TradingView's name for BINANCE's (`syminfo.timezone == "Etc/UTC"` holds there, `== "UTC"` does not); the engine calls that take the symbol's zone keep the engine's name (`tests/test_e2e_syminfo_timezone_spelling.py`, `fixtures/tail_e_tv`). `syminfo.mincontract` (`_SYMINFO_RUN_FACT_FIELDS`) reads the symbol fact the run declares as syminfo metadata `"mincontract"` (`runtime_overrides.syminfo_metadata`, a
|
|
331
|
+
| syminfo na-gap warning | `SUPPORTED_SYMINFO` = every `SYMINFO_MEMBER_MAP` key, but members whose emission is `na<T>()` or a `get_syminfo_metadata(...)` lookup (root/pricescale/minmove/mincontract/current_contract/expiration_date/isin/sector/industry + fundamentals/recommendations/target_price_*) form `_SYMINFO_SILENT_GAP_FIELDS` (derived from the emission table, so new na-accept fields can't drift out): every read WARNS that the value is na until a data feed injects it. `syminfo.timezone` spells an empty or `UTC` exchange zone `Etc/UTC`, TradingView's name for BINANCE's (`syminfo.timezone == "Etc/UTC"` holds there, `== "UTC"` does not); the engine calls that take the symbol's zone keep the engine's name (`tests/test_e2e_syminfo_timezone_spelling.py`, `fixtures/tail_e_tv`). `syminfo.mincontract` (`_SYMINFO_RUN_FACT_FIELDS`) reads the symbol fact the run declares as syminfo metadata `"mincontract"` (`runtime_overrides.syminfo_metadata`, a per-run fact beside `qty_step`) and warns that it is na without one; fixture readouts give TradingView's values (0.0001 ETHUSDT.P, 0.00001 BTCUSDT, 0.01 EURUSD/XAUUSD, 1 for the stock, index and futures symbols; `tests/test_e2e_syminfo_mincontract.py`). |
|
|
325
332
|
| Session flags | A chart bar's `session.ismarket` reads the kernel's in-session fact `session_ismarket_`, which reads the bar at its interval's first eligible instant: its open, or the reopen for a bar that opens in a break (TradingView's TSE:7203 and CBOT:ZC1! 60-minute bars that open at 12:00 and 08:00 are in market); a D/W/M bar is in market. TradingView flags a bar by its open time (on a US-listed stock's extended-hours 60-minute chart the 09:00 bar, which holds the 09:30 open, is pre-market and the 16:00 bar post-market), reads a day mask per session day, and flags OANDA:XAUUSD's daily bars, stamped at the 17:00 ET break, in market. A run with no timeframe (one bar, none given: `script_tf_` is empty) gets no session-day facts (`session.isfirstbar` / `islastbar` read false there, as the test pins); there the emitted `_PFSessionMarket` type and its per-strategy `_pf_session_market_` cache (`codegen/session_market.py`, outside the checkpointed script state) ask the engine's session calendar (`native_calendar::session_day_at`) about the bar's open time. Both replaced the time-of-day predicate, which missed every Sunday-evening open under a `:23456` mask and every `0000-2400` bar until the engine's time/color fix read a mask by each window's session day and `2400` as the day's end (the predicate now reads those tapes as TradingView does); the calendar at the bar's open, the chart's lowering before the session-window handling, puts the break-open bars of the intraday tapes out of market. A bar in market is in neither `session.ispremarket` nor `session.ispostmarket`; off it, the engine's windows decide (`session_in_premarket` / `session_in_postmarket`, src/session_time.cpp): from 04:00 to the session day's first open and from its last close to 20:00, over every window in either order; a bar between two windows is neither, and so is every bar of an overnight or 24-hour session (the session-window handling; the windows used to read the first window only, and also held in-market bars of overnight sessions). TradingView's two-window charts TSE:7203, HKEX:700 and CBOT:ZC1! hold no off-market bar and flag none pre- or post-market (`tests/test_e2e_session_windows.py`). A `request.security` payload's own session reads, a user function's it inlines included, keep the time-of-day predicates at the security bar's open time, a D/W/M bar's too, which TradingView reads as whole session days, and WARN. `session.isfirstbar` / `islastbar` read the host's `session_isfirstbar_` / `session_islastbar_`, the chart's session day, which the engine widens by the pre- and post-market bars an extended-hours chart holds (the extended-hours tape's 04:00 and 19:00 bars), and the `_regular` spellings its `session_isfirstbar_regular_` / `session_islastbar_regular_`, the regular day (10:00 and 15:00; they used to read the chart's pair). Under TSE:7203's published 15:30 end the regular day closes on the 15:15 bar, where TradingView's closes on its 15:30 bar (pinned). `tests/test_e2e_session_ismarket.py` replays TradingView tapes (public crypto tapes in `tests/fixtures/session_ismarket`; US-listed stock, US futures, forex and spot-metal tapes overlaid onto the paired engine's private `tests/codegen-fixtures/session_ismarket`) and `tests/test_e2e_session_windows.py` the three two-window charts at 15, 60 and 240 minutes, on their own bars and, for TSE:7203 and CBOT:ZC1!, aggregated from 15 minutes (the engine aggregates HKEX:700 on a 09:30-anchored grid, not TradingView's clock hours), each replay ending on the bar TradingView's chart holds next (a batch's final bar closes its session day); TradingView's HKEX:700 bars above 15 minutes, whose session day it gives two first bars (60) or makes every bar first and last (240), are pinned. |
|
|
326
333
|
| Session flag history | `session.<flag>[k]` is the flag k bars ago at the top level of a script, in a block and on a lazy operand too, and k calls ago inside a function, each call site apart and whichever operand or block of the function holds the read, as a US-stock tape kept in a private repository shows; a read before the first bar is false. A top-level read indexes the flag's `_pf_session_hist_<flag>` Series, pushed at the top of every chart bar. A function that reads a flag at an offset is emitted once per call site (the analyzer's synthetic-history statefulness) and pushes the flag into its `_session_call_*` Series at entry, once per call. A `request.security` expression that reaches the read through its own operators keeps a bool `_sec<N>_expr_hist_*` Series on the requested clock (a function whose only read sits in its own request.security keeps no per-call Series), as does a builtin call's argument the payload builder lowers on the requested clock (`nz(session.ismarket[1] ? 1.0 : na)`: the `request.security` helpers row); one that reaches it through a variable, or through a call's argument where the evaluator keeps the chart's terms, and a read in a function or method such an expression evaluates (the analyzer follows its calls, the variables it reads and their statements), is refused at the read. The codegen also refuses a read it emits in a method (a call on a receiver the analyzer cannot type, such as `mk().m()` or a loop variable, is not told apart) or in a function a method, such an expression or a UDT field default reaches (`session_history_unsafe`; the analyzer follows a global's name as the evaluator does, whatever a function binds itself). Both follow the emitted C++, not the rendered reads (`_settle_session_reads`): a refused read renders as a stand-in name, refused only if the code outside comments and literals holds it, so a read the C++ never holds (in `plot`, `alert`, a drawing's style or xloc, `color.from_gradient`, any argument the codegen drops or renders and leaves out) refuses nothing: such callables get no clone, and `transpile()` first analyzes a script without the clones of functions that read a flag at an offset, then again with the functions whose reads that C++ holds cloned as well, until it asks for no more (a clone can make a caller's read reach the C++) (`pineforge_codegen/session_reads.py`, `_generate`), so the others keep the calls they compiled with and never cost a clone (a clone could also put a wrapper's int and float calls on one variant, and a function called along a deep call tree gets one per path); a top-level one may leave an unused Series. It used to index a C++ bool and fail the compile. `tests/test_e2e_session_history.py` replays the three tapes. |
|
|
327
334
|
| Drawing lifetime | A deleted drawing reads like a na handle: every getter returns na, every setter does nothing and `na()` is true (a na handle's getter reads na too, instead of halting the run). A new line, box or label that makes its kind's live count reach `max_<kind>_count + 6` (default 50) deletes the oldest drawings of that kind no `var`/`varip` or history-read variable holds, until `max_<kind>_count` remain; a drawing held only by an array, an object field, a local or a plain non-var variable is collectable, and linefills are never collected. The engine's arena reads a deleted record's data and evicts at exactly the cap, so the generated arenas are unbounded and the TU carries the rule (`DRAWING_LIFETIME_CPP` and the `_pf_collect_<kind>s_` members, `codegen/drawing.py`). `tests/test_e2e_drawing_lifetime.py` replays 15 TradingView readout tapes (`tests/fixtures/drawing_lifetime`) value by value. |
|