File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed
lib/ASTGen/Sources/ASTGen Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -819,7 +819,7 @@ func expandAttachedMacroIPC(
819819 let extendedTypeSyntax : PluginMessage . Syntax ?
820820 if ( !qualifiedType. isEmpty) {
821821 let typeSyntax : TypeSyntax = " \( raw: qualifiedType) "
822- extendedTypeSyntax = . init( syntax: Syntax ( typeSyntax) , in : parentDeclSourceFilePtr! ) !
822+ extendedTypeSyntax = . init( syntax: Syntax ( typeSyntax) ) !
823823 } else {
824824 extendedTypeSyntax = nil
825825 }
Original file line number Diff line number Diff line change @@ -397,4 +397,31 @@ extension PluginMessage.Syntax {
397397 line: loc. line,
398398 column: loc. column) )
399399 }
400+
401+ init ? ( syntax: Syntax ) {
402+ let kind : PluginMessage . Syntax . Kind
403+ switch true {
404+ case syntax. is ( DeclSyntax . self) : kind = . declaration
405+ case syntax. is ( ExprSyntax . self) : kind = . expression
406+ case syntax. is ( StmtSyntax . self) : kind = . statement
407+ case syntax. is ( TypeSyntax . self) : kind = . type
408+ case syntax. is ( PatternSyntax . self) : kind = . pattern
409+ case syntax. is ( AttributeSyntax . self) : kind = . attribute
410+ default : return nil
411+ }
412+
413+ let source = syntax. description
414+
415+ self . init (
416+ kind: kind,
417+ source: source,
418+ location: . init(
419+ fileID: " " ,
420+ fileName: " " ,
421+ offset: 0 ,
422+ line: 0 ,
423+ column: 0
424+ )
425+ )
426+ }
400427}
You can’t perform that action at this time.
0 commit comments