From 6a9ba031b7f669a373b4b9e8809a197342aeb802 Mon Sep 17 00:00:00 2001 From: Anthony DePasquale Date: Tue, 1 Oct 2024 19:13:28 +0200 Subject: [PATCH] Clean up --- Sources/Ast.swift | 2 +- Sources/Environment.swift | 6 +++--- Sources/Runtime.swift | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Sources/Ast.swift b/Sources/Ast.swift index 1e56f70..7460284 100644 --- a/Sources/Ast.swift +++ b/Sources/Ast.swift @@ -122,5 +122,5 @@ struct KeywordArgumentExpression: Expression { } struct NullLiteral: Literal { - var value: Any? = nil + var value: Any? = nil } diff --git a/Sources/Environment.swift b/Sources/Environment.swift index 36005bd..370b0ee 100644 --- a/Sources/Environment.swift +++ b/Sources/Environment.swift @@ -167,15 +167,15 @@ class Environment { return ObjectValue(value: object) case is NullValue: return NullValue() - case Optional.none: - return NullValue() +// case Optional.none: +// return NullValue() default: throw JinjaError.runtime("Cannot convert to runtime value: \(input) type:\(type(of: input))") } } @discardableResult - func set(name: String, value: Any?) throws -> any RuntimeValue { + func set(name: String, value: Any) throws -> any RuntimeValue { try self.declareVariable(name: name, value: self.convertToRuntimeValues(input: value)) } diff --git a/Sources/Runtime.swift b/Sources/Runtime.swift index 6b701c4..6a4f54f 100644 --- a/Sources/Runtime.swift +++ b/Sources/Runtime.swift @@ -35,7 +35,7 @@ struct BooleanValue: RuntimeValue { } struct NullValue: RuntimeValue { - var value: Any? = nil + var value: (any RuntimeValue)? var builtins: [String: any RuntimeValue] = [:] func bool() -> Bool {