diff --git a/src/eff.ml b/src/eff.ml index 448cf7000d665d13f72bdc3590049df31c6e5d32..b7173d78db478a5cb58932db1235adf0aba1581a 100644 --- a/src/eff.ml +++ b/src/eff.ml @@ -108,7 +108,7 @@ type id_solver = { id2type : Ident.idref -> Lxm.t -> type_; id2node : Ident.idref -> static_arg list -> Lxm.t -> node_exp; id2var : Ident.idref -> Lxm.t -> var_info; - symbols : SymbolTab.t; + global_symbols : SymbolTab.t; } (*--------------------------------------------------------------------- diff --git a/src/getEff.ml b/src/getEff.ml index 4ad1313a1d5e9bfd9d35a8db2f9d913f4d4b4523..90484bdcd8a22f4d0a74f020f265eaf2fe63c884 100644 --- a/src/getEff.ml +++ b/src/getEff.ml @@ -43,7 +43,7 @@ let (add_pack_name : id_solver -> Lxm.t -> Ident.idref -> Ident.idref) = | None -> let id = Ident.of_idref cc in let pn = - SymbolTab.find_pack_of_const id_solver.symbols id lxm + SymbolTab.find_pack_of_const id_solver.global_symbols id lxm in Ident.make_idref pn id with _ -> cc (* raise en error? *) @@ -114,7 +114,16 @@ let (get_static_params_from_idref : SymbolTab.t -> Lxm.t -> Ident.idref -> (* can occur for static node parameters, which cannot themselves have static parameters. A better solution ougth to be to add node static parameters in the SymbolTab.t - however (in Lazycompiler.node_check_do most probably). *) + however (in Lazycompiler.node_check_do most probably). + + OUI MAIS GROS BUG : qu'est-ce-qui se passe si si le + 'static node parameter' porte le meme nom qu'un noeud + existant dans SymbolTab ??? + + C'est clairement pas la bonne méthode ... + Voir + bas ... + + *) [] (* exported *) @@ -122,8 +131,21 @@ let rec (of_node : Eff.id_solver -> SyntaxTreeCore.node_exp srcflagged -> Eff.node_exp) = fun id_solver { src = lxm; it=(idref, static_args) } -> - let static_params = get_static_params_from_idref id_solver.symbols lxm idref in - let static_args_eff = + (* BUG des param statique node avec le meme nom + qu'un node template global : + pis-aller : si static_args = [], + on a peut-etre affaire à un static param node, donc + on appelle directement id_solver.id2node et c'est lui + qui plantera si ce n'est pas le cas et qu'il fallait + des static_args... + si static_args <> [], de toute maniere ca ne peut PAS + etre un static param node + *) + + let static_args_eff = match static_args with + | [] -> [] + | _ -> + let static_params = get_static_params_from_idref id_solver.global_symbols lxm idref in let sp_l = List.length static_params and sa_l = List.length static_args in if (sp_l <> sa_l) then @@ -136,7 +158,7 @@ let rec (of_node : Eff.id_solver -> SyntaxTreeCore.node_exp srcflagged -> List.map2 (check_static_arg id_solver) static_params static_args - in + in id_solver.id2node idref static_args_eff lxm @@ -397,7 +419,7 @@ and (translate_val_exp : Eff.id_solver -> UnifyClock.subst -> (* try to add its pack name... *) let id = Ident.of_idref idref in let pn = - SymbolTab.find_pack_of_const id_solver.symbols id lxm + SymbolTab.find_pack_of_const id_solver.global_symbols id lxm in let idref = Ident.make_idref pn id in s, mk_by_pos_op(Eff.IDENT (idref)) @@ -546,7 +568,7 @@ and translate_by_name_op id_solver op = | None -> (* If no pack name is provided, we lookup it in the symbol table *) let id = Ident.of_idref idref in - let pn = SymbolTab.find_pack_of_type id_solver.symbols id op.src in + let pn = SymbolTab.find_pack_of_type id_solver.global_symbols id op.src in STRUCT (pn, idref) | Some pn -> STRUCT (pn, idref) diff --git a/src/lazyCompiler.ml b/src/lazyCompiler.ml index d6f1ced87450769f25e9a4e425302de5305fe477..96513c839153aac61531345e43676357aaafb651 100644 --- a/src/lazyCompiler.ml +++ b/src/lazyCompiler.ml @@ -439,7 +439,7 @@ and (type_check_do: t -> Ident.long -> Lxm.t -> SymbolTab.t -> bool -> id2const = solve_const_idref this symbols provide_flag pack_name; id2type = solve_type_idref this symbols provide_flag pack_name; id2node = solve_node_idref this symbols provide_flag pack_name; - symbols = symbols; + global_symbols = symbols; } in let type_eff = @@ -526,7 +526,7 @@ and (const_check_do : t -> Ident.long -> Lxm.t -> SymbolTab.t -> bool -> id2const = solve_const_idref this symbols provide_flag currpack; id2type = solve_type_idref this symbols provide_flag currpack; id2node = solve_node_idref this symbols provide_flag currpack; - symbols = symbols; + global_symbols = symbols; } in let const_eff = @@ -783,7 +783,9 @@ and node_check_do | _ -> assert false) ); - symbols = symbols; + (* ATTENTION EN SE SERVANT DE CA ! + ne tient pas compte des params statiques du noeud ! *) + global_symbols = symbols; } in let make_node_eff id node_def_eff = ( @@ -825,7 +827,7 @@ and node_check_do id2const = local_id2const; id2type = node_id_solver.id2type; id2node = node_id_solver.id2node; - symbols = node_id_solver.symbols; + global_symbols = node_id_solver.global_symbols; } and treat_local_const id = ( Verbose.printf ~level:3 " * call treat_local_const %s\n" id; diff --git a/src/symbolTab.mli b/src/symbolTab.mli index 1c2240c3106c551a538858c54ac1c598c2901d1a..ac54fd034908d9167321873bf90e22ef8027c5ed 100644 --- a/src/symbolTab.mli +++ b/src/symbolTab.mli @@ -51,3 +51,4 @@ val iter_types: t -> (Ident.t -> (type_info Lxm.srcflagged) elt -> unit) -> unit val iter_consts: t ->(Ident.t -> (const_info Lxm.srcflagged) elt -> unit) -> unit val iter_nodes : t ->(Ident.t -> (node_info Lxm.srcflagged) elt -> unit) -> unit +