Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

Commit 2f287ff

Browse files
committed
Parse <Foo.bar /> elements
1 parent d153447 commit 2f287ff

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

src/res_core.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ let verifyJsxOpeningClosingName p nameExpr =
618618
let closing = match p.Parser.token with
619619
| Lident lident -> Parser.next p; Longident.Lident lident
620620
| Uident _ ->
621-
(parseModuleLongIdent ~lowercase:false p).txt
621+
(parseModuleLongIdent ~lowercase:true p).txt
622622
| _ -> Longident.Lident ""
623623
in
624624
match nameExpr.Parsetree.pexp_desc with
@@ -2422,7 +2422,7 @@ and parseJsxName p =
24222422
let loc = mkLoc identStart identEnd in
24232423
Location.mkloc (Longident.Lident ident) loc
24242424
| Uident _ ->
2425-
let longident = parseModuleLongIdent ~lowercase:false p in
2425+
let longident = parseModuleLongIdent ~lowercase:true p in
24262426
Location.mkloc (Longident.Ldot (longident.txt, "createElement")) longident.loc
24272427
| _ ->
24282428
let msg = "A jsx name should start with a lowercase or uppercase identifier, like: div in <div /> or Navbar in <Navbar />"

tests/parsing/grammar/expressions/__snapshots__/parse.spec.js.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,7 @@ let _ =
542542
[@JSX ])
543543
let _ = ((Navbar.createElement ~children:[] ())[@JSX ])
544544
let _ = ((Nav.Navbar.createElement ~children:[] ())[@JSX ])
545+
let _ = ((Nav.navbar.createElement ~children:[] ())[@JSX ])
545546
let _ = ((el ~punned:((punned)[@ns.namedArgLoc ]) ~children:[] ())[@JSX ])
546547
let _ = ((el ?punned:((punned)[@ns.namedArgLoc ]) ~children:[] ())[@JSX ])
547548
let _ = ((el ~punned:((punned)[@ns.namedArgLoc ]) ~children:[] ())[@JSX ])

tests/parsing/grammar/expressions/jsx.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ let _ = <div className="menu" onClick={_ => Js.log("click")}></div>
2020

2121
let _ = <Navbar> </Navbar>
2222
let _ = <Nav.Navbar> </Nav.Navbar>
23+
let _ = <Nav.navbar> </Nav.navbar>
2324

2425
// punning
2526
let _ = <el punned> </el>

0 commit comments

Comments
 (0)