Skip to content

Commit bdc2a60

Browse files
committed
update
1 parent debb946 commit bdc2a60

10 files changed

+160
-21
lines changed

lib/es6/Primitive_lazy.js

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
2+
3+
import * as Primitive_exceptions from "./Primitive_exceptions.js";
4+
5+
function is_val(l) {
6+
return l.LAZY_DONE;
7+
}
8+
9+
let Undefined = /* @__PURE__ */Primitive_exceptions.create("Primitive_lazy.Undefined");
10+
11+
function forward_with_closure(blk, closure) {
12+
let result = closure();
13+
blk.VAL = result;
14+
blk.LAZY_DONE = true;
15+
return result;
16+
}
17+
18+
function raise_undefined() {
19+
throw {
20+
RE_EXN_ID: Undefined,
21+
Error: new Error()
22+
};
23+
}
24+
25+
function force(lzv) {
26+
if (lzv.LAZY_DONE) {
27+
return lzv.VAL;
28+
} else {
29+
let closure = lzv.VAL;
30+
lzv.VAL = raise_undefined;
31+
try {
32+
return forward_with_closure(lzv, closure);
33+
} catch (e) {
34+
lzv.VAL = () => {
35+
throw e;
36+
};
37+
throw e;
38+
}
39+
}
40+
}
41+
42+
function force_val(lzv) {
43+
if (lzv.LAZY_DONE) {
44+
return lzv.VAL;
45+
} else {
46+
let closure = lzv.VAL;
47+
lzv.VAL = raise_undefined;
48+
return forward_with_closure(lzv, closure);
49+
}
50+
}
51+
52+
function from_fun(closure) {
53+
return {
54+
LAZY_DONE: false,
55+
VAL: closure
56+
};
57+
}
58+
59+
function from_val(value) {
60+
return {
61+
LAZY_DONE: true,
62+
VAL: value
63+
};
64+
}
65+
66+
export {
67+
Undefined,
68+
force,
69+
force_val,
70+
from_fun,
71+
from_val,
72+
is_val,
73+
}
74+
/* No side effect */

lib/js/Primitive_lazy.js

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
'use strict';
2+
3+
let Primitive_exceptions = require("./Primitive_exceptions.js");
4+
5+
function is_val(l) {
6+
return l.LAZY_DONE;
7+
}
8+
9+
let Undefined = /* @__PURE__ */Primitive_exceptions.create("Primitive_lazy.Undefined");
10+
11+
function forward_with_closure(blk, closure) {
12+
let result = closure();
13+
blk.VAL = result;
14+
blk.LAZY_DONE = true;
15+
return result;
16+
}
17+
18+
function raise_undefined() {
19+
throw {
20+
RE_EXN_ID: Undefined,
21+
Error: new Error()
22+
};
23+
}
24+
25+
function force(lzv) {
26+
if (lzv.LAZY_DONE) {
27+
return lzv.VAL;
28+
} else {
29+
let closure = lzv.VAL;
30+
lzv.VAL = raise_undefined;
31+
try {
32+
return forward_with_closure(lzv, closure);
33+
} catch (e) {
34+
lzv.VAL = () => {
35+
throw e;
36+
};
37+
throw e;
38+
}
39+
}
40+
}
41+
42+
function force_val(lzv) {
43+
if (lzv.LAZY_DONE) {
44+
return lzv.VAL;
45+
} else {
46+
let closure = lzv.VAL;
47+
lzv.VAL = raise_undefined;
48+
return forward_with_closure(lzv, closure);
49+
}
50+
}
51+
52+
function from_fun(closure) {
53+
return {
54+
LAZY_DONE: false,
55+
VAL: closure
56+
};
57+
}
58+
59+
function from_val(value) {
60+
return {
61+
LAZY_DONE: true,
62+
VAL: value
63+
};
64+
}
65+
66+
exports.Undefined = Undefined;
67+
exports.force = force;
68+
exports.force_val = force_val;
69+
exports.from_fun = from_fun;
70+
exports.from_val = from_val;
71+
exports.is_val = is_val;
72+
/* No side effect */

tests/analysis_tests/tests/src/expected/Completion.res.txt

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

tests/analysis_tests/tests/src/expected/Fragment.res.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Hover src/Fragment.res 6:19
2-
{"contents": {"kind": "markdown", "value": "```rescript\nReact.component<SectionHeader.props<Jsx.element>>\n```\n\n---\n\n```\n \n```\n```rescript\ntype React.component<'props> = Jsx.component<'props>\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22React.res%22%2C12%2C0%5D)\n\n\n---\n\n```\n \n```\n```rescript\ntype SectionHeader.props<'children> = {children: 'children}\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22Fragment.res%22%2C1%2C2%5D)\n\n\n---\n\n```\n \n```\n```rescript\ntype Jsx.element = Jsx_common.element = {}\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22Jsx.res%22%2C0%2C-1%5D)\n"}}
2+
{"contents": {"kind": "markdown", "value": "```rescript\nReact.component<SectionHeader.props<Jsx.element>>\n```\n\n---\n\n```\n \n```\n```rescript\ntype React.component<'props> = Jsx.component<'props>\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22React.res%22%2C12%2C0%5D)\n\n\n---\n\n```\n \n```\n```rescript\ntype SectionHeader.props<'children> = {children: 'children}\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22Fragment.res%22%2C1%2C2%5D)\n\n\n---\n\n```\n \n```\n```rescript\ntype Jsx.element = Jsx_common.element\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22Jsx.res%22%2C0%2C-1%5D)\n"}}
33

44
Hover src/Fragment.res 9:56
55
Nothing at that position. Now trying to use completion.

tests/build_tests/super_errors/expected/jsx_type_mismatch_array_element.res.expected

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,5 @@
88
20 │
99

1010
This has type: array<'a>
11-
But it's expected to have type: React.element (defined as Jsx.element)
12-
13-
You need to convert each item in this array to a JSX element first, then use React.array to convert the array of JSX elements into a single JSX element.
11+
But it's expected to have type:
12+
React.element (defined as Jsx_common.element)

tests/build_tests/super_errors/expected/jsx_type_mismatch_array_raw.res.expected

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,5 @@
88
18 │
99

1010
This has type: array<'a>
11-
But it's expected to have type: React.element (defined as Jsx.element)
12-
13-
You need to convert each item in this array to a JSX element first, then use React.array to convert the array of JSX elements into a single JSX element.
11+
But it's expected to have type:
12+
React.element (defined as Jsx_common.element)

tests/build_tests/super_errors/expected/jsx_type_mismatch_float.res.expected

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,5 @@
88
18 │
99

1010
This has type: float
11-
But it's expected to have type: React.element (defined as Jsx.element)
12-
13-
In JSX, all content must be JSX elements. You can convert float to a JSX element with React.float.
11+
But it's expected to have type:
12+
React.element (defined as Jsx_common.element)

tests/build_tests/super_errors/expected/jsx_type_mismatch_int.res.expected

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,5 @@
88
18 │
99

1010
This has type: int
11-
But it's expected to have type: React.element (defined as Jsx.element)
12-
13-
In JSX, all content must be JSX elements. You can convert int to a JSX element with React.int.
11+
But it's expected to have type:
12+
React.element (defined as Jsx_common.element)

tests/build_tests/super_errors/expected/jsx_type_mismatch_option.res.expected

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,5 @@
88
18 │
99

1010
This has type: option<'a>
11-
But it's expected to have type: React.element (defined as Jsx.element)
12-
13-
You need to unwrap this option to its underlying value first, then turn that value into a JSX element.
14-
For None, you can use React.null to output nothing into JSX.
11+
But it's expected to have type:
12+
React.element (defined as Jsx_common.element)

tests/build_tests/super_errors/expected/jsx_type_mismatch_string.res.expected

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,5 @@
88
18 │
99

1010
This has type: string
11-
But it's expected to have type: React.element (defined as Jsx.element)
12-
13-
In JSX, all content must be JSX elements. You can convert string to a JSX element with React.string.
11+
But it's expected to have type:
12+
React.element (defined as Jsx_common.element)

0 commit comments

Comments
 (0)