Commit c78d570f authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2005-07-15 13:22:33 by afrisch] Avoid clash between the type String and the OCaml module String

Original author: afrisch
Date: 2005-07-15 13:22:33+00:00
parent c03c038a
......@@ -131,8 +131,14 @@ let find_id env0 env loc head x =
with Not_found when head ->
try ECDuce (!load_comp_unit x)
with Not_found ->
if !has_ocaml_unit x then (EOCaml (U.get_str x))
else error loc "Cannot resolve this identifier"
error loc "Cannot resolve this identifier"
let find_id_comp env0 env loc x =
if ((match (U.get_str x).[0] with 'A'..'Z' -> true | _ -> false)
&& !has_ocaml_unit x)
then EOCaml (U.get_str x)
else find_id env0 env loc true x
let enter_value id t env =
{ env with ids = Env.add id (Val t) env.ids }
......@@ -203,7 +209,14 @@ let navig loc env0 (env,comp) id =
| _ -> env,EOCamlComponent s)
| ESchema sch ->
env,find_schema_component sch (ident env0 loc id)
| Type _ -> error loc "Types don't have components"
| Val _ | EVal _ -> error loc "Values don't have components"
| ENamespace _ -> error loc "Namespaces don't have components"
| EOCamlComponent _ -> error loc "Caml values don't have components"
| ESchemaComponent _ -> error loc "Schema components don't have components"
(*
| _ -> error loc "Invalid dot access"
*)
let rec find_global env loc ids =
......@@ -247,10 +260,9 @@ let find_local_type env loc id =
| _ -> raise Not_found
let find_value id env =
try match Env.find id env.ids with
match Env.find id env.ids with
| Val t | EVal (_,_,t) -> t
| _ -> raise Not_found
with Not_found -> assert false
let do_open env cu =
let env_cu = !from_comp_unit cu in
......@@ -609,7 +621,7 @@ and dot loc env0 e args =
| `Val e -> `Val (dot_access loc e id)
| `Comp c -> `Comp (navig loc env0 c id))
| Var id ->
(match find_id env0 env0 loc true id with
(match find_id_comp env0 env0 loc id with
| Val _ -> `Val (var env0 loc id)
| c -> `Comp (env0,c))
| e -> `Val (expr env0 loc e)
......
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