Skip to content

#715 JavaScript/HTML codegen: fix function parameter and local variable references

Dennis Hendriks requested to merge 715-js-codegen-var-refs-in-functions into develop
  • Best to review per commit.
  • Function JS/HTML code generation changes that are the main scope of this merge request:
    • Improved exception message.
    • Use single quotes for strings in generated JS code.
    • No compile errors for unreachable statements in JS code, unlike Java.
    • Various changes for references, reading variables, writing variables, etc.
  • Other non-JS/HTML-specific changes (not end user visible for the other target languages):
    • No more references to commented out code to readOnly from VariableInformation, as that field doesn't exist.
    • Removed VariableInformation.isReference, as only assigned, copied, etc, but never read.
    • Proper and consistent marking of temporary variables.
    • Renamed VariableInformation.targetName to targetRef.
    • Renamed CodeGen.getTargetName to getTargetRef.
    • Implement target variable name logic in getTargetVariableName instead of in getTargetRef. The reference should default to the name, not the other way around. Then also Simulink code generation does not need to override getTargetVariableName anymore.
    • Renamed SimulinkCodeGen.simulinkTargetNameMap to simulinkTargetRefMap.
    • Renamed SimulinkCodeGen.setupVarmaps to setupVarMaps.
    • Some other renaming etc, for consistency.
    • Add CodeGen.getPrefix() and use it in CodeGen.

Addresses #715

Merge request reports