Skip to content

Commit

Permalink
removed old code
Browse files Browse the repository at this point in the history
  • Loading branch information
wickwirew committed Apr 4, 2019
1 parent 621e812 commit f4ed41b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 27 deletions.
2 changes: 1 addition & 1 deletion Sources/Runtime/Metadata/EnumMetadata.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ struct EnumMetadata: MetadataType {

mutating func toTypeInfo() -> TypeInfo {
var info = TypeInfo(metadata: self)
info.properties = getProperties(of: type, offsets: fieldOffsets())
// info.properties = getProperties(of: type, offsets: fieldOffsets())
info.mangledName = mangledName()
return info
}
Expand Down
27 changes: 1 addition & 26 deletions Sources/Runtime/Utilities/GetFieldAt.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,32 +23,7 @@
import Foundation
import CRuntime

/// Type to use as the context in the `_getFieldAt` function.
struct PropertyInfoContext {
let name: String
let type: Any.Type
}

/// Gets the list of properties of the inputted type.
func getProperties(of type: Any.Type, offsets: [Int]) -> [PropertyInfo] {
return (0..<offsets.count).map{ index in
let offset = offsets[index]
var context = PropertyInfoContext(name: "", type: Any.self)
let pointer = unsafeBitCast(type, to: UnsafeRawPointer.self)
// swift_getFieldAt(pointer, UInt32(index), { name, type, ctx in
// guard let name = name, let ctx = ctx else {
// fatalError("name and ctx should not be nil")
// }
// let infoContext = ctx.assumingMemoryBound(to: PropertyInfoContext.self)
// infoContext.pointee = PropertyInfoContext(
// name: String(cString: name),
// type: unsafeBitCast(type, to: Any.Type.self)
// )
// }, &context)
return PropertyInfo(name: "", type: context.type, offset: offset, ownerType: type)
}
}

// TODO: Move this to CRuntime
@_silgen_name("swift_getTypeByMangledNameInContext")
public func _getTypeByMangledNameInContext(
_ name: UnsafePointer<UInt8>,
Expand Down

0 comments on commit f4ed41b

Please sign in to comment.