SynthBuilder constructor

SynthBuilder(
  1. Module top,
  2. Synthesizer synthesizer
)

Constructs a SynthBuilder based on the top module and using synthesizer for generating outputs.

Implementation

SynthBuilder(this.top, this.synthesizer) {
  if (!top.hasBuilt) {
    throw ModuleNotBuiltException();
  }

  final modulesToParse = <Module>[top];
  for (var i = 0; i < modulesToParse.length; i++) {
    final moduleI = modulesToParse[i];
    if (!synthesizer.generatesDefinition(moduleI)) {
      continue;
    }
    modulesToParse.addAll(moduleI.subModules);
  }

  // go backwards to start from the bottom (...now we're here)
  // critical to go in this order for caching to work properly
  for (final module in modulesToParse.reversed) {
    if (synthesizer.generatesDefinition(module)) {
      _getInstanceType(module);
    }
  }
}