|
@@ -1024,6 +1024,23 @@ type inline_kind =
|
|
|
|
|
|
let inline_constructors ctx e =
|
|
let inline_constructors ctx e =
|
|
let vars = ref PMap.empty in
|
|
let vars = ref PMap.empty in
|
|
|
|
+ let is_valid_ident s =
|
|
|
|
+ try
|
|
|
|
+ if String.length s = 0 then raise Exit;
|
|
|
|
+ begin match String.unsafe_get s 0 with
|
|
|
|
+ | 'a'..'z' | 'A'..'Z' | '_' -> ()
|
|
|
|
+ | _ -> raise Exit
|
|
|
|
+ end;
|
|
|
|
+ for i = 1 to String.length s - 1 do
|
|
|
|
+ match String.unsafe_get s i with
|
|
|
|
+ | 'a'..'z' | 'A'..'Z' | '_' -> ()
|
|
|
|
+ | '0'..'9' when i > 0 -> ()
|
|
|
|
+ | _ -> raise Exit
|
|
|
|
+ done;
|
|
|
|
+ true
|
|
|
|
+ with Exit ->
|
|
|
|
+ false
|
|
|
|
+ in
|
|
let rec get_inline_ctor_info e = match e.eexpr with
|
|
let rec get_inline_ctor_info e = match e.eexpr with
|
|
| TNew ({ cl_constructor = Some ({ cf_kind = Method MethInline; cf_expr = Some { eexpr = TFunction f } } as cst) } as c,_,pl) ->
|
|
| TNew ({ cl_constructor = Some ({ cf_kind = Method MethInline; cf_expr = Some { eexpr = TFunction f } } as cst) } as c,_,pl) ->
|
|
IKCtor (f,cst,c,pl,[])
|
|
IKCtor (f,cst,c,pl,[])
|
|
@@ -1032,7 +1049,10 @@ let inline_constructors ctx e =
|
|
| TArrayDecl el ->
|
|
| TArrayDecl el ->
|
|
IKArray el
|
|
IKArray el
|
|
| TObjectDecl fl ->
|
|
| TObjectDecl fl ->
|
|
- IKStructure fl
|
|
|
|
|
|
+ if (List.exists (fun (s,_) -> not (is_valid_ident s)) fl) then
|
|
|
|
+ IKNone
|
|
|
|
+ else
|
|
|
|
+ IKStructure fl
|
|
| TCast(e,None) | TParenthesis e ->
|
|
| TCast(e,None) | TParenthesis e ->
|
|
get_inline_ctor_info e
|
|
get_inline_ctor_info e
|
|
| TBlock el ->
|
|
| TBlock el ->
|