Skip to content

Commit 9f5d788

Browse files
committed
@bs.as -> @as
1 parent 386ed69 commit 9f5d788

20 files changed

+66
-66
lines changed

jscomp/core/record_attributes_check.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ let find_name = Lambda.find_name
2929
let find_name_with_loc (attr : Parsetree.attribute) : string Asttypes.loc option
3030
=
3131
match attr with
32-
| ( { txt = "bs.as" | "as"; loc },
32+
| ( { txt = "as"; loc },
3333
PStr
3434
[
3535
{

jscomp/frontend/ast_attributes.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ let iter_process_bs_string_as (attrs : t) : string option =
235235
let st = ref None in
236236
Ext_list.iter attrs (fun (({txt; loc}, payload) as attr) ->
237237
match txt with
238-
| "bs.as" | "as" ->
238+
| "as" ->
239239
if !st = None then (
240240
match Ast_payload.is_single_string payload with
241241
| None -> Bs_syntaxerr.err loc Expect_string_literal
@@ -257,7 +257,7 @@ let iter_process_bs_int_as (attrs : t) =
257257
let st = ref None in
258258
Ext_list.iter attrs (fun (({txt; loc}, payload) as attr) ->
259259
match txt with
260-
| "bs.as" | "as" ->
260+
| "as" ->
261261
if !st = None then (
262262
match Ast_payload.is_single_int payload with
263263
| None -> Bs_syntaxerr.err loc Expect_int_literal
@@ -274,7 +274,7 @@ let iter_process_bs_string_or_int_as (attrs : Parsetree.attributes) =
274274
let st = ref None in
275275
Ext_list.iter attrs (fun (({txt; loc}, payload) as attr) ->
276276
match txt with
277-
| "bs.as" | "as" ->
277+
| "as" ->
278278
if !st = None then (
279279
Bs_ast_invariant.mark_used_bs_attribute attr;
280280
match Ast_payload.is_single_int payload with

jscomp/frontend/ast_polyvar.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
val map_row_fields_into_ints :
2626
Location.t -> Parsetree.row_field list -> (string * int) list
27-
(** side effect: it will mark used attributes `bs.as` *)
27+
(** side effect: it will mark used attributes `as` *)
2828

2929
val map_constructor_declarations_into_ints :
3030
Parsetree.constructor_declaration list -> [`Offset of int | `New of int list]

jscomp/frontend/bs_ast_invariant.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ let emit_external_warnings : iterator =
129129
(fun self lbl ->
130130
Ext_list.iter lbl.pld_attributes (fun attr ->
131131
match attr with
132-
| {txt = "bs.as" | "as"}, _ -> mark_used_bs_attribute attr
132+
| {txt = "as"}, _ -> mark_used_bs_attribute attr
133133
| _ -> ());
134134
super.label_declaration self lbl);
135135
constructor_declaration =

jscomp/gentype/Annotation.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ let toString annotation =
1919

2020
let tagIsGenType s = s = "genType" || s = "gentype"
2121
let tagIsGenTypeAs s = s = "genType.as" || s = "gentype.as"
22-
let tagIsAs s = s = "bs.as" || s = "as"
22+
let tagIsAs s = s = "as"
2323
let tagIsInt s = s = "bs.int" || s = "int"
2424
let tagIsString s = s = "bs.string" || s = "string"
2525

jscomp/gentype/TranslateTypeDeclarations.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ let createCase (label, attributes) ~poly =
4040
(**
4141
* Rename record fields.
4242
* If @genType.as is used, perform renaming conversion.
43-
* If @bs.as is used (with records-as-objects active), escape and quote if
43+
* If @as is used (with records-as-objects active), escape and quote if
4444
* the identifier contains characters which are invalid as JS property names.
4545
*)
4646
let renameRecordField ~attributes ~name =

jscomp/ml/ast_untagged_variants.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ let process_tag_type (attrs : Parsetree.attributes) =
108108
let st : tag_type option ref = ref None in
109109
Ext_list.iter attrs (fun ({txt; loc}, payload) ->
110110
match txt with
111-
| "bs.as" | "as" ->
111+
| "as" ->
112112
if !st = None then (
113113
(match Ast_payload.is_single_string payload with
114114
| None -> ()

jscomp/ml/lambda.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ type label = Types.label_description
9090

9191
let find_name (attr : Parsetree.attribute) =
9292
match attr with
93-
| ( { txt = "bs.as" | "as" },
93+
| ( { txt = "as" },
9494
PStr
9595
[
9696
{

jscomp/ounit_tests/ounit_cmd_tests.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ let suites =
7272
__LOC__ >:: begin fun _ ->
7373
let should_err = bsc_check_eval {|
7474
external ff :
75-
resp -> (_ [@bs.as "x"]) -> int -> unit =
75+
resp -> (_ [@as "x"]) -> int -> unit =
7676
"x" [@@bs.set]
7777
|} in
7878
OUnit.assert_bool __LOC__
@@ -139,15 +139,15 @@ external ff :
139139
__LOC__ >:: begin fun _ ->
140140
let should_err = bsc_check_eval {|
141141
type t
142-
external mk : int -> (_ [@bs.as {json| { x : 3 } |json}]) -> t = "mk" [@@bs.val]
142+
external mk : int -> (_ [@as {json| { x : 3 } |json}]) -> t = "mk" [@@bs.val]
143143
|} in
144144
OUnit.assert_bool __LOC__ (Ext_string.is_empty should_err.stderr)
145145
end
146146
;
147147
__LOC__ >:: begin fun _ ->
148148
let should_err = bsc_check_eval {|
149149
type t
150-
external mk : int -> (_ [@bs.as {json| { "x" : 3 } |json}]) -> t = "mk" [@@bs.val]
150+
external mk : int -> (_ [@as {json| { "x" : 3 } |json}]) -> t = "mk" [@@bs.val]
151151
|} in
152152
OUnit.assert_bool __LOC__ (Ext_string.is_empty should_err.stderr)
153153
end
@@ -248,7 +248,7 @@ let rec y = A y;;
248248
__LOC__ >:: begin fun _ ->
249249
let should_err = bsc_check_eval {|
250250
external foo_bar :
251-
(_ [@bs.as "foo"]) ->
251+
(_ [@as "foo"]) ->
252252
string ->
253253
string = "bar"
254254
[@@bs.send]

jscomp/syntax/tests/idempotency/bs-webapi/src/Webapi/Webapi__Dom/Webapi__Dom__Node.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module Impl = (
2121
/* let setNodeValue : T.t => option string => unit = fun self value => setNodeValue self (Js.Null.fromOption value); */ /* temporarily removed to reduce codegen size */
2222
/* Not supported yet
2323
external setNodeValue : T.t => string => unit = "nodeValue" [@@bs.set];
24-
external clearNodeValue : T.t => _ [@bs.as {json|null|json}] => unit = "nodeValue" [@@bs.set];
24+
external clearNodeValue : T.t => _ [@as {json|null|json}] => unit = "nodeValue" [@@bs.set];
2525
*/
2626
/* outerText */
2727
@get external ownerDocument: T.t => Dom.document = ""

jscomp/syntax/tests/idempotency/genType/src/Annotation.res

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ let toString = annotation =>
2727
let tagIsGenType = s => s == "genType" || s == "gentype"
2828
let tagIsGenTypeAs = s => s == "genType.as" || s == "gentype.as"
2929

30-
let tagIsBsAs = s => s == "bs.as"
30+
let tagIsAs = s => s == "as"
3131

3232
let tagIsUnboxed = s => s == "unboxed" || s == "ocaml.unboxed"
3333

@@ -103,8 +103,8 @@ let getGenTypeAsRenaming = attributes =>
103103
| _ => None
104104
}
105105

106-
let getBsAsRenaming = attributes =>
107-
switch attributes |> getAttributePayload(tagIsBsAs) {
106+
let getAsRenaming = attributes =>
107+
switch attributes |> getAttributePayload(tagIsAs) {
108108
| Some(StringPayload(s)) => Some(s)
109109
| _ => None
110110
}

jscomp/syntax/tests/idempotency/genType/src/TranslateTypeDeclarations.res

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ let createCase = ((label, attributes)) =>
4242

4343
// Rename record fields.
4444
// If @genType.as is used, perform renaming conversion.
45-
// If @bs.as is used (with records-as-objects active), no conversion is required.
45+
// If @as is used (with records-as-objects active), no conversion is required.
4646
let renameRecordField = (~config, ~attributes, ~nameRE) =>
4747
switch attributes |> Annotation.getGenTypeAsRenaming {
4848
| Some(nameJS) => (nameJS, nameRE)
4949
| None =>
5050
if config.recordsAsObjects {
51-
switch attributes |> Annotation.getBsAsRenaming {
51+
switch attributes |> Annotation.getAsRenaming {
5252
| Some(name) => (name, name)
5353
| None => (nameRE, nameRE)
5454
}

jscomp/syntax/tests/idempotency/mareo/Dom_html.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ type canvasElement
88

99
@val external window: Dom.window = ""
1010

11-
/* external createImg: (_ [@bs.as "img"]) -> document -> imageElement = "createElement" [@@bs.send] */
11+
/* external createImg: (_ [@as "img"]) -> document -> imageElement = "createElement" [@@bs.send] */
1212
@send
1313
external createImg: (Dom.document, @as("img") _) => imageElement = "createElement"
1414

jscomp/syntax/tests/idempotency/reason-react/src/ReactDOMRe.res

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -102,26 +102,26 @@ type domProps = {
102102
/* accessibility */
103103
/* https://www.w3.org/TR/wai-aria-1.1/ */
104104
/* https://accessibilityresources.org/<aria-tag> is a great resource for these */
105-
/* [@bs.optional] [@bs.as "aria-current"] ariaCurrent: page|step|location|date|time|true|false, */
105+
/* [@bs.optional] [@as "aria-current"] ariaCurrent: page|step|location|date|time|true|false, */
106106
@optional @as("aria-details")
107107
ariaDetails: string,
108108
@optional @as("aria-disabled")
109109
ariaDisabled: bool,
110110
@optional @as("aria-hidden")
111111
ariaHidden: bool,
112-
/* [@bs.optional] [@bs.as "aria-invalid"] ariaInvalid: grammar|false|spelling|true, */
112+
/* [@bs.optional] [@as "aria-invalid"] ariaInvalid: grammar|false|spelling|true, */
113113
@optional @as("aria-keyshortcuts")
114114
ariaKeyshortcuts: string,
115115
@optional @as("aria-label")
116116
ariaLabel: string,
117117
@optional @as("aria-roledescription")
118118
ariaRoledescription: string,
119119
/* Widget Attributes */
120-
/* [@bs.optional] [@bs.as "aria-autocomplete"] ariaAutocomplete: inline|list|both|none, */
121-
/* [@bs.optional] [@bs.as "aria-checked"] ariaChecked: true|false|mixed, /* https://www.w3.org/TR/wai-aria-1.1/#valuetype_tristate */ */
120+
/* [@bs.optional] [@as "aria-autocomplete"] ariaAutocomplete: inline|list|both|none, */
121+
/* [@bs.optional] [@as "aria-checked"] ariaChecked: true|false|mixed, /* https://www.w3.org/TR/wai-aria-1.1/#valuetype_tristate */ */
122122
@optional @as("aria-expanded")
123123
ariaExpanded: bool,
124-
/* [@bs.optional] [@bs.as "aria-haspopup"] ariaHaspopup: false|true|menu|listbox|tree|grid|dialog, */
124+
/* [@bs.optional] [@as "aria-haspopup"] ariaHaspopup: false|true|menu|listbox|tree|grid|dialog, */
125125
@optional @as("aria-level")
126126
ariaLevel: int,
127127
@optional @as("aria-modal")
@@ -130,10 +130,10 @@ type domProps = {
130130
ariaMultiline: bool,
131131
@optional @as("aria-multiselectable")
132132
ariaMultiselectable: bool,
133-
/* [@bs.optional] [@bs.as "aria-orientation"] ariaOrientation: horizontal|vertical|undefined, */
133+
/* [@bs.optional] [@as "aria-orientation"] ariaOrientation: horizontal|vertical|undefined, */
134134
@optional @as("aria-placeholder")
135135
ariaPlaceholder: string,
136-
/* [@bs.optional] [@bs.as "aria-pressed"] ariaPressed: true|false|mixed, /* https://www.w3.org/TR/wai-aria-1.1/#valuetype_tristate */ */
136+
/* [@bs.optional] [@as "aria-pressed"] ariaPressed: true|false|mixed, /* https://www.w3.org/TR/wai-aria-1.1/#valuetype_tristate */ */
137137
@optional @as("aria-readonly")
138138
ariaReadonly: bool,
139139
@optional @as("aria-required")
@@ -155,11 +155,11 @@ type domProps = {
155155
ariaAtomic: bool,
156156
@optional @as("aria-busy")
157157
ariaBusy: bool,
158-
/* [@bs.optional] [@bs.as "aria-live"] ariaLive: off|polite|assertive|rude, */
158+
/* [@bs.optional] [@as "aria-live"] ariaLive: off|polite|assertive|rude, */
159159
@optional @as("aria-relevant")
160160
ariaRelevant: string,
161161
/* Drag-and-Drop Attributes */
162-
/* [@bs.optional] [@bs.as "aria-dropeffect"] ariaDropeffect: copy|move|link|execute|popup|none, */
162+
/* [@bs.optional] [@as "aria-dropeffect"] ariaDropeffect: copy|move|link|execute|popup|none, */
163163
@optional @as("aria-grabbed")
164164
ariaGrabbed: bool,
165165
/* Relationship Attributes */
@@ -1107,26 +1107,26 @@ type props = {
11071107
/* accessibility */
11081108
/* https://www.w3.org/TR/wai-aria-1.1/ */
11091109
/* https://accessibilityresources.org/<aria-tag> is a great resource for these */
1110-
/* [@bs.optional] [@bs.as "aria-current"] ariaCurrent: page|step|location|date|time|true|false, */
1110+
/* [@bs.optional] [@as "aria-current"] ariaCurrent: page|step|location|date|time|true|false, */
11111111
@optional @as("aria-details")
11121112
ariaDetails: string,
11131113
@optional @as("aria-disabled")
11141114
ariaDisabled: bool,
11151115
@optional @as("aria-hidden")
11161116
ariaHidden: bool,
1117-
/* [@bs.optional] [@bs.as "aria-invalid"] ariaInvalid: grammar|false|spelling|true, */
1117+
/* [@bs.optional] [@as "aria-invalid"] ariaInvalid: grammar|false|spelling|true, */
11181118
@optional @as("aria-keyshortcuts")
11191119
ariaKeyshortcuts: string,
11201120
@optional @as("aria-label")
11211121
ariaLabel: string,
11221122
@optional @as("aria-roledescription")
11231123
ariaRoledescription: string,
11241124
/* Widget Attributes */
1125-
/* [@bs.optional] [@bs.as "aria-autocomplete"] ariaAutocomplete: inline|list|both|none, */
1126-
/* [@bs.optional] [@bs.as "aria-checked"] ariaChecked: true|false|mixed, /* https://www.w3.org/TR/wai-aria-1.1/#valuetype_tristate */ */
1125+
/* [@bs.optional] [@as "aria-autocomplete"] ariaAutocomplete: inline|list|both|none, */
1126+
/* [@bs.optional] [@as "aria-checked"] ariaChecked: true|false|mixed, /* https://www.w3.org/TR/wai-aria-1.1/#valuetype_tristate */ */
11271127
@optional @as("aria-expanded")
11281128
ariaExpanded: bool,
1129-
/* [@bs.optional] [@bs.as "aria-haspopup"] ariaHaspopup: false|true|menu|listbox|tree|grid|dialog, */
1129+
/* [@bs.optional] [@as "aria-haspopup"] ariaHaspopup: false|true|menu|listbox|tree|grid|dialog, */
11301130
@optional @as("aria-level")
11311131
ariaLevel: int,
11321132
@optional @as("aria-modal")
@@ -1135,10 +1135,10 @@ type props = {
11351135
ariaMultiline: bool,
11361136
@optional @as("aria-multiselectable")
11371137
ariaMultiselectable: bool,
1138-
/* [@bs.optional] [@bs.as "aria-orientation"] ariaOrientation: horizontal|vertical|undefined, */
1138+
/* [@bs.optional] [@as "aria-orientation"] ariaOrientation: horizontal|vertical|undefined, */
11391139
@optional @as("aria-placeholder")
11401140
ariaPlaceholder: string,
1141-
/* [@bs.optional] [@bs.as "aria-pressed"] ariaPressed: true|false|mixed, /* https://www.w3.org/TR/wai-aria-1.1/#valuetype_tristate */ */
1141+
/* [@bs.optional] [@as "aria-pressed"] ariaPressed: true|false|mixed, /* https://www.w3.org/TR/wai-aria-1.1/#valuetype_tristate */ */
11421142
@optional @as("aria-readonly")
11431143
ariaReadonly: bool,
11441144
@optional @as("aria-required")
@@ -1160,11 +1160,11 @@ type props = {
11601160
ariaAtomic: bool,
11611161
@optional @as("aria-busy")
11621162
ariaBusy: bool,
1163-
/* [@bs.optional] [@bs.as "aria-live"] ariaLive: off|polite|assertive|rude, */
1163+
/* [@bs.optional] [@as "aria-live"] ariaLive: off|polite|assertive|rude, */
11641164
@optional @as("aria-relevant")
11651165
ariaRelevant: string,
11661166
/* Drag-and-Drop Attributes */
1167-
/* [@bs.optional] [@bs.as "aria-dropeffect"] ariaDropeffect: copy|move|link|execute|popup|none, */
1167+
/* [@bs.optional] [@as "aria-dropeffect"] ariaDropeffect: copy|move|link|execute|popup|none, */
11681168
@optional @as("aria-grabbed")
11691169
ariaGrabbed: bool,
11701170
/* Relationship Attributes */

jscomp/test/ast_abstract_test.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ let idb v =
6666
let () = idb D0; idb D1; idb D2 ; idb D3 */
6767

6868
/* type c =
69-
| D0 [@bs.as 3]
69+
| D0 [@as 3]
7070
| D1
7171
| D2
7272
| D3

jscomp/test/gpr_1072_reg.res

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,24 +38,24 @@ let v1 = make(
3838
3939
external make2 :
4040
?localeMatcher:
41-
([`lookup | `best_fit [@bs.as \"best fit\"]] [@bs.string]) ->
41+
([`lookup | `best_fit [@as \"best fit\"]] [@bs.string]) ->
4242
4343
?timeZone:string ->
4444
?hour12:bool ->
4545
?formatMatcher:
46-
([`basic | `best_fit [@bs.as \"best fit\"]] [@bs.string]) ->
46+
([`basic | `best_fit [@as \"best fit\"]] [@bs.string]) ->
4747
4848
?weekday:([`narrow | `short | `long] [@bs.string]) ->
4949
?era:([`narrow | `short | `long] [@bs.string]) ->
50-
?year:([`numeric | `two_digit [@bs.as \"2-digit\"]] [@bs.string]) ->
50+
?year:([`numeric | `two_digit [@as \"2-digit\"]] [@bs.string]) ->
5151
?month:
5252
([`narrow |
5353
`short |
5454
`long |
5555
`numeric |
56-
`two_digit [@bs.as \"2-digit\"]] [@bs.string]) ->
56+
`two_digit [@as \"2-digit\"]] [@bs.string]) ->
5757
58-
?day:(([`numeric | `two_digit [@bs.as \"2-digit\"]] [@bs.string]) as 'num) ->
58+
?day:(([`numeric | `two_digit [@as \"2-digit\"]] [@bs.string]) as 'num) ->
5959
?hour:('num) ->
6060
?minute:('num) ->
6161
?second:('num) ->

jscomp/test/gpr_1484.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ type t
33

44
/* TODO: more test cases */
55
/* external clearNodeValue2 : */
6-
/* t -> (_ [@bs.as {json|null|json}]) -> int -> unit = */
6+
/* t -> (_ [@as {json|null|json}]) -> int -> unit = */
77
/* "nodeValue" [@@bs.set] */
88

99
let test = x => clearNodeValue(x)

jscomp/test/mario_game.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ module Dom_html = {
151151
@val external document: Dom.document = "document"
152152
@val external window: Dom.window = "window"
153153

154-
/* external createImg: (_ [@bs.as "img"]) -> document -> imageElement = "createElement" [@@bs.send] */
154+
/* external createImg: (_ [@as "img"]) -> document -> imageElement = "createElement" [@@bs.send] */
155155
@send external createImg: (Dom.document, @as("img") _) => imageElement = "createElement"
156156
@val external requestAnimationFrame: (float => unit) => unit = "requestAnimationFrame"
157157
@return(null_to_opt) @send

jscomp/test/poly_variant_test.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ type u = [
3232
| #on_closed
3333
| #on_open
3434
| #in_
35-
/* [@bs.as "in"] TODO: warning test */
35+
/* [@as "in"] TODO: warning test */
3636
]
3737
/* indeed we have a warning here */
3838
/* TODO: add warning test

0 commit comments

Comments
 (0)