Skip to content

Commit

Permalink
Add a &inout style var-refs
Browse files Browse the repository at this point in the history
A little confusing, because our regular
var expression is called variableReference
already ...
  • Loading branch information
helje5 committed Nov 10, 2024
1 parent d817429 commit f6a7904
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Plugins/Libraries/LighterCodeGenAST/Nodes/Expression.swift
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,16 @@ public extension Expression {
static func variable(_ name: String) -> Self {
.variableReference(instance: nil, name: name)
}


/// A variable (inout) reference, e.g. `&self.sql`.
static func variableRef(_ instance: String, _ name: String) -> Self {
.raw("&\(instance).\(name)") // TODO: add expr
}
/// A variable (inout) reference, e.g. `&self.sql`.
static func variableRef(_ name: String) -> Self {
.raw("&\(name)") // TODO: add expr
}

/// A KeyPath expression.
static func keyPath(_ baseType: TypeReference? = nil, _ property: String)
-> Self
Expand Down

0 comments on commit f6a7904

Please sign in to comment.