Skip to content

Turn some static variables into static stored constants #2729

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -199,17 +199,14 @@ func syntaxNode(nodesStartingWith: [Character]) -> SourceFileSyntax {
}
}

try! VariableDeclSyntax("public static var structure: SyntaxNodeStructure") {
let layout = ArrayExprSyntax {
for child in node.children {
ArrayElementSyntax(
expression: ExprSyntax(#"\Self.\#(child.varOrCaseName)"#)
)
}
let layout = ArrayExprSyntax {
for child in node.children {
ArrayElementSyntax(
expression: ExprSyntax(#"\Self.\#(child.varOrCaseName)"#)
)
}

StmtSyntax("return .layout(\(layout))")
}
"public static let structure: SyntaxNodeStructure = .layout(\(layout))"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/SwiftOperators/OperatorTable+Defaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ extension OperatorTable {
/// without requiring access to the standard library source code. However,
/// because it does not incorporate user-defined operators, it will only
/// ever be useful for a quick approximation.
public static var standardOperators: OperatorTable {
public static let standardOperators: OperatorTable = {
let precedenceGroups: [PrecedenceGroup] = [
PrecedenceGroup(
name: "AssignmentPrecedence",
Expand Down Expand Up @@ -437,5 +437,5 @@ extension OperatorTable {
precedenceGroups: precedenceGroups,
operators: operators
)
}
}()
}
Loading