@samitouri / QOS-React-2 / commits / b605fc1ab3

[BE] Even more permissive ref annotation comment

Allow `readOnly` and `writable` or even `WriTaBlE`. commit-id:f6f77fd8

Xuan Huang (黄玄) committed Oct 5, 2022 at 18:42 UTC b605fc1ab3ba92d8b38616529f80edf4d23494ae
1 file changed +2 -2
compiler/forget/src/MiddleEnd/RefKindInfer.ts
+2 -2
@@ -22,7 +22,7 @@ export default {
22 };
23
24 const ANNOTATIONS_IMMUT = ["immut", "readonly"];
25 -const ANNOTATIONS_MUT = ["mut", "mutable"];
25 +const ANNOTATIONS_MUT = ["mut", "mutable", "writable"];
26
27 /**
28 * Eventually, we probably want to move RefKind refinements
@@ -195,7 +195,7 @@ function refineUses(
195 function hasLeadingComment(path: NodePath, annotation: string): boolean {
196 return (
197 path.node.leadingComments?.some(
198 - (comment) => comment.value.trim() === annotation
198 + (comment) => comment.value.trim().toLowerCase() === annotation
199 ) ?? false
200 );
201 }