Skip to content

Adapt @as ppx to new string literals. #5401

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions jscomp/frontend/ast_attributes.ml
Original file line number Diff line number Diff line change
Expand Up @@ -292,15 +292,16 @@ let iter_process_bs_string_or_int_as (attrs : Parsetree.attributes) =
pexp_desc =
Pexp_constant
(Pconst_string
(s, ((None | Some "json") as dec)));
(s, ((None | Some "json"| Some "*j") as dec)));
pexp_loc;
_;
},
_ );
_;
};
] ->
if dec = None then st := Some (Str s)
]
->
if dec = None || dec = Some "*j" then st := Some (Str s)
else (
(match
Classify_function.classify
Expand All @@ -313,7 +314,7 @@ let iter_process_bs_string_or_int_as (attrs : Parsetree.attributes) =
Location.raise_errorf ~loc:pexp_loc
"an object literal expected");
st := Some (Js_literal_str s))
| _ -> Bs_syntaxerr.err loc Expect_int_or_string_or_json_literal
| _ -> Bs_syntaxerr.err loc (Expect_int_or_string_or_json_literal)
)
| Some v -> st := Some (Int v))
else Bs_syntaxerr.err loc Duplicated_bs_as
Expand Down
9 changes: 5 additions & 4 deletions lib/4.06.1/unstable/js_compiler.ml
Original file line number Diff line number Diff line change
Expand Up @@ -254524,15 +254524,16 @@ let iter_process_bs_string_or_int_as (attrs : Parsetree.attributes) =
pexp_desc =
Pexp_constant
(Pconst_string
(s, ((None | Some "json") as dec)));
(s, ((None | Some "json"| Some "*j") as dec)));
pexp_loc;
_;
},
_ );
_;
};
] ->
if dec = None then st := Some (Str s)
]
->
if dec = None || dec = Some "*j" then st := Some (Str s)
else (
(match
Classify_function.classify
Expand All @@ -254545,7 +254546,7 @@ let iter_process_bs_string_or_int_as (attrs : Parsetree.attributes) =
Location.raise_errorf ~loc:pexp_loc
"an object literal expected");
st := Some (Js_literal_str s))
| _ -> Bs_syntaxerr.err loc Expect_int_or_string_or_json_literal
| _ -> Bs_syntaxerr.err loc (Expect_int_or_string_or_json_literal)
)
| Some v -> st := Some (Int v))
else Bs_syntaxerr.err loc Duplicated_bs_as
Expand Down
9 changes: 5 additions & 4 deletions lib/4.06.1/whole_compiler.ml
Original file line number Diff line number Diff line change
Expand Up @@ -258595,15 +258595,16 @@ let iter_process_bs_string_or_int_as (attrs : Parsetree.attributes) =
pexp_desc =
Pexp_constant
(Pconst_string
(s, ((None | Some "json") as dec)));
(s, ((None | Some "json"| Some "*j") as dec)));
pexp_loc;
_;
},
_ );
_;
};
] ->
if dec = None then st := Some (Str s)
]
->
if dec = None || dec = Some "*j" then st := Some (Str s)
else (
(match
Classify_function.classify
Expand All @@ -258616,7 +258617,7 @@ let iter_process_bs_string_or_int_as (attrs : Parsetree.attributes) =
Location.raise_errorf ~loc:pexp_loc
"an object literal expected");
st := Some (Js_literal_str s))
| _ -> Bs_syntaxerr.err loc Expect_int_or_string_or_json_literal
| _ -> Bs_syntaxerr.err loc (Expect_int_or_string_or_json_literal)
)
| Some v -> st := Some (Int v))
else Bs_syntaxerr.err loc Duplicated_bs_as
Expand Down