Skip to content

Problem with object constness in Circuit::net_for_pin #617

@klayoutmatthias

Description

@klayoutmatthias

The following script:

netlist = RBA::Netlist::new
netlist.from_s(<<"END")
circuit TOP ();
  subcircuit SC1 $1 (A='1', B='2');
end;
circuit SC1 (A='A', 'B'='B');
end;
END

def collect_net_names(net)
  names = []
  if ! net.name.empty?
    names << net.name
  end
  net.each_subcircuit_pin do |scp|
    subnet = scp.subcircuit.circuit_ref.net_for_pin(scp.pin_id)
    names += collect_net_names(subnet)
  end
  names
end

puts collect_net_names(netlist.circuit_by_name("TOP").net_by_name("1")).inspect

errors out with this message:

new_macro_7.lym:17: Cannot call non-const method on a const reference in Circuit::net_for_pin

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions