Skip to content
This repository has been archived by the owner on May 18, 2019. It is now read-only.

Commit

Permalink
Add dumping of external declaration annotations.
Browse files Browse the repository at this point in the history
- Dump external declaration annotations in DAEDumpTpl when
  --showAnnotations is used.

Belonging to [master]:
  - #3065
  • Loading branch information
perost authored and OpenModelica-Hudson committed Apr 24, 2019
1 parent bdf89c3 commit a5eccba
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions Compiler/Template/DAEDumpTpl.tpl
Expand Up @@ -118,7 +118,8 @@ match externalDecl
let ext_output_str = '<%dumpExtArg(returnArg)%>'
let output_str = if ext_output_str then ' <%ext_output_str%> ='
let lang_str = language
' external "<%lang_str%>"<%output_str%><%func_str%>;'
let ann_str = match ann case SOME(annotation) then ' <%dumpAnnotation(annotation)%>'
' external "<%lang_str%>"<%output_str%><%func_str%><%ann_str%>;'
end dumpExternalDecl;

template dumpExtArgs(list<ExtArg> args)
Expand Down Expand Up @@ -1036,15 +1037,7 @@ template dumpCommentAnnotation(Option<SCode.Comment> comment)
end dumpCommentAnnotation;

template dumpCommentAnnotationNoOpt(SCode.Comment comment)
::=
match comment
case SCode.COMMENT(annotation_ = SOME(SCode.ANNOTATION(modification = ann_mod))) then
if Config.showAnnotations() then
'annotation<%SCodeDumpTpl.dumpModifier(ann_mod, SCodeDump.defaultOptions)%>'
else if Config.showStructuralAnnotations() then
let ann_str = SCodeDumpTpl.dumpModifier(DAEDump.filterStructuralMods(ann_mod), SCodeDump.defaultOptions)
if ann_str then
'annotation<%ann_str%>'
::= match comment case SCode.COMMENT(annotation_ = SOME(ann)) then dumpAnnotation(ann)
end dumpCommentAnnotationNoOpt;

template dumpCommentOpt(Option<SCode.Comment> comment)
Expand All @@ -1059,6 +1052,22 @@ template dumpCommentStr(Option<String> comment)
::= match comment case SOME(cmt) then '<%\ %>"<%System.escapedString(cmt,false)%>"'
end dumpCommentStr;

template dumpAnnotationOpt(Option<SCode.Annotation> annotation)
::= match annotation case SOME(ann) then dumpAnnotation(ann)
end dumpAnnotationOpt;

template dumpAnnotation(SCode.Annotation annotation)
::=
match annotation
case SCode.ANNOTATION(modification = ann_mod) then
if Config.showAnnotations() then
'annotation<%SCodeDumpTpl.dumpModifier(ann_mod, SCodeDump.defaultOptions)%>'
else if Config.showStructuralAnnotations() then
let ann_str = SCodeDumpTpl.dumpModifier(DAEDump.filterStructuralMods(ann_mod), SCodeDump.defaultOptions)
if ann_str then
'annotation<%ann_str%>'
end dumpAnnotation;

template dumpPathLastIndent(Absyn.Path path)
::=
match path
Expand Down

0 comments on commit a5eccba

Please sign in to comment.