Commit 1081ca82 authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2005-07-07 14:30:01 by afrisch] Export namespaces, schemas, ...

Original author: afrisch
Date: 2005-07-07 14:30:01+00:00
parent 60f7d9ca
......@@ -335,10 +335,12 @@ EXTEND
| "no_appl"
[ e = expr; "with"; "{"; tyargs = LIST0 pat; "}" ->
exp loc (TyArgs (e, tyargs))
| e = expr; "."; l = [IDENT | keyword ] ->
exp loc (Dot (e,label l))
[ e = expr; "."; l = [IDENT | keyword ];
tyargs = [ "with"; "{"; tyargs = LIST0 pat; "}" -> Some tyargs
| -> None ] ->
let e = Dot (e,label l) in
match tyargs with None -> exp loc e | Some tyargs ->
exp loc (TyArgs (e,tyargs))
]
| [
"("; l = LIST1 expr SEP ","; ")" -> exp loc (tuple l)
......
......@@ -148,12 +148,7 @@ let enter_values l env =
let enter_values_dummy l env =
{ env with ids =
List.fold_left (fun accu id -> Env.add id (Val Types.empty) accu) env.ids l }
(*
let find_value_global loc cu id =
try find_value id (!from_comp_unit cu)
with Not_found -> raise_loc loc (UnboundExtId (cu,id))
*)
let value_name_ok id env =
try match Env.find id env.ids with
| Val t -> true
......@@ -255,7 +250,7 @@ let find_global_schema_component env loc ids =
let find_local_type env loc id =
match Env.find id env.ids with
| Type t -> t
| _ -> error loc "This identifier does not refer to a type"
| _ -> raise Not_found
let check_local_value env loc id =
try match Env.find id env.ids with
......@@ -616,36 +611,6 @@ and dot loc env0 e args =
no_args (); exp loc Fv.empty (Typed.ExtVar (cu,id,t))
| `Comp (_,EOCamlComponent s) -> extern loc env0 s args
| _ -> error loc "This dot notation does not refer to a value"
(*
let rec aux loc fields args = function
| Var cu when not (has_value cu env) ->
(match find_cu loc cu env with
| ECDuce cu ->
if args != [] then
error loc "CDuce externals cannot have type argument";
let id,fields =
(match fields with (hd,_)::tl -> hd,tl | _ -> assert false) in
let id = ident env loc id in
let t = find_value_global loc cu id env in
let e = exp loc Fv.empty (Typed.ExtVar (cu, id, t)) in
List.fold_left (fun e (x,loc) -> dot_access loc e x) e fields
| EOCaml cu ->
let fields = List.map fst fields in
let s = String.concat "." (cu :: List.map U.get_str fields) in
extern loc env s args
| ESchema _ ->
error loc "Schema don't export values")
| LocatedExpr (loc,e) -> aux loc fields args e
| Dot (e,id,a) -> aux loc ((id,loc) :: fields) (a @ args) e
| e ->
if args != [] then
error loc "Field access cannot have type arguments"
else
let e = expr env loc e in
List.fold_left (fun e (x,loc) -> dot_access loc e x) e fields
in
aux loc [] [] e
*)
and extern loc env s args =
let args = List.map (typ env) args in
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment