Skip to content

Commit

Permalink
Removed overload keyword, instead allowing multiple definitions of fu…
Browse files Browse the repository at this point in the history
…nctions with same name in the same scope.

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@1059 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Peter Aronsson committed Jan 5, 2004
1 parent 8d69922 commit d220b8b
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 56 deletions.
6 changes: 1 addition & 5 deletions modelica_parser/src/modelica_parser.g
Expand Up @@ -103,7 +103,6 @@ class_type :
class_specifier :
( string_comment composition END! IDENT!
| EQUALS^ base_prefix name_path ( array_subscripts )? ( class_modification )? comment
| EQUALS^ overloading
| EQUALS^ enumeration
)
;
Expand All @@ -112,9 +111,6 @@ base_prefix:
type_prefix
;

overloading:
OVERLOAD^ LPAR! name_list RPAR! comment
;
name_list:
name_path (COMMA! name_path)*
;
Expand Down Expand Up @@ -554,7 +550,7 @@ simple_expression ! :
;
/* Code quotation mechanism */
code_expression ! :
CODE LPAR ((expression RPAR)=> e:expression | m:modification | el:element
CODE LPAR ((expression RPAR)=> e:expression | m:modification | el:element (SEMICOLON!)?
| eq:code_equation_clause | ieq:code_initial_equation_clause
| alg:code_algorithm_clause | ialg:code_initial_algorithm_clause
) RPAR
Expand Down
4 changes: 0 additions & 4 deletions modeq/absyn.rml
Expand Up @@ -71,10 +71,6 @@ module Absyn:

| ENUMERATION of EnumLiteral list
* Comment option (* comment*)

| OVERLOAD of Path list (* function names*)
* Comment option

(** The `ClassDef' type contains the definition part of a class *)
(** declaration. The definition is either explicit, with a list of *)
(** parts (`public', `protected', `equation' and `algorithm'), or it *)
Expand Down
26 changes: 1 addition & 25 deletions modeq/absyn_builder/walker.g
Expand Up @@ -206,8 +206,7 @@ class_specifier returns [void* ast]
ast = Absyn__PARTS(comp,cmt ? mk_some(cmt) : mk_none());
}
)
| #(EQUALS ( ast = derived_class | ast = enumeration | ast = overloading))

| #(EQUALS ( ast = derived_class | ast = enumeration))
;

derived_class returns [void *ast]
Expand Down Expand Up @@ -273,29 +272,6 @@ enumeration_literal returns [void *ast] :
}
;

overloading returns [void *ast]
{
l_stack el_stack;
void *el = 0;
void *cmt = 0;
}
:
#(OVERLOAD
el = name_path
{ el_stack.push(el); }
(
el = name_path
{ el_stack.push(el); }

)*
(cmt=comment)?
)
{
ast = Absyn__OVERLOAD(make_rml_list_from_stack(el_stack),
cmt ? mk_some(cmt) : mk_none());
}
;

composition returns [void* ast]
{
void* el = 0;
Expand Down
14 changes: 3 additions & 11 deletions modeq/dump.rml
Expand Up @@ -172,15 +172,6 @@ relation unparse_class_str: (int, Absyn.Class,string,string,string) => string =
-------------------------------
unparse_class_str(i, Absyn.CLASS(n,p,f,e,r,Absyn.ENUMERATION(l,cmt)),fi,re,io) => str

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

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

rule print_code_str(c) => res
rule print_code_str(c) => res &
Util.string_append_list(["Code(",res,")"]) => res'
--------------------------
print_exp_str ( Absyn.CODE(c)) => res
print_exp_str ( Absyn.CODE(c)) => res'

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

Expand Down
2 changes: 0 additions & 2 deletions modeq/explode.rml
Expand Up @@ -89,7 +89,6 @@ module SCode :
* Absyn.ArrayDim option
* Mod
| ENUMERATION of Ident list
| OVERLOAD of Absyn.Path list

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

axiom elab_classdef(Absyn.OVERLOAD(lst,_)) => OVERLOAD(lst)
end

relation elab_enumlist:(Absyn.EnumLiteral list) => Ident list =
Expand Down
9 changes: 0 additions & 9 deletions modeq/inst.rml
Expand Up @@ -2593,15 +2593,6 @@ relation implicit_function_instantiation : (Env.Env, Types.Mod, Prefix.Prefix,
Connect.Sets, SCode.Class,InstDims, bool)
=> (Env.Env, DAE.Element list) =

rule (* Overloaded functions *)
inst_overloaded_functions(env,n,funcnames) => (env',daefuncs)
-----------------------------
implicit_function_instantiation(env,mod,pre,csets,
c as SCode.CLASS(n,_,_, restr as SCode.R_FUNCTION,
SCode.OVERLOAD(funcnames)),
inst_dims, false)
=> (env', daefuncs)

rule (*Prefix.prefix_add(n,[],pre) => pre' &*)
inst_class(env, mod, pre, csets, c, inst_dims, true,INNER_CALL)
=> (dae, _, csets', ty, st) &
Expand Down

0 comments on commit d220b8b

Please sign in to comment.