Class: Mxrb::Compiler::NanoflowProgramCompiler
- Inherits:
-
Object
- Object
- Mxrb::Compiler::NanoflowProgramCompiler
- Includes:
- ModelValues
- Defined in:
- lib/mxrb/compiler/nanoflow_program_compiler.rb
Overview
Lowers supported client-flow graphs to the instruction programs consumed by the Mendix client. rubocop:disable Metrics
Instance Attribute Summary collapse
-
#unsupported ⇒ Object
readonly
Returns the value of attribute unsupported.
Instance Method Summary collapse
- #declarations ⇒ Object
-
#initialize(source) ⇒ NanoflowProgramCompiler
constructor
A new instance of NanoflowProgramCompiler.
- #reference(qualified_name) ⇒ Object
Constructor Details
#initialize(source) ⇒ NanoflowProgramCompiler
Returns a new instance of NanoflowProgramCompiler.
15 16 17 18 19 20 21 22 |
# File 'lib/mxrb/compiler/nanoflow_program_compiler.rb', line 15 def initialize(source) @source = source @nanoflows = source.units_of('Microflows$Nanoflow').to_h do |unit| ["#{unit.module_name}.#{unit.document['Name']}", unit] end @programs = {} @unsupported = [] end |
Instance Attribute Details
#unsupported ⇒ Object (readonly)
Returns the value of attribute unsupported.
13 14 15 |
# File 'lib/mxrb/compiler/nanoflow_program_compiler.rb', line 13 def unsupported @unsupported end |
Instance Method Details
#declarations ⇒ Object
36 37 38 |
# File 'lib/mxrb/compiler/nanoflow_program_compiler.rb', line 36 def declarations @programs.values.filter_map { _1[:declaration] }.join("\n") end |
#reference(qualified_name) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/mxrb/compiler/nanoflow_program_compiler.rb', line 24 def reference(qualified_name) if @programs.key?(qualified_name) identifier = @programs[qualified_name]&.fetch(:reference) return identifier && "() => #{identifier}" end unit = nanoflow_unit(qualified_name) return unless unit compile(unit, qualified_name) end |