Skip to content

Commit 9cc7e65

Browse files
authored
Pull latest parser and compiler helper files (#998)
* wip pull latest parser and compiler helper files * comment out * changelog
1 parent 1e66e7f commit 9cc7e65

File tree

135 files changed

+9841
-9288
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

135 files changed

+9841
-9288
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@
4242
- Add code action for expanding catch-all patterns. https://github.com/rescript-lang/rescript-vscode/pull/987
4343
- Add code actions for removing unused code (per item and for an entire file), driven by `reanalyze`. https://github.com/rescript-lang/rescript-vscode/pull/989
4444

45+
#### :house: Internal
46+
47+
- Update parser and compiler support files to the latest version. https://github.com/rescript-lang/rescript-vscode/pull/998
48+
4549
## 1.50.0
4650

4751
#### :rocket: New Feature

analysis/src/Codemod.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ let transform ~path ~pos ~debug ~typ ~hint =
1111
| AddMissingCases -> (
1212
let source = "let " ^ hint ^ " = ()" in
1313
let {Res_driver.parsetree = hintStructure} =
14-
Res_driver.parseImplementationFromSource ~forPrinter:false
15-
~displayFilename:"<none>" ~source
14+
Res_driver.parse_implementation_from_source ~for_printer:false
15+
~display_filename:"<none>" ~source
1616
in
1717
match hintStructure with
1818
| [{pstr_desc = Pstr_value (_, [{pvb_pat = pattern}])}] -> (

analysis/src/Commands.ml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -278,20 +278,20 @@ let rename ~path ~pos ~newName ~debug =
278278
let format ~path =
279279
if Filename.check_suffix path ".res" then
280280
let {Res_driver.parsetree = structure; comments; diagnostics} =
281-
Res_driver.parsingEngine.parseImplementation ~forPrinter:true
281+
Res_driver.parsing_engine.parse_implementation ~for_printer:true
282282
~filename:path
283283
in
284284
if List.length diagnostics > 0 then ""
285285
else
286-
Res_printer.printImplementation ~width:!Res_cli.ResClflags.width ~comments
287-
structure
286+
Res_printer.print_implementation ~width:!Res_cli.ResClflags.width
287+
~comments structure
288288
else if Filename.check_suffix path ".resi" then
289289
let {Res_driver.parsetree = signature; comments; diagnostics} =
290-
Res_driver.parsingEngine.parseInterface ~forPrinter:true ~filename:path
290+
Res_driver.parsing_engine.parse_interface ~for_printer:true ~filename:path
291291
in
292292
if List.length diagnostics > 0 then ""
293293
else
294-
Res_printer.printInterface ~width:!Res_cli.ResClflags.width ~comments
294+
Res_printer.print_interface ~width:!Res_cli.ResClflags.width ~comments
295295
signature
296296
else ""
297297

analysis/src/CompletionFrontEnd.ml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ let findArgCompletables ~(args : arg list) ~endPos ~posBeforeCursor
7777
if CursorPosition.locIsEmpty exp.pexp_loc ~pos:posBeforeCursor then
7878
someArgHadEmptyExprLoc := true;
7979

80-
if Res_parsetree_viewer.isTemplateLiteral exp then None
80+
if Res_parsetree_viewer.is_template_literal exp then None
8181
else if exp.pexp_loc |> Loc.hasPos ~pos:posBeforeCursor then (
8282
if Debug.verbose () then
8383
print_endline
@@ -281,7 +281,7 @@ let rec exprToContextPathInner (e : Parsetree.expression) =
281281

282282
and exprToContextPath (e : Parsetree.expression) =
283283
match
284-
( Res_parsetree_viewer.hasAwaitAttribute e.pexp_attributes,
284+
( Res_parsetree_viewer.has_await_attribute e.pexp_attributes,
285285
exprToContextPathInner e )
286286
with
287287
| true, Some ctxPath -> Some (CPAwait ctxPath)
@@ -1072,7 +1072,7 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor
10721072
completionContext =
10731073
(if
10741074
isLikelyModulePath
1075-
&& expr |> Res_parsetree_viewer.isBracedExpr
1075+
&& expr |> Res_parsetree_viewer.is_braced_expr
10761076
then ValueOrField
10771077
else Value);
10781078
}))
@@ -1143,7 +1143,7 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor
11431143
| Some contextPath -> setResult (Cpath (CPField (contextPath, "")))
11441144
| None -> ())
11451145
| Pexp_apply ({pexp_desc = Pexp_ident compName}, args)
1146-
when Res_parsetree_viewer.isJsxExpression expr ->
1146+
when Res_parsetree_viewer.is_jsx_expression expr ->
11471147
inJsxContext := true;
11481148
let jsxProps = CompletionJsx.extractJsxProps ~compName ~args in
11491149
let compNamePath = flattenLidCheckDot ~jsx:true compName in
@@ -1500,7 +1500,7 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor
15001500

15011501
if Filename.check_suffix path ".res" then (
15021502
let parser =
1503-
Res_driver.parsingEngine.parseImplementation ~forPrinter:false
1503+
Res_driver.parsing_engine.parse_implementation ~for_printer:false
15041504
in
15051505
let {Res_driver.parsetree = str} = parser ~filename:currentFile in
15061506
iterator.structure iterator str |> ignore;
@@ -1512,7 +1512,7 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor
15121512
if !found = false then if debug then Printf.printf "XXX Not found!\n";
15131513
!result)
15141514
else if Filename.check_suffix path ".resi" then (
1515-
let parser = Res_driver.parsingEngine.parseInterface ~forPrinter:false in
1515+
let parser = Res_driver.parsing_engine.parse_interface ~for_printer:false in
15161516
let {Res_driver.parsetree = signature} = parser ~filename:currentFile in
15171517
iterator.signature iterator signature |> ignore;
15181518
if blankAfterCursor = Some ' ' || blankAfterCursor = Some '\n' then (

analysis/src/CreateInterface.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ let printSignature ~extractor ~signature =
147147

148148
Printtyp.reset_names ();
149149
let sigItemToString (item : Outcometree.out_sig_item) =
150-
item |> Res_outcome_printer.printOutSigItemDoc
151-
|> Res_doc.toString ~width:!Res_cli.ResClflags.width
150+
item |> Res_outcome_printer.print_out_sig_item_doc
151+
|> Res_doc.to_string ~width:!Res_cli.ResClflags.width
152152
in
153153

154154
let genSigStrForInlineAttr lines attributes id vd =

analysis/src/Diagnostics.ml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ let document_syntax ~path =
33
diagnostics
44
|> List.map (fun diagnostic ->
55
let _, startline, startcol =
6-
Location.get_pos_info (Res_diagnostics.getStartPos diagnostic)
6+
Location.get_pos_info (Res_diagnostics.get_start_pos diagnostic)
77
in
88
let _, endline, endcol =
9-
Location.get_pos_info (Res_diagnostics.getEndPos diagnostic)
9+
Location.get_pos_info (Res_diagnostics.get_end_pos diagnostic)
1010
in
1111
Protocol.stringifyDiagnostic
1212
{
@@ -21,13 +21,14 @@ let document_syntax ~path =
2121
in
2222
if FindFiles.isImplementation path then
2323
let parseImplementation =
24-
Res_driver.parsingEngine.parseImplementation ~forPrinter:false
24+
Res_driver.parsing_engine.parse_implementation ~for_printer:false
2525
~filename:path
2626
in
2727
get_diagnostics parseImplementation.diagnostics
2828
else if FindFiles.isInterface path then
2929
let parseInterface =
30-
Res_driver.parsingEngine.parseInterface ~forPrinter:false ~filename:path
30+
Res_driver.parsing_engine.parse_interface ~for_printer:false
31+
~filename:path
3132
in
3233
get_diagnostics parseInterface.diagnostics
3334
else []

analysis/src/DocumentSymbol.ml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -135,15 +135,17 @@ let command ~path =
135135
in
136136

137137
(if Filename.check_suffix path ".res" then
138-
let parser =
139-
Res_driver.parsingEngine.parseImplementation ~forPrinter:false
140-
in
141-
let {Res_driver.parsetree = structure} = parser ~filename:path in
142-
iterator.structure iterator structure |> ignore
143-
else
144-
let parser = Res_driver.parsingEngine.parseInterface ~forPrinter:false in
145-
let {Res_driver.parsetree = signature} = parser ~filename:path in
146-
iterator.signature iterator signature |> ignore);
138+
let parser =
139+
Res_driver.parsing_engine.parse_implementation ~for_printer:false
140+
in
141+
let {Res_driver.parsetree = structure} = parser ~filename:path in
142+
iterator.structure iterator structure |> ignore
143+
else
144+
let parser =
145+
Res_driver.parsing_engine.parse_interface ~for_printer:false
146+
in
147+
let {Res_driver.parsetree = signature} = parser ~filename:path in
148+
iterator.signature iterator signature |> ignore);
147149
let isInside
148150
({
149151
range =

analysis/src/DumpAst.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ let printStructItem structItem ~pos ~source =
313313

314314
let dump ~currentFile ~pos =
315315
let {Res_driver.parsetree = structure; source} =
316-
Res_driver.parsingEngine.parseImplementation ~forPrinter:true
316+
Res_driver.parsing_engine.parse_implementation ~for_printer:true
317317
~filename:currentFile
318318
in
319319

analysis/src/Hint.ml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ let locItemToTypeHint ~full:{file; package} locItem =
1515
| Const_float _ -> "float"
1616
| Const_int32 _ -> "int32"
1717
| Const_int64 _ -> "int64"
18-
| Const_nativeint _ -> "int")
18+
| Const_bigint _ -> "bigint")
1919
| Typed (_, t, locKind) ->
2020
let fromType typ =
2121
typ |> Shared.typeToString
@@ -71,11 +71,11 @@ let inlay ~path ~pos ~maxLength ~debug =
7171
in
7272
let iterator = {Ast_iterator.default_iterator with value_binding} in
7373
(if Files.classifySourceFile path = Res then
74-
let parser =
75-
Res_driver.parsingEngine.parseImplementation ~forPrinter:false
76-
in
77-
let {Res_driver.parsetree = structure} = parser ~filename:path in
78-
iterator.structure iterator structure |> ignore);
74+
let parser =
75+
Res_driver.parsing_engine.parse_implementation ~for_printer:false
76+
in
77+
let {Res_driver.parsetree = structure} = parser ~filename:path in
78+
iterator.structure iterator structure |> ignore);
7979
match Cmt.loadFullCmtFromPath ~path with
8080
| None -> None
8181
| Some full ->
@@ -135,11 +135,11 @@ let codeLens ~path ~debug =
135135
(* We only print code lenses in implementation files. This is because they'd be redundant in interface files,
136136
where the definition itself will be the same thing as what would've been printed in the code lens. *)
137137
(if Files.classifySourceFile path = Res then
138-
let parser =
139-
Res_driver.parsingEngine.parseImplementation ~forPrinter:false
140-
in
141-
let {Res_driver.parsetree = structure} = parser ~filename:path in
142-
iterator.structure iterator structure |> ignore);
138+
let parser =
139+
Res_driver.parsing_engine.parse_implementation ~for_printer:false
140+
in
141+
let {Res_driver.parsetree = structure} = parser ~filename:path in
142+
iterator.structure iterator structure |> ignore);
143143
match Cmt.loadFullCmtFromPath ~path with
144144
| None -> None
145145
| Some full ->

analysis/src/Hover.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ let newHover ~full:{file; package} ~supportsMarkdownLinks locItem =
227227
| Const_float _ -> "float"
228228
| Const_int32 _ -> "int32"
229229
| Const_int64 _ -> "int64"
230-
| Const_nativeint _ -> "int"))
230+
| Const_bigint _ -> "bigint"))
231231
| Typed (_, t, locKind) ->
232232
let fromType ~docstring typ =
233233
( hoverWithExpandedTypes ~file ~package ~supportsMarkdownLinks typ,

0 commit comments

Comments
 (0)