enh(swift) `@unchecked` and `@Sendable` support (#3808)
* @Sendable is a keyword attribute * Add @unchecked for Sendable conformance * Use scope spelling for attribute rules * @unchecked is not actually contextual * Revert unneeded changes * Update CHANGES.md
This commit is contained in:
parent
88dcae86d4
commit
fcefad4a6b
|
@ -14,6 +14,7 @@ Core Grammars:
|
|||
- enh(swift) support `macro` keyword [Bradley Mackey][]
|
||||
- enh(swift) support parameter pack keywords [Bradley Mackey][]
|
||||
- enh(swift) regex literal support [Bradley Mackey][]
|
||||
- enh(swift) `@unchecked` and `@Sendable` support [Bradley Mackey][]
|
||||
|
||||
Dev tool:
|
||||
|
||||
|
|
|
@ -305,8 +305,10 @@ export const keywordAttributes = [
|
|||
'propertyWrapper',
|
||||
'requires_stored_property_inits',
|
||||
'resultBuilder',
|
||||
'Sendable',
|
||||
'testable',
|
||||
'UIApplicationMain',
|
||||
'unchecked',
|
||||
'unknown',
|
||||
'usableFromInline'
|
||||
];
|
||||
|
|
|
@ -243,7 +243,7 @@ export default function(hljs) {
|
|||
// https://docs.swift.org/swift-book/ReferenceManual/Attributes.html
|
||||
const AVAILABLE_ATTRIBUTE = {
|
||||
match: /(@|#(un)?)available/,
|
||||
className: "keyword",
|
||||
scope: 'keyword',
|
||||
starts: { contains: [
|
||||
{
|
||||
begin: /\(/,
|
||||
|
@ -258,11 +258,11 @@ export default function(hljs) {
|
|||
] }
|
||||
};
|
||||
const KEYWORD_ATTRIBUTE = {
|
||||
className: 'keyword',
|
||||
scope: 'keyword',
|
||||
match: concat(/@/, either(...Swift.keywordAttributes))
|
||||
};
|
||||
const USER_DEFINED_ATTRIBUTE = {
|
||||
className: 'meta',
|
||||
scope: 'meta',
|
||||
match: concat(/@/, Swift.identifier)
|
||||
};
|
||||
const ATTRIBUTES = [
|
||||
|
|
|
@ -5,5 +5,7 @@
|
|||
<span class="hljs-keyword">@propertyWrapper</span>
|
||||
<span class="hljs-meta">@SomeWrapper</span>(value: <span class="hljs-number">1.0</span>, other: <span class="hljs-string">"string"</span>, bool: <span class="hljs-literal">false</span>)
|
||||
<span class="hljs-keyword">@resultBuilder</span>
|
||||
<span class="hljs-keyword">@Sendable</span>
|
||||
<span class="hljs-keyword">@unchecked</span>
|
||||
|
||||
@ notAnAttribute
|
||||
|
|
|
@ -5,5 +5,7 @@
|
|||
@propertyWrapper
|
||||
@SomeWrapper(value: 1.0, other: "string", bool: false)
|
||||
@resultBuilder
|
||||
@Sendable
|
||||
@unchecked
|
||||
|
||||
@ notAnAttribute
|
||||
|
|
Loading…
Reference in New Issue