fix(skd-compile): всегда эмитить useRestriction для параметра

Платформа эмитит <useRestriction>true|false</useRestriction> у каждого
параметра безусловно. Раньше compile эмитил только если =true, что
приводило к LOST <useRestriction>false</useRestriction> в roundtrip.

Эффект на sample30: −84 строки diff.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Nick Shirokov
2026-05-22 19:27:36 +03:00
co-authored by Claude Opus 4.7
parent 77fc0cee2f
commit 32e06cbc56
13 changed files with 52 additions and 9 deletions
@@ -1,4 +1,4 @@
# skd-compile v1.49 — Compile 1C DCS from JSON
# skd-compile v1.50 — Compile 1C DCS from JSON
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
param(
[string]$DefinitionFile,
@@ -1257,10 +1257,11 @@ function Emit-SingleParam {
$parsed.useRestriction = $true
}
# UseRestriction
if ($parsed.useRestriction -eq $true -or ($p -isnot [string] -and $p.useRestriction -eq $true)) {
X "`t`t<useRestriction>true</useRestriction>"
}
# UseRestriction — платформа всегда эмитит этот тег у параметра (true/false)
$urEmit = $false
if ($parsed.useRestriction -eq $true) { $urEmit = $true }
elseif ($p -isnot [string] -and $p.useRestriction -eq $true) { $urEmit = $true }
X ("`t`t<useRestriction>" + $(if ($urEmit) { 'true' } else { 'false' }) + "</useRestriction>")
# Expression
if ($parsed.expression) {
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
# skd-compile v1.49 — Compile 1C DCS from JSON
# skd-compile v1.50 — Compile 1C DCS from JSON
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
import argparse
import json
@@ -1078,9 +1078,12 @@ def emit_single_param(lines, p, parsed):
parsed['availableAsField'] = False
parsed['useRestriction'] = True
# UseRestriction
if parsed.get('useRestriction') is True or (p is not None and not isinstance(p, str) and p.get('useRestriction') is True):
lines.append('\t\t<useRestriction>true</useRestriction>')
# UseRestriction — платформа всегда эмитит этот тег у параметра (true/false)
ur_emit = (
parsed.get('useRestriction') is True
or (p is not None and not isinstance(p, str) and p.get('useRestriction') is True)
)
lines.append(f'\t\t<useRestriction>{"true" if ur_emit else "false"}</useRestriction>')
# Expression
if parsed.get('expression'):