File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -263,7 +263,10 @@ def extract_stage_items(n)
263263 elsif n [ :separate ]
264264 [ { kind : :separate , separator : n [ :separator ] ? materialize ( n [ :separator ] ) : nil } ]
265265 elsif n [ :compose ]
266- [ { kind : :compose } ]
266+ # The grammar captures both `compose` and `decompose` under this
267+ # key — the value decides the directive. Dropping it compiled
268+ # every decompose as NFC compose.
269+ [ { kind : n [ :compose ] . to_s . to_sym } ]
267270 elsif n [ :case ]
268271 item = { kind : :string_case , op : n [ :case ] . to_s }
269272 item [ :kwargs ] = extract_kwargs ( n [ :case_kwargs ] ) if n [ :case_kwargs ]
Original file line number Diff line number Diff line change @@ -373,3 +373,25 @@ def parse_and_adapt(src)
373373 expect ( node . name ) . to eq ( "test-map" )
374374 end
375375end
376+
377+ RSpec . describe "NodeAdapter compose vs decompose" do
378+ it "keeps decompose distinct from compose" do
379+ src = <<~ISC
380+ system "t:a-b:C-D:1" {
381+ metadata { name "T" }
382+ stage main {
383+ sub "a" "b"
384+ decompose
385+ compose
386+ }
387+ }
388+ ISC
389+ node = Interscript ::Isc ::NodeAdapter . to_interscript_node (
390+ Interscript ::Isc ::DocumentBuilder . build ( Interscript ::Isc ::Parser . parse ( src ) )
391+ )
392+ calls = node . stages [ :main ] . children . select { |c | c . is_a? ( Interscript ::Node ::Rule ::Funcall ) } . map ( &:name )
393+ # The grammar captures both directives under :compose; the builder must
394+ # read the value or decompose compiles as NFC compose.
395+ expect ( calls ) . to eq ( %i[ decompose compose ] )
396+ end
397+ end
You can’t perform that action at this time.
0 commit comments