Skip to content

Commit e3ac007

Browse files
committed
add res.syntaxSugar attr
1 parent 062c387 commit e3ac007

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

jscomp/syntax/src/res_core.ml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2005,6 +2005,7 @@ and parseBracketAccess p expr startPos =
20052005
Parser.eatBreadcrumb p;
20062006
let rbracket = p.prevEndPos in
20072007
let arrayLoc = mkLoc lbracket rbracket in
2008+
let attr = Location.mkloc "res.syntaxSugar" arrayLoc, Parsetree.PStr [] in
20082009
match p.token with
20092010
| Equal ->
20102011
Parser.leaveBreadcrumb p ExprArrayMutation;
@@ -2015,7 +2016,7 @@ and parseBracketAccess p expr startPos =
20152016
in
20162017
let endPos = p.prevEndPos in
20172018
let arraySet =
2018-
Ast_helper.Exp.apply ~loc:(mkLoc startPos endPos)
2019+
Ast_helper.Exp.apply ~loc:(mkLoc startPos endPos) ~attrs:[attr]
20192020
(Ast_helper.Exp.ident ~loc:arrayLoc arraySet)
20202021
[(Nolabel, expr); (Nolabel, accessExpr); (Nolabel, rhsExpr)]
20212022
in
@@ -2025,7 +2026,7 @@ and parseBracketAccess p expr startPos =
20252026
let endPos = p.prevEndPos in
20262027
let e =
20272028
Ast_helper.Exp.apply ~loc:(mkLoc startPos endPos)
2028-
(Ast_helper.Exp.ident ~loc:arrayLoc
2029+
(Ast_helper.Exp.ident ~loc:arrayLoc ~attrs:[attr]
20292030
(Location.mkloc (Longident.Ldot (Lident "Array", "get")) arrayLoc))
20302031
[(Nolabel, expr); (Nolabel, accessExpr)]
20312032
in

0 commit comments

Comments
 (0)