Skip to content

Commit 3ec7509

Browse files
committed
Add example in analysis/examples
1 parent 19ba177 commit 3ec7509

File tree

254 files changed

+6016
-83055
lines changed

Some content is hidden

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

254 files changed

+6016
-83055
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/node_modules
2+
/lib
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
####{BSB GENERATED: NO EDIT
2+
FLG -ppx '/Users/cristianocalcagno/GitHub/rescript-vscode/analysis/reanalyze/examples/deadcode/node_modules/rescript/darwin/bsc.exe -as-ppx -bs-jsx 3'
3+
S /Users/cristianocalcagno/GitHub/rescript-vscode/analysis/reanalyze/examples/deadcode/node_modules/rescript/lib/ocaml
4+
B /Users/cristianocalcagno/GitHub/rescript-vscode/analysis/reanalyze/examples/deadcode/node_modules/rescript/lib/ocaml
5+
FLG -w +a-4-9-20-40-41-42-50-61-102
6+
S /Users/cristianocalcagno/GitHub/rescript-vscode/analysis/reanalyze/examples/deadcode/node_modules/@rescript/react/lib/ocaml
7+
B /Users/cristianocalcagno/GitHub/rescript-vscode/analysis/reanalyze/examples/deadcode/node_modules/@rescript/react/lib/ocaml
8+
S /Users/cristianocalcagno/GitHub/rescript-vscode/analysis/reanalyze/examples/deadcode/node_modules/@glennsl/bs-json/lib/ocaml
9+
B /Users/cristianocalcagno/GitHub/rescript-vscode/analysis/reanalyze/examples/deadcode/node_modules/@glennsl/bs-json/lib/ocaml
10+
S src
11+
B lib/bs/src
12+
S src/exception
13+
B lib/bs/src/exception
14+
####BSB GENERATED: NO EDIT}

analysis/examples/larger-project/.watchmanconfig

Whitespace-only changes.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"reanalyze": {
3+
"analysis": ["dce"],
4+
"suppress": [],
5+
"unsuppress": []
6+
},
7+
"name": "sample-typescript-app",
8+
"bsc-flags": ["-bs-super-errors -w a"],
9+
"reason": { "react-jsx": 3 },
10+
"bs-dependencies": ["@rescript/react", "@glennsl/bs-json"],
11+
"sources": [
12+
{
13+
"dir": "src",
14+
"subdirs": true
15+
}
16+
],
17+
"package-specs": {
18+
"module": "es6",
19+
"in-source": true
20+
},
21+
"suffix": ".bs.js"
22+
}

analysis/examples/larger-project/package-lock.json

Lines changed: 192 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "large-project",
3+
"version": "0.1.0",
4+
"private": true,
5+
"devDependencies": {
6+
"react": "^16.13.1",
7+
"react-dom": "^16.8.6",
8+
"rescript": "^9.1.4"
9+
},
10+
"dependencies": {
11+
"@glennsl/bs-json": "^5.0.4",
12+
"@rescript/react": "^0.10.3"
13+
}
14+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
type variant = R(int)
2+
3+
@genType
4+
type record = {variant: variant}
5+
6+
type r2 = {r2: int}
7+
8+
type r3 = {r3: int}
9+
10+
type r4 = {r4: int}
11+
12+
@genType
13+
type annotatedVariant =
14+
| R2(r2, r3)
15+
| R4(r4)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/* NOTE: This is a spooky interface that provides no type safety. It should be
2+
* improved. Use with caution. */
3+
@module("BootloaderResource")
4+
external read: JSResource.t<'a> => 'a = "read"
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
@genType
2+
type someMutableFields = {
3+
@set
4+
"mutable0": string,
5+
"immutable": int,
6+
@set
7+
"mutable1": string,
8+
@set
9+
"mutable2": string,
10+
}
11+
12+
@genType
13+
type someMethods = {
14+
@meth
15+
"send": string => unit,
16+
@meth
17+
"on": (string, (. int) => unit) => unit,
18+
@meth
19+
"threeargs": (int, string, int) => string,
20+
"twoArgs": (. int, string) => int,
21+
}
22+
23+
// let foo = (x: someMethods) => x["threeargs"](3, "a", 4)
24+
25+
let bar = (x: someMethods) => {
26+
let f = x["twoArgs"]
27+
f(. 3, "a")
28+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
@ocaml.doc(
2+
" This is like declaring a normal ReasonReact component's `make` function, except the body is a the interop hook wrapJsForReason "
3+
)
4+
@genType
5+
@react.component
6+
let make = (~title, ~description, ~button=?) => {
7+
<div>
8+
<div>
9+
title
10+
description
11+
{switch button {
12+
| Some(button) => button
13+
| None => React.null
14+
}}
15+
</div>
16+
</div>
17+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module Error1 = {
2+
type t = string
3+
let notification = s => (s, s)
4+
}
5+
6+
module MyErrorHandler = ErrorHandler.Make(Error1)
7+
8+
MyErrorHandler.notify("abc")
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module Error2 = {
2+
type t = int
3+
let notification = n => (string_of_int(n), "")
4+
}
5+
6+
module MyErrorHandler = ErrorHandler.Make(Error2) /* MyErrorHandler.notify(42) */
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module M: DeadCodeInterface.T = {
2+
let x = 42
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module type T = {
2+
let x: int
3+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
exception Etoplevel
2+
3+
module Inside = {
4+
exception Einside
5+
}
6+
7+
exception DeadE
8+
let eToplevel = Etoplevel
9+
10+
let eInside = Inside.Einside
11+
12+
Js.log(eInside)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// empty
2+
exception Etoplevel
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
type moduleAccessPath =
2+
| Root(string)
3+
| Kaboom
4+
5+
let rec emitModuleAccessPath = moduleAccessPath =>
6+
switch moduleAccessPath {
7+
| Root(s) => s
8+
| Kaboom => ""
9+
}
10+
11+
let () = Js.log(Kaboom)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
type moduleAccessPath =
2+
| Root(string)
3+
| Kaboom

analysis/examples/larger-project/src/DeadTest.res

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
let x = 34
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module Ext_buffer: {
2+
let x: int
3+
} = {
4+
let x = 42
5+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

0 commit comments

Comments
 (0)