Skip to content

Commit 6841171

Browse files
renamed some stuff
- `HTMLResultRepresentation` -> `HTMLExpansionResultType` - `representation` -> `resultType`
1 parent 3795ba6 commit 6841171

File tree

14 files changed

+49
-49
lines changed

14 files changed

+49
-49
lines changed

Benchmarks/Benchmarks/SwiftHTMLKit/SwiftHTMLKit.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ package struct SwiftHTMLKitTests: HTMLGenerator {
6767
package func dynamicHTML(_ context: HTMLContext) -> String {
6868
var qualities:String = ""
6969
for quality in context.user.qualities {
70-
qualities += #html(representation: .literal, li(quality))
70+
qualities += #html(resultType: .literal, li(quality))
7171
}
72-
return #html(representation: .literal) {
72+
return #html(resultType: .literal) {
7373
html {
7474
head {
7575
meta(charset: context.charset)

Sources/HTMLKit/HTMLKit.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
@freestanding(expression)
1111
public macro escapeHTML(
1212
encoding: HTMLEncoding = .string,
13-
representation: HTMLResultRepresentation = .literal,
13+
resultType: HTMLExpansionResultType = .literal,
1414
_ innerHTML: Sendable...
1515
) -> String = #externalMacro(module: "HTMLKitMacros", type: "EscapeHTML")
1616

@@ -20,7 +20,7 @@ public macro escapeHTML(
2020
//@available(*, deprecated, message: "innerHTML is now initialized using brackets instead of parentheses")
2121
public macro html<T>(
2222
encoding: HTMLEncoding = .string,
23-
representation: HTMLResultRepresentation = .literal,
23+
resultType: HTMLExpansionResultType = .literal,
2424
lookupFiles: [StaticString] = [],
2525
_ innerHTML: Sendable...
2626
) -> T = #externalMacro(module: "HTMLKitMacros", type: "HTMLElementMacro")
@@ -30,7 +30,7 @@ public macro html<T>(
3030
@freestanding(expression)
3131
public macro html<T>(
3232
encoding: HTMLEncoding = .string,
33-
representation: HTMLResultRepresentation = .literal,
33+
resultType: HTMLExpansionResultType = .literal,
3434
lookupFiles: [StaticString] = [],
3535
_ innerHTML: () -> Sendable...
3636
) -> T = #externalMacro(module: "HTMLKitMacros", type: "HTMLElementMacro")
@@ -39,7 +39,7 @@ public macro html<T>(
3939
@freestanding(expression)
4040
public macro anyHTML(
4141
encoding: HTMLEncoding = .string,
42-
representation: HTMLResultRepresentation = .literal,
42+
resultType: HTMLExpansionResultType = .literal,
4343
lookupFiles: [StaticString] = [],
4444
_ innerHTML: Sendable...
4545
) -> any Sendable = #externalMacro(module: "HTMLKitMacros", type: "HTMLElementMacro")
@@ -51,7 +51,7 @@ public macro anyHTML(
5151
@freestanding(expression)
5252
public macro uncheckedHTML<T>(
5353
encoding: HTMLEncoding = .string,
54-
representation: HTMLResultRepresentation = .literal,
54+
resultType: HTMLExpansionResultType = .literal,
5555
lookupFiles: [StaticString] = [],
5656
_ innerHTML: Sendable...
5757
) -> T = #externalMacro(module: "HTMLKitMacros", type: "HTMLElementMacro")
@@ -63,7 +63,7 @@ public macro uncheckedHTML<T>(
6363
@freestanding(expression)
6464
public macro rawHTML<T>(
6565
encoding: HTMLEncoding = .string,
66-
representation: HTMLResultRepresentation = .literal,
66+
resultType: HTMLExpansionResultType = .literal,
6767
lookupFiles: [StaticString] = [],
6868
minify: Bool = false,
6969
_ innerHTML: Sendable...
@@ -75,7 +75,7 @@ public macro rawHTML<T>(
7575
@freestanding(expression)
7676
public macro anyRawHTML(
7777
encoding: HTMLEncoding = .string,
78-
representation: HTMLResultRepresentation = .literal,
78+
resultType: HTMLExpansionResultType = .literal,
7979
lookupFiles: [StaticString] = [],
8080
minify: Bool = false,
8181
_ innerHTML: Sendable...

Sources/HTMLKitMacros/EscapeHTML.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ enum EscapeHTML: ExpressionMacro {
1111
expansion: node,
1212
ignoresCompilerWarnings: false,
1313
encoding: .string,
14-
representation: .literal,
14+
resultType: .literal,
1515
key: "",
1616
arguments: node.arguments
1717
)

Sources/HTMLKitMacros/HTMLElement.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ enum HTMLElementMacro: ExpressionMacro {
1212
expansion: node,
1313
ignoresCompilerWarnings: node.macroName.text == "uncheckedHTML",
1414
encoding: .string,
15-
representation: .literal,
15+
resultType: .literal,
1616
key: "",
1717
arguments: node.arguments,
1818
escape: true,

Sources/HTMLKitMacros/RawHTML.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ enum RawHTML: ExpressionMacro {
1111
expansion: node,
1212
ignoresCompilerWarnings: false,
1313
encoding: .string,
14-
representation: .literal,
14+
resultType: .literal,
1515
key: "",
1616
arguments: node.arguments
1717
)

Sources/HTMLKitParse/ExpandHTMLMacro.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ extension HTMLKitUtilities {
88
var context = context
99
let (string, encoding) = expandMacro(context: &context)
1010
let encodingResult = encodingResult(context: context, node: context.expansion, string: string, for: encoding)
11-
let expandedResult = representationResult(encoding: encoding, encodedResult: encodingResult, representation: context.representation)
11+
let expandedResult = representationResult(encoding: encoding, encodedResult: encodingResult, resultType: context.resultType)
1212
return "\(raw: expandedResult)"
1313
}
1414

@@ -80,9 +80,9 @@ extension HTMLKitUtilities {
8080
static func representationResult(
8181
encoding: HTMLEncoding,
8282
encodedResult: String,
83-
representation: HTMLResultRepresentationAST
83+
resultType: HTMLExpansionResultTypeAST
8484
) -> String {
85-
switch representation {
85+
switch resultType {
8686
case .literal:
8787
if encoding == .string {
8888
return literal(encodedResult: encodedResult)

Sources/HTMLKitParse/ParseArguments.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ extension HTMLKitUtilities {
2727
switch key {
2828
case "encoding":
2929
context.encoding = parseEncoding(expr: child.expression) ?? .string
30-
case "representation":
31-
context.representation = parseRepresentation(expr: child.expression) ?? .literal
30+
case "resultType":
31+
context.resultType = parseRepresentation(expr: child.expression) ?? .literal
3232
case "lookupFiles":
3333
guard let array = child.expression.array?.elements else {
3434
context.diagnose(DiagnosticMsg.expectedArrayExpr(expr: child.expression))

Sources/HTMLKitParse/ParseData.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ extension HTMLKitUtilities {
3939
if let key = child.label?.text {
4040
switch key {
4141
case "encoding": context.encoding = parseEncoding(expr: child.expression) ?? .string
42-
case "representation": context.representation = parseRepresentation(expr: child.expression) ?? .literal
42+
case "resultType": context.resultType = parseRepresentation(expr: child.expression) ?? .literal
4343
case "minify": context.minify = child.expression.boolean(context) ?? false
4444
default: break
4545
}
@@ -84,7 +84,7 @@ extension HTMLKitUtilities {
8484
}
8585

8686
// MARK: Parse Representation
87-
public static func parseRepresentation(expr: ExprSyntax) -> HTMLResultRepresentationAST? {
87+
public static func parseRepresentation(expr: ExprSyntax) -> HTMLExpansionResultTypeAST? {
8888
switch expr.kind {
8989
case .memberAccessExpr:
9090
switch expr.memberAccess!.declName.baseName.text {

Sources/HTMLKitUtilities/HTMLEncoding.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
/// The value type the data should be encoded to when returned from the macro.
2+
/// The data type the result should be encoded to when returned from the macro.
33
///
44
/// ### Interpolation Promotion
55
///

Sources/HTMLKitUtilities/HTMLExpansionContext.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ public struct HTMLExpansionContext: @unchecked Sendable {
1717
/// `HTMLEncoding` of this expansion.
1818
public var encoding:HTMLEncoding
1919

20-
/// `HTMLResultRepresentation` of this expansion.
21-
public var representation:HTMLResultRepresentationAST
20+
/// `HTMLExpansionResultType` of this expansion.
21+
public var resultType:HTMLExpansionResultTypeAST
2222

2323
/// Associated attribute key responsible for the arguments.
2424
public var key:String
@@ -39,7 +39,7 @@ public struct HTMLExpansionContext: @unchecked Sendable {
3939
expansion: FreestandingMacroExpansionSyntax,
4040
ignoresCompilerWarnings: Bool,
4141
encoding: HTMLEncoding,
42-
representation: HTMLResultRepresentationAST,
42+
resultType: HTMLExpansionResultTypeAST,
4343
key: String,
4444
arguments: LabeledExprListSyntax,
4545
lookupFiles: Set<String> = [],
@@ -53,7 +53,7 @@ public struct HTMLExpansionContext: @unchecked Sendable {
5353
trailingClosure = expansion.trailingClosure
5454
self.ignoresCompilerWarnings = ignoresCompilerWarnings
5555
self.encoding = encoding
56-
self.representation = representation
56+
self.resultType = resultType
5757
self.key = key
5858
self.arguments = arguments
5959
self.lookupFiles = lookupFiles

0 commit comments

Comments
 (0)