Skip to content

Commit a49c911

Browse files
committed
snapshot
1 parent f222024 commit a49c911

File tree

3 files changed

+57
-27
lines changed

3 files changed

+57
-27
lines changed

lib/4.06.1/unstable/js_compiler.ml

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -396353,7 +396353,8 @@ end = struct
396353396353

396354396354
let rec is_obj_literal ( x : _ Flow_ast.Expression.t) : bool =
396355396355
match snd x with
396356-
| Literal _ -> true
396356+
| Identifier (_, {name = "undefined"})
396357+
| Literal _ -> true
396357396358
| Object {properties} ->
396358396359
Ext_list.for_all properties is_literal_kv
396359396360
| Array {elements} ->
@@ -396370,27 +396371,26 @@ and is_literal_kv (x : _ Flow_ast.Expression.Object.property) =
396370396371
| _ -> false
396371396372

396372396373

396373-
let classify (prog : string) : Js_raw_info.exp =
396374-
match Parser_flow.parse_expression
396375-
(Parser_env.init_env None prog) false with
396374+
let classify_exp (prog : _ Flow_ast.Expression.t ) : Js_raw_info.exp =
396375+
match prog with
396376396376
| (_, Function {
396377396377
id = _;
396378396378
params = (_, {params});
396379396379
async = false;
396380396380
generator = false;
396381396381
predicate = None
396382-
}) , [] ->
396382+
}) ->
396383396383
Js_function {arity = List.length params; arrow = false}
396384396384
| (_, ArrowFunction {
396385396385
id = None;
396386396386
params = (_, {params});
396387396387
async = false;
396388396388
generator = false;
396389396389
predicate = None
396390-
}) , [] ->
396390+
}) ->
396391396391
Js_function
396392396392
{arity = List.length params; arrow = true}
396393-
|(_, Literal {comments}), [] ->
396393+
|(_, Literal {comments}) ->
396394396394
let comment =
396395396395
match comments with
396396396396
| None -> None
@@ -396399,13 +396399,23 @@ let classify (prog : string) : Js_raw_info.exp =
396399396399
| Some _ -> None
396400396400
in
396401396401
Js_literal {comment}
396402-
| (_,Object _) as exp , _ ->
396403-
if is_obj_literal exp then Js_literal {comment = None} else Js_exp_unknown
396402+
| (_, Identifier(_,{name = "undefined"})) -> Js_literal {comment =None}
396403+
| (_,Object _) ->
396404+
if is_obj_literal prog then Js_literal {comment = None} else Js_exp_unknown
396404396405
| _ ->
396405396406
Js_exp_unknown
396406396407
| exception _ ->
396407396408
Js_exp_unknown
396408396409

396410+
let classify (prog : string) : Js_raw_info.exp =
396411+
let prog, errors =
396412+
Parser_flow.parse_expression
396413+
(Parser_env.init_env None prog) false in
396414+
if errors <> [] then
396415+
assert false (* in the calling API, we already asked flow to raise*)
396416+
else classify_exp prog
396417+
396418+
396409396419
let classify_stmt (prog : string) : Js_raw_info.stmt =
396410396420
let result = Parser_flow.parse_program false None prog in
396411396421
match fst result with

lib/4.06.1/unstable/js_refmt_compiler.ml

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -396353,7 +396353,8 @@ end = struct
396353396353

396354396354
let rec is_obj_literal ( x : _ Flow_ast.Expression.t) : bool =
396355396355
match snd x with
396356-
| Literal _ -> true
396356+
| Identifier (_, {name = "undefined"})
396357+
| Literal _ -> true
396357396358
| Object {properties} ->
396358396359
Ext_list.for_all properties is_literal_kv
396359396360
| Array {elements} ->
@@ -396370,27 +396371,26 @@ and is_literal_kv (x : _ Flow_ast.Expression.Object.property) =
396370396371
| _ -> false
396371396372

396372396373

396373-
let classify (prog : string) : Js_raw_info.exp =
396374-
match Parser_flow.parse_expression
396375-
(Parser_env.init_env None prog) false with
396374+
let classify_exp (prog : _ Flow_ast.Expression.t ) : Js_raw_info.exp =
396375+
match prog with
396376396376
| (_, Function {
396377396377
id = _;
396378396378
params = (_, {params});
396379396379
async = false;
396380396380
generator = false;
396381396381
predicate = None
396382-
}) , [] ->
396382+
}) ->
396383396383
Js_function {arity = List.length params; arrow = false}
396384396384
| (_, ArrowFunction {
396385396385
id = None;
396386396386
params = (_, {params});
396387396387
async = false;
396388396388
generator = false;
396389396389
predicate = None
396390-
}) , [] ->
396390+
}) ->
396391396391
Js_function
396392396392
{arity = List.length params; arrow = true}
396393-
|(_, Literal {comments}), [] ->
396393+
|(_, Literal {comments}) ->
396394396394
let comment =
396395396395
match comments with
396396396396
| None -> None
@@ -396399,13 +396399,23 @@ let classify (prog : string) : Js_raw_info.exp =
396399396399
| Some _ -> None
396400396400
in
396401396401
Js_literal {comment}
396402-
| (_,Object _) as exp , _ ->
396403-
if is_obj_literal exp then Js_literal {comment = None} else Js_exp_unknown
396402+
| (_, Identifier(_,{name = "undefined"})) -> Js_literal {comment =None}
396403+
| (_,Object _) ->
396404+
if is_obj_literal prog then Js_literal {comment = None} else Js_exp_unknown
396404396405
| _ ->
396405396406
Js_exp_unknown
396406396407
| exception _ ->
396407396408
Js_exp_unknown
396408396409

396410+
let classify (prog : string) : Js_raw_info.exp =
396411+
let prog, errors =
396412+
Parser_flow.parse_expression
396413+
(Parser_env.init_env None prog) false in
396414+
if errors <> [] then
396415+
assert false (* in the calling API, we already asked flow to raise*)
396416+
else classify_exp prog
396417+
396418+
396409396419
let classify_stmt (prog : string) : Js_raw_info.stmt =
396410396420
let result = Parser_flow.parse_program false None prog in
396411396421
match fst result with

lib/4.06.1/whole_compiler.ml

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -399266,7 +399266,8 @@ end = struct
399266399266

399267399267
let rec is_obj_literal ( x : _ Flow_ast.Expression.t) : bool =
399268399268
match snd x with
399269-
| Literal _ -> true
399269+
| Identifier (_, {name = "undefined"})
399270+
| Literal _ -> true
399270399271
| Object {properties} ->
399271399272
Ext_list.for_all properties is_literal_kv
399272399273
| Array {elements} ->
@@ -399283,27 +399284,26 @@ and is_literal_kv (x : _ Flow_ast.Expression.Object.property) =
399283399284
| _ -> false
399284399285

399285399286

399286-
let classify (prog : string) : Js_raw_info.exp =
399287-
match Parser_flow.parse_expression
399288-
(Parser_env.init_env None prog) false with
399287+
let classify_exp (prog : _ Flow_ast.Expression.t ) : Js_raw_info.exp =
399288+
match prog with
399289399289
| (_, Function {
399290399290
id = _;
399291399291
params = (_, {params});
399292399292
async = false;
399293399293
generator = false;
399294399294
predicate = None
399295-
}) , [] ->
399295+
}) ->
399296399296
Js_function {arity = List.length params; arrow = false}
399297399297
| (_, ArrowFunction {
399298399298
id = None;
399299399299
params = (_, {params});
399300399300
async = false;
399301399301
generator = false;
399302399302
predicate = None
399303-
}) , [] ->
399303+
}) ->
399304399304
Js_function
399305399305
{arity = List.length params; arrow = true}
399306-
|(_, Literal {comments}), [] ->
399306+
|(_, Literal {comments}) ->
399307399307
let comment =
399308399308
match comments with
399309399309
| None -> None
@@ -399312,13 +399312,23 @@ let classify (prog : string) : Js_raw_info.exp =
399312399312
| Some _ -> None
399313399313
in
399314399314
Js_literal {comment}
399315-
| (_,Object _) as exp , _ ->
399316-
if is_obj_literal exp then Js_literal {comment = None} else Js_exp_unknown
399315+
| (_, Identifier(_,{name = "undefined"})) -> Js_literal {comment =None}
399316+
| (_,Object _) ->
399317+
if is_obj_literal prog then Js_literal {comment = None} else Js_exp_unknown
399317399318
| _ ->
399318399319
Js_exp_unknown
399319399320
| exception _ ->
399320399321
Js_exp_unknown
399321399322

399323+
let classify (prog : string) : Js_raw_info.exp =
399324+
let prog, errors =
399325+
Parser_flow.parse_expression
399326+
(Parser_env.init_env None prog) false in
399327+
if errors <> [] then
399328+
assert false (* in the calling API, we already asked flow to raise*)
399329+
else classify_exp prog
399330+
399331+
399322399332
let classify_stmt (prog : string) : Js_raw_info.stmt =
399323399333
let result = Parser_flow.parse_program false None prog in
399324399334
match fst result with

0 commit comments

Comments
 (0)