Skip to content

Commit d220b8b

Browse files
author
Peter Aronsson
committed
Removed overload keyword, instead allowing multiple definitions of functions with same name in the same scope.
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@1059 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent 8d69922 commit d220b8b

File tree

6 files changed

+5
-56
lines changed

6 files changed

+5
-56
lines changed

modelica_parser/src/modelica_parser.g

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ class_type :
103103
class_specifier :
104104
( string_comment composition END! IDENT!
105105
| EQUALS^ base_prefix name_path ( array_subscripts )? ( class_modification )? comment
106-
| EQUALS^ overloading
107106
| EQUALS^ enumeration
108107
)
109108
;
@@ -112,9 +111,6 @@ base_prefix:
112111
type_prefix
113112
;
114113

115-
overloading:
116-
OVERLOAD^ LPAR! name_list RPAR! comment
117-
;
118114
name_list:
119115
name_path (COMMA! name_path)*
120116
;
@@ -554,7 +550,7 @@ simple_expression ! :
554550
;
555551
/* Code quotation mechanism */
556552
code_expression ! :
557-
CODE LPAR ((expression RPAR)=> e:expression | m:modification | el:element
553+
CODE LPAR ((expression RPAR)=> e:expression | m:modification | el:element (SEMICOLON!)?
558554
| eq:code_equation_clause | ieq:code_initial_equation_clause
559555
| alg:code_algorithm_clause | ialg:code_initial_algorithm_clause
560556
) RPAR

modeq/absyn.rml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,6 @@ module Absyn:
7171

7272
| ENUMERATION of EnumLiteral list
7373
* Comment option (* comment*)
74-
75-
| OVERLOAD of Path list (* function names*)
76-
* Comment option
77-
7874
(** The `ClassDef' type contains the definition part of a class *)
7975
(** declaration. The definition is either explicit, with a list of *)
8076
(** parts (`public', `protected', `equation' and `algorithm'), or it *)

modeq/absyn_builder/walker.g

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,7 @@ class_specifier returns [void* ast]
206206
ast = Absyn__PARTS(comp,cmt ? mk_some(cmt) : mk_none());
207207
}
208208
)
209-
| #(EQUALS ( ast = derived_class | ast = enumeration | ast = overloading))
210-
209+
| #(EQUALS ( ast = derived_class | ast = enumeration))
211210
;
212211

213212
derived_class returns [void *ast]
@@ -273,29 +272,6 @@ enumeration_literal returns [void *ast] :
273272
}
274273
;
275274

276-
overloading returns [void *ast]
277-
{
278-
l_stack el_stack;
279-
void *el = 0;
280-
void *cmt = 0;
281-
}
282-
:
283-
#(OVERLOAD
284-
el = name_path
285-
{ el_stack.push(el); }
286-
(
287-
el = name_path
288-
{ el_stack.push(el); }
289-
290-
)*
291-
(cmt=comment)?
292-
)
293-
{
294-
ast = Absyn__OVERLOAD(make_rml_list_from_stack(el_stack),
295-
cmt ? mk_some(cmt) : mk_none());
296-
}
297-
;
298-
299275
composition returns [void* ast]
300276
{
301277
void* el = 0;

modeq/dump.rml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -172,15 +172,6 @@ relation unparse_class_str: (int, Absyn.Class,string,string,string) => string =
172172
-------------------------------
173173
unparse_class_str(i, Absyn.CLASS(n,p,f,e,r,Absyn.ENUMERATION(l,cmt)),fi,re,io) => str
174174

175-
rule indent_str(i) => is &
176-
select_string(p, "partial ", "") => s1 &
177-
select_string(f, "final ", "") => s2 &
178-
unparse_restriction_str (r) => s3 &
179-
print_list_str(l,Absyn.path_string,",") => s4 &
180-
unparse_comment_option(cmt) => s5 &
181-
Util.string_append_list([is,s1,s2,re,io,s3," ",n,"= overload(",s4,")",s5]) => str
182-
-------------------------------
183-
unparse_class_str(i, Absyn.CLASS(n,p,f,e,r,Absyn.OVERLOAD(l,cmt)),fi,re,io) => str
184175
end
185176

186177
relation unparse_comment_option: (Absyn.Comment option) => string =
@@ -1940,9 +1931,10 @@ relation print_exp_str : Absyn.Exp => string =
19401931
------------------------------------
19411932
print_exp_str (e as Absyn.RANGE(start,SOME(step),stop)) => s
19421933

1943-
rule print_code_str(c) => res
1934+
rule print_code_str(c) => res &
1935+
Util.string_append_list(["Code(",res,")"]) => res'
19441936
--------------------------
1945-
print_exp_str ( Absyn.CODE(c)) => res
1937+
print_exp_str ( Absyn.CODE(c)) => res'
19461938

19471939
axiom print_exp_str (_) => "#UNKNOWN EXPRESSION#"
19481940

modeq/explode.rml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ module SCode :
8989
* Absyn.ArrayDim option
9090
* Mod
9191
| ENUMERATION of Ident list
92-
| OVERLOAD of Absyn.Path list
9392

9493
(** The major difference between these types and their `Absyn' *)
9594
(** counterparts is that the `PARTS' constructor contains separate *)
@@ -268,7 +267,6 @@ relation elab_classdef: Absyn.ClassDef => ClassDef =
268267
--------------------------
269268
elab_classdef(Absyn.ENUMERATION(lst,_)) => ENUMERATION(lst')
270269

271-
axiom elab_classdef(Absyn.OVERLOAD(lst,_)) => OVERLOAD(lst)
272270
end
273271

274272
relation elab_enumlist:(Absyn.EnumLiteral list) => Ident list =

modeq/inst.rml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2593,15 +2593,6 @@ relation implicit_function_instantiation : (Env.Env, Types.Mod, Prefix.Prefix,
25932593
Connect.Sets, SCode.Class,InstDims, bool)
25942594
=> (Env.Env, DAE.Element list) =
25952595

2596-
rule (* Overloaded functions *)
2597-
inst_overloaded_functions(env,n,funcnames) => (env',daefuncs)
2598-
-----------------------------
2599-
implicit_function_instantiation(env,mod,pre,csets,
2600-
c as SCode.CLASS(n,_,_, restr as SCode.R_FUNCTION,
2601-
SCode.OVERLOAD(funcnames)),
2602-
inst_dims, false)
2603-
=> (env', daefuncs)
2604-
26052596
rule (*Prefix.prefix_add(n,[],pre) => pre' &*)
26062597
inst_class(env, mod, pre, csets, c, inst_dims, true,INNER_CALL)
26072598
=> (dae, _, csets', ty, st) &

0 commit comments

Comments
 (0)