aboutsummaryrefslogtreecommitdiffstats
path: root/types.html
diff options
context:
space:
mode:
authoralyx <alyx@aleteoryx.me>2022-06-08 17:43:49 +0000
committerAleteoryx <alyx@aleteoryx.me>2022-06-08 17:43:49 +0000
commitd286258f7c05b1a98f9a9aea388690a85246fd87 (patch)
treeadf06bde381b8839cf1b0ae522f55d9553986a1c /types.html
parent7f6f5549fe6d1bd03772c13e96f9d92a26660929 (diff)
downloadRRCUtils-d286258f7c05b1a98f9a9aea388690a85246fd87.tar.gz
RRCUtils-d286258f7c05b1a98f9a9aea388690a85246fd87.tar.bz2
RRCUtils-d286258f7c05b1a98f9a9aea388690a85246fd87.zip
Type intersecting is fully implemented.
Diffstat (limited to 'types.html')
-rw-r--r--types.html79
1 files changed, 74 insertions, 5 deletions
diff --git a/types.html b/types.html
index 6794e75..3f9d74a 100644
--- a/types.html
+++ b/types.html
@@ -5,9 +5,32 @@
<meta name="viewport" content="width=device-width">
<title>Document</title>
- <script src="/lib/types.js" ></script>
+ <script src="/lib/util.js"></script>
+ <script src="/lib/types.js"></script>
+ <script src="/lib/chips.js"></script>
+ <link href="/lib/chips.css" rel="stylesheet"></link>
+ <style>
+ table {
+ background: #333;
+ color: white;
+ }
+ table * {
+ border: solid #888 1px;
+ }
+ table th {
+ background: #222;
+ }
+ table td {
+ font-family: sans-serif;
+ }
+ </style>
+
+</head>
+<body>
+ <table><thead><tr id="head"><th>Type</th></tr></thead><tbody id="body"></tbody></table>
<script>
+ console.log("Testing type parsing...")
console.log(new Type("int"))
console.log(new Type("List<int>"))
console.log(new Type("(int, T1)", ["T1"]))
@@ -15,11 +38,57 @@
console.log(new Type("(int|float|Vector3)"))
console.log(new Type("List<(int|float|Vector3)>"))
console.log(new Type("(List<List<(int|float|Vector3)>>|List<any>)"))
+ console.log("Done!")
- </script>
+ console.log("Testing type intersections");
+ const tistart = performance.now();
+ const types = [
+ //standard
+ new Type("int"),
+ new Type("bool"),
+ //template
+ new Type("List<int>"),
+ new Type("List<float>"),
+ new Type("List<List<int>>"),
+ new Type("List<List<any>>"),
+ new Type("List<(int|float)>"),
+ new Type("List<(float|Vector3)>"),
+ new Type("List<any>"),
+ //union
+ new Type("(int|float|bool)"),
+ new Type("(List<any>|bool)"),
+ //any
+ new Type("any"),
+ //dumb shit
+ new Type("List<(List<(int|float)>|Vector3)>"),
+ ];
+ const head = document.getElementById("head");
+ const body = document.getElementById("body");
-</head>
-<body>
-
+ for (const t of types) {
+ const headel = document.createElement("th");
+ headel.innerText = t;
+ head.appendChild(headel);
+
+ const row = document.createElement("tr");
+ body.appendChild(row);
+ const title = document.createElement("th");
+ title.innerText = t;
+ row.appendChild(title);
+ for (const t2 of types) {
+ const sect = document.createElement("td");
+ sect.innerText = intersect(t,t2);
+ row.appendChild(sect);
+ }
+ }
+
+ console.log(`Done in ${performance.now() - tistart}ms!`)
+
+ console.log("Testing chip class...")
+ const node = {"ReadonlyPaletteName": "Set Rotation","ReadonlyChipName": "Set Rotation","Description": "Sets the rotation of the target player or object. Players will rotate about the vertical axis only. Will fail in the following cases: If the target object is currently held, select/frozen by the maker pen, or is the child of a gizmo. Will also fail on players that are seated.","IsBetaChip": true,"DeprecationStage": "Active","PaletteNameSource": "FirstNodeDesc","ChipNameSource": "FirstNodeDesc","NodeDescs": [{"Name": "Set Rotation","ReadonlyTypeParams": {"T": "(Player | Rec Room Object)","U": "(Vector3 | Quaternion)"},"Inputs": [{"Name": "","ReadonlyType": "exec","Description": ""},{"Name": "Target","ReadonlyType": "T","Description": ""},{"Name": "Rotation","ReadonlyType": "U","Description": ""}],"Outputs": [{"Name": "","ReadonlyType": "exec","Description": ""},{"Name": "Success","ReadonlyType": "bool","Description": ""}]}],"NodeFilters": [{"FilterPath": ["Player","Physics"]},{"FilterPath": ["Object","Physics"]}]};
+ document.body.append((x=new Chip(node).root));
+ document.body.appendChild(x);
+
+ </script>
</body>
</html> \ No newline at end of file