Skip to content

feat(codegen): support Pine drawing objects as data#27

Merged
luisleo526 merged 2 commits into
mainfrom
feat/drawing-objects-as-data
Jun 29, 2026
Merged

feat(codegen): support Pine drawing objects as data#27
luisleo526 merged 2 commits into
mainfrom
feat/drawing-objects-as-data

Conversation

@luisleo526

Copy link
Copy Markdown
Contributor

Summary

  • Add Pine v6 drawing-object lowering for line/box/label/linefill/chart.point as headless data structures.
  • Preserve visual args as accepted no-ops while emitting real geometry/handle operations through the engine drawing runtime.
  • Keep non-drawing output gated/byte-identical and add defensive support-checker errors for unsafe drawing-handle history.

Related

Scope / caveats

  • Fixes the corpus compile/run unblock for egoigor; matched trades are price-exact, but this PR does not claim egoigor trade-for-trade parity.
  • box data path is covered by a synthetic probe; full doriannnq remains blocked by cross-symbol request.security.
  • Commit message mentions DRAWING_RETURN_SPECS, but implementation intentionally keeps return inference inline; see PR body and tests as source of truth.

Verification

  • python -m pytest tests/test_support_checker.py tests/test_codegen_drawing_data.py -q
  • PINEFORGE_ENGINE_INCLUDE=../pineforge-engine/include python -m pytest -q
  • python ../pinescript-scrapper/scripts/verify-engine-local.py egoigor1976-1-trendline-strategy → OK, match 20/44tvWin, px 100.0%, eng=59
  • Emitted-C++ diff vs origin/main over current corpus: 245/245 non-drawing strategies byte-identical; drawing-touching changes only where expected; 0 transpile errors

luisleo526 and others added 2 commits June 29, 2026 10:50
….point)

Pine v6 drawing geometry becomes real C++ state via a value-view handle
over a per-type DrawingArena; every visual kwarg (color/style/width/
bgcolor/text_*/extend/force_overlay) is accepted and dropped. All new
behaviour is gated on _uses_drawing, so non-drawing strategies emit
byte-identical C++ (245/246 engine parity unchanged).

- tables.py: DRAWING_TYPE_TO_CPP / DRAWING_NS / DRAWING_STYLE_NS; remove
  line/box/label/linefill/polyline from SKIP_NAMESPACES (table kept)
- base.py: shrink _DRAWING_TYPES_INIT to {table,polyline}; _detect_drawing_usage
  + _compute_drawing_caps (max_lines/boxes/labels/polylines_count); arena members
- codegen/types.py + analyzer/types.py: udt(line/box/...) -> Line/Box/...;
  DRAWING_RETURN_SPECS so *.new/*.copy/get_line* type as handles
- new codegen/drawing.py + visit_call.py: DRAWING_DISPATCH at all four receiver
  sites incl. the arbitrary-expression receiver (arr.get(i).delete()); user
  methods on drawing types fall through (L.1 precedence); chart.point inline
  aggregate lowering; point-form overload selection; geometry-only ctor kwarg filter
- visit_expr.py: DRAWING_STYLE_NS const reads -> "0" (.all exempted)
- emit_top.py: drawing.hpp include; udt-method drawing self/param/return mapping
- support_checker.py: SUPPORTED_LINE/BOX/LABEL/LINEFILL/CHART_POINT

Unblocks egoigor1976-1-trendline-strategy (the corpus's sole geometry
read-back). pytest: 1321 passed, 0 failed (was 1312; +9 drawing tests).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@luisleo526 luisleo526 merged commit c210fa0 into main Jun 29, 2026
9 checks passed
@luisleo526 luisleo526 deleted the feat/drawing-objects-as-data branch June 29, 2026 03:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant