Skip to content

Fix parser logic for __ctrlFlow.enable and Dialog.enable annotations #492

Description

@AntoineGautier

The elements annotated with __ctrlFlow(enable=false) (deadEnd property) or enable=false with literal boolean assignments are not parsed in server/src/parser/parser.ts.

let childInputs =
  this.enable === false || this.deadEnd
    ? []
    : typeInputs[this.type]?.inputs || [];

This must be changed because these elements (such as cfg in Buildings.Templates.AirHandlersFans.Interfaces.PartialAirHandler) may contain parameters used in bindings for, e.g, enable annotations.

The dead end logic should be moved to the client interpreter.
If any parent in the instance tree is disabled, the declaration must not be displayed.

⚠️ This change is expected to significantly increase the runtime of npm run parseTemplateJSON (e.g., medium elements are currently not parsed due to this annotation). The impact must be evaluated when addressing the issue.

[EDIT]

  1. "Elements annotated __ctrlFlow(enable=false) are not parsed" is imprecise: the type of a dead-ended component is still loaded and recursively walked. Likewise LongClass.getInputs() calls getInputs on every element including dead-ended ones. So all entries land in the options; what gets pruned is only the reference lists, which means that these entries are all included but not reachable (any reference to it will fail to resolve).
  2. Medium classes are currently not parsed for another reason. First, the __ctrlFlow(enable=false) annotation logic is not implemented for short classes. So the aliased medium package should be parsed. The reason it's not is a gap in modelica-json that doesn't create JSON files for the classes aliased by short classes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions