mirror of
https://github.com/divkit/divkit.git
synced 2026-06-06 20:07:59 +00:00
56 lines
1.3 KiB
Swift
56 lines
1.3 KiB
Swift
// Generated code. Do not modify.
|
|
|
|
import Foundation
|
|
import Serialization
|
|
import VGSL
|
|
|
|
public final class ArrayVariable: @unchecked Sendable {
|
|
public static let type: String = "array"
|
|
public let name: String
|
|
public let value: Expression<[Any]>
|
|
|
|
public func resolveValue(_ resolver: ExpressionResolver) -> [Any]? {
|
|
resolver.resolveArray(value)
|
|
}
|
|
|
|
public convenience init(dictionary: [String: Any], context: ParsingContext) throws {
|
|
self.init(
|
|
name: try dictionary.getField("name", context: context),
|
|
value: try dictionary.getExpressionField("value", context: context)
|
|
)
|
|
}
|
|
|
|
init(
|
|
name: String,
|
|
value: Expression<[Any]>
|
|
) {
|
|
self.name = name
|
|
self.value = value
|
|
}
|
|
}
|
|
|
|
#if DEBUG
|
|
// WARNING: this == is incomplete because of [String: Any] in class fields
|
|
extension ArrayVariable: Equatable {
|
|
public static func ==(lhs: ArrayVariable, rhs: ArrayVariable) -> Bool {
|
|
guard
|
|
lhs.name == rhs.name
|
|
else {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
}
|
|
#endif
|
|
|
|
extension ArrayVariable: Serializable {
|
|
@_optimize(size)
|
|
public func toDictionary() -> [String: ValidSerializationValue] {
|
|
var result: [String: ValidSerializationValue] = [:]
|
|
result["type"] = Self.type
|
|
result["name"] = name
|
|
result["value"] = value.toValidSerializationValue()
|
|
return result
|
|
}
|
|
}
|