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 @@ -849,7 +849,7 @@ func expandAttachedMacroIPC(
849
849
let extendedTypeSyntax : PluginMessage . Syntax ?
850
850
if ( !qualifiedType. isEmpty) {
851
851
let typeSyntax : TypeSyntax = " \( raw: qualifiedType) "
852
- extendedTypeSyntax = . init( syntax: Syntax ( typeSyntax) , in : parentDeclSourceFilePtr! ) !
852
+ extendedTypeSyntax = . init( syntax: Syntax ( typeSyntax) ) !
853
853
} else {
854
854
extendedTypeSyntax = nil
855
855
}
Original file line number Diff line number Diff line change @@ -392,4 +392,31 @@ extension PluginMessage.Syntax {
392
392
line: loc. line,
393
393
column: loc. column) )
394
394
}
395
+
396
+ init ? ( syntax: Syntax ) {
397
+ let kind : PluginMessage . Syntax . Kind
398
+ switch true {
399
+ case syntax. is ( DeclSyntax . self) : kind = . declaration
400
+ case syntax. is ( ExprSyntax . self) : kind = . expression
401
+ case syntax. is ( StmtSyntax . self) : kind = . statement
402
+ case syntax. is ( TypeSyntax . self) : kind = . type
403
+ case syntax. is ( PatternSyntax . self) : kind = . pattern
404
+ case syntax. is ( AttributeSyntax . self) : kind = . attribute
405
+ default : return nil
406
+ }
407
+
408
+ let source = syntax. description
409
+
410
+ self . init (
411
+ kind: kind,
412
+ source: source,
413
+ location: . init(
414
+ fileID: " " ,
415
+ fileName: " " ,
416
+ offset: 0 ,
417
+ line: 0 ,
418
+ column: 0
419
+ )
420
+ )
421
+ }
395
422
}
You can’t perform that action at this time.
0 commit comments