Linux GNU 11.4.0 Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 0.0% 0 / 0 / 37
Functions: -% 0 / 1 / 1
Branches: -% 0 / 0 / 0

OMCompiler/Compiler/FFrontEnd/FExpand.mo
Line Branch Exec Source
1 /*
2 * This file is part of OpenModelica.
3 *
4 * Copyright (c) 1998-2026, Open Source Modelica Consortium (OSMC),
5 * c/o Linköpings universitet, Department of Computer and Information Science,
6 * SE-58183 Linköping, Sweden.
7 *
8 * All rights reserved.
9 *
10 * THIS PROGRAM IS PROVIDED UNDER THE TERMS OF AGPL VERSION 3 LICENSE OR
11 * THIS OSMC PUBLIC LICENSE (OSMC-PL) VERSION 1.8.
12 * ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES
13 * RECIPIENT'S ACCEPTANCE OF THE OSMC PUBLIC LICENSE OR THE GNU AGPL
14 * VERSION 3, ACCORDING TO RECIPIENTS CHOICE.
15 *
16 * The OpenModelica software and the OSMC (Open Source Modelica Consortium)
17 * Public License (OSMC-PL) are obtained from OSMC, either from the above
18 * address, from the URLs:
19 * http://www.openmodelica.org or
20 * https://github.com/OpenModelica/ or
21 * http://www.ida.liu.se/projects/OpenModelica,
22 * and in the OpenModelica distribution.
23 *
24 * GNU AGPL version 3 is obtained from:
25 * https://www.gnu.org/licenses/licenses.html#GPL
26 *
27 * This program is distributed WITHOUT ANY WARRANTY; without
28 * even the implied warranty of MERCHANTABILITY or FITNESS
29 * FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY SET FORTH
30 * IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS OF OSMC-PL.
31 *
32 * See the full OSMC Public License conditions for more details.
33 *
34 */
35
36 encapsulated package FExpand
37 " file: FExpand.mo
38 package: FExpand
39 description: Expanding parts of the graph
40
41
42 "
43
44 // public imports
45 public
46 import Absyn;
47 import FCore;
48
49 protected
50 import System;
51 import FResolve;
52 import FGraph;
53 import List;
54
55 public
56 type Name = FCore.Name;
57 type Id = FCore.Id;
58 type Seq = FCore.Seq;
59 type Next = FCore.Next;
60 type Node = FCore.Node;
61 type Data = FCore.Data;
62 type Kind = FCore.Kind;
63 type Ref = FCore.Ref;
64 type Refs = FCore.Refs;
65 type Children = FCore.Children;
66 type Parents = FCore.Parents;
67 type Scope = FCore.Scope;
68 type ImportTable = FCore.ImportTable;
69 type Graph = FCore.Graph;
70 type Extra = FCore.Extra;
71 type Visited = FCore.Visited;
72 type Import = FCore.Import;
73 type Msg = Option<SourceInfo>;
74
75 public function path
76 "@author: adrpo
77 expand a path in the graph."
78 input Graph inGraph;
79 input Absyn.Path inPath;
80 output Graph outGraph;
81 output Ref outRef;
82 algorithm
83 (outGraph, outRef) := match inGraph
84 local
85 Ref r, t;
86 Graph g;
87
88 case g
89 algorithm
90 ✗ t := FGraph.top(g);
91 r := t;
92 then
93 (g, r);
94
95 end match;
96 end path;
97
98 public function all
99 "@author: adrpo
100 expand all references in the graph."
101 input Graph inGraph;
102 output Graph outGraph;
103 algorithm
104 outGraph := match inGraph
105 local
106 list<Real> lst;
107 Graph g;
108
109 case g
110 algorithm
111 lst := {};
112
113 ✗ System.startTimer();
114 // resolve extends
115 ✗ g := FResolve.ext(FGraph.top(g), g);
116 ✗ System.stopTimer();
117 ✗ lst := List.consr(lst, System.getTimerIntervalTime());
118 ✗ print("Extends: " + realString(listHead(lst)) + "\n");
119
120 ✗ System.startTimer();
121 // resolve derived
122 ✗ g := FResolve.derived(FGraph.top(g), g);
123 ✗ System.stopTimer();
124 ✗ lst := List.consr(lst, System.getTimerIntervalTime());
125 ✗ print("Derived: " + realString(listHead(lst)) + "\n");
126
127 ✗ System.startTimer();
128 // resolve type paths for constrain classes
129 ✗ g := FResolve.cc(FGraph.top(g), g);
130 ✗ System.stopTimer();
131 ✗ lst := List.consr(lst, System.getTimerIntervalTime());
132 ✗ print("ConstrainedBy: " + realString(listHead(lst)) + "\n");
133
134 ✗ System.startTimer();
135 // resolve class extends nodes
136 ✗ g := FResolve.clsext(FGraph.top(g), g);
137 ✗ System.stopTimer();
138 ✗ lst := List.consr(lst, System.getTimerIntervalTime());
139 ✗ print("ClassExtends: " + realString(listHead(lst)) + "\n");
140
141 ✗ System.startTimer();
142 // resolve type paths
143 ✗ g := FResolve.ty(FGraph.top(g), g);
144 ✗ System.stopTimer();
145 ✗ lst := List.consr(lst, System.getTimerIntervalTime());
146 ✗ print("ComponentTypes: " + realString(listHead(lst)) + "\n");
147
148 ✗ System.startTimer();
149 // resolve all component references
150 ✗ g := FResolve.cr(FGraph.top(g), g);
151 ✗ System.stopTimer();
152 ✗ lst := List.consr(lst, System.getTimerIntervalTime());
153 ✗ print("Comp Refs: " + realString(listHead(lst)) + "\n");
154
155 ✗ System.startTimer();
156 // resolve all modifier lhs (thisOne = binding)
157 ✗ g := FResolve.mod(FGraph.top(g), g);
158 ✗ System.stopTimer();
159 ✗ lst := List.consr(lst, System.getTimerIntervalTime());
160 ✗ print("Modifiers: " + realString(listHead(lst)) + "\n");
161
162 ✗ print("FExpand.all: " + realString(List.fold(lst, realAdd, 0.0)) + "\n");
163 then
164 g;
165
166 end match;
167 end all;
168
169 annotation(__OpenModelica_Interface="frontend");
170 end FExpand;
171