Files
swift-mirror/test/Macros/Inputs/evil_macro_definitions.swift
Rintaro Ishizaki a49ab25ae8 [Macros] Recovery after executable plugin crash
When executable plugins crashed or somehow decided to exit, the compiler
should relaunch the plugin executable before sending another message.
2023-03-23 22:26:42 -07:00

18 lines
462 B
Swift

import SwiftDiagnostics
import SwiftOperators
import SwiftSyntax
import SwiftSyntaxBuilder
import SwiftSyntaxMacros
public struct CrashingMacro: ExpressionMacro {
public static func expansion(
of macro: some FreestandingMacroExpansionSyntax,
in context: some MacroExpansionContext
) -> ExprSyntax {
let arg: UInt = UInt(macro.argumentList.first!.expression.description)!
let zero: UInt = 0
return "\(raw: zero - arg).description"
}
}