Changeset 4d401cc in OpenModelica


Ignore:
Timestamp:
2021-04-09T14:23:57+02:00 (3 years ago)
Author:
Per Östlund <perost86@…>
Parents:
723951b
git-author:
Per Östlund <perost86@…> (04/09/21 14:22:32)
git-committer:
Per Östlund <perost86@…> (04/09/21 14:23:57)
Message:

Add SourceInfo to external sections

  • Add SourceInfo to external sections for better error messages.
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • OMCompiler/Compiler/NFFrontEnd/NFInst.mo

    r0953e25 r4d401cc  
    28412841      algorithm
    28422842        // Class with inherited external section that also contains other sections.
    2843         Error.addSourceMessage(Error.MULTIPLE_SECTIONS_IN_FUNCTION,
    2844           {InstNode.name(scope)}, InstNode.info(scope));
     2843        Error.addMultiSourceMessage(Error.MULTIPLE_SECTIONS_IN_FUNCTION,
     2844          {InstNode.name(scope)}, {sections.info, InstNode.info(scope)});
    28452845      then
    28462846        fail();
     
    28992899        end if;
    29002900      then
    2901         Sections.EXTERNAL(name, args, ret_cref, lang, extDecl.annotation_, isSome(extDecl.funcName));
     2901        Sections.EXTERNAL(name, args, ret_cref, lang, extDecl.annotation_, isSome(extDecl.funcName), info);
    29022902
    29032903  end match;
  • OMCompiler/Compiler/NFFrontEnd/NFSections.mo

    reba51605 r4d401cc  
    5858    Option<Annotation> ann;
    5959    Boolean explicit;
     60    SourceInfo info;
    6061  end EXTERNAL;
    6162
  • testsuite/flattening/modelica/scodeinst/ExtendInherited1.mo

    r83ebb9b r4d401cc  
    1 // name: ExtendsInherited1
     1// name: ExtendInherited1
    22// keywords:
    33// status: incorrect
     
    1313end A;
    1414
    15 model ExtendsInherited1
     15model ExtendInherited1
    1616  extends A;
    17 end ExtendsInherited1;
     17end ExtendInherited1;
    1818
    1919// Result:
  • testsuite/flattening/modelica/scodeinst/ExternalFunctionInvalidSection1.mo

    r83ebb9b r4d401cc  
    2626// Result:
    2727// Error processing file: ExternalFunctionInvalidSection1.mo
     28// [flattening/modelica/scodeinst/ExternalFunctionInvalidSection1.mo:15:3-15:12:writable] Notification: From here:
    2829// [flattening/modelica/scodeinst/ExternalFunctionInvalidSection1.mo:14:1-18:7:writable] Error: Function f2 has more than one algorithm section or external declaration.
    2930//
  • testsuite/flattening/modelica/scodeinst/FunctionSections4.mo

    r0953e25 r4d401cc  
    2323// Result:
    2424// Error processing file: FunctionSections4.mo
     25// [flattening/modelica/scodeinst/FunctionSections4.mo:15:3-15:17:writable] Notification: From here:
    2526// [flattening/modelica/scodeinst/FunctionSections4.mo:14:1-17:6:writable] Error: Function f has more than one algorithm section or external declaration.
    2627//
Note: See TracChangeset for help on using the changeset viewer.