DougGregor / swift-macro-examples

Example macros for the Swift macros effort

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing API functionality of MemberMacro?

miku1958 opened this issue · comments

Hi I am learning MemberMacro , I don't know why _storage is defined in here

@attached(member, names: named(_storage))

but DictionaryIndirectionMacro.swift use string constants:

let storage: DeclSyntax = "var _storage: [String: Any] = [:]"

I also don't find "_storage" in AttributeSyntax or DeclGroupSyntax, is this a missing API function or is "named(_storage)" just not useful?

Thanks!

Forgot to say, I test it with XCTestCase

The reasons for the named(_storage) here are described in the proposal for attached macros.