Skip to content

Commit 2bd6ff6

Browse files
authored
enh(js) add the using keyword (#4135)
* Add the `using` keyword per the "Explicit Resource Management" proposal This ECMAScript proposal adds a new keyword (`using`). It's reached stage 3, which is "recommended for implementation" Proposal: https://github.com/tc39/proposal-explicit-resource-management ECMAScript proposal process: https://tc39.es/process-document/
1 parent 4e485f2 commit 2bd6ff6

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

src/languages/lib/ecmascript.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ const KEYWORDS = [
4040
"import",
4141
"from",
4242
"export",
43-
"extends"
43+
"extends",
44+
// It's reached stage 3, which is "recommended for implementation":
45+
"using"
4446
];
4547
const LITERALS = [
4648
"true",

test/markup/javascript/keywords.expect.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@
1010
<span class="hljs-keyword">if</span> (<span class="hljs-title function_">checkCondition</span>(classes[i]) === <span class="hljs-literal">undefined</span>)
1111
<span class="hljs-keyword">return</span> <span class="hljs-regexp">/\d+[\s/]/g</span>;
1212
}
13+
<span class="hljs-keyword">using</span> val = <span class="hljs-title function_">condition</span>();
1314
}

test/markup/javascript/keywords.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ function $initHighlight(block, cls) {
1010
if (checkCondition(classes[i]) === undefined)
1111
return /\d+[\s/]/g;
1212
}
13+
using val = condition();
1314
}

0 commit comments

Comments
 (0)