mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Rather than using `ModuleDecl::isSystemModule()` to determine whether a module is not a user module, instead check whether the module was defined adjacent to the compiler or if it's part of the SDK. If no SDK path was given, then `isSystemModule` is still used as a fallback. Resolves rdar://89253201.
651 lines
14 KiB
Plaintext
651 lines
14 KiB
Plaintext
// we keep comments before the first line of code
|
|
// Keep this line
|
|
|
|
import Foundation
|
|
|
|
public class NewLineAfterImport {
|
|
}
|
|
|
|
/// This is the class base
|
|
public class FooOverlayClassBase {
|
|
|
|
public func f()
|
|
|
|
internal var Range: Int
|
|
}
|
|
|
|
public class FooOverlayClassDerived : FooOverlayClassBase {
|
|
|
|
override public func f()
|
|
}
|
|
|
|
|
|
internal class InternalClassVisible {
|
|
}
|
|
|
|
internal class IgnoreBigWhiteSpaceGap {
|
|
}
|
|
|
|
internal class PropWithDocComment {
|
|
|
|
/// Awesome property.
|
|
internal var prop: Int
|
|
|
|
/// I see doubles.
|
|
internal var (p1, p2): (Int, Int)
|
|
}
|
|
|
|
internal enum Colors {
|
|
|
|
case Red
|
|
|
|
case Blue
|
|
}
|
|
|
|
[
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.comment,
|
|
key.offset: 0,
|
|
key.length: 50
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.comment,
|
|
key.offset: 50,
|
|
key.length: 18
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.keyword,
|
|
key.offset: 69,
|
|
key.length: 6
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.identifier,
|
|
key.offset: 76,
|
|
key.length: 10
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.attribute.builtin,
|
|
key.offset: 88,
|
|
key.length: 6
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.keyword,
|
|
key.offset: 95,
|
|
key.length: 5
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.identifier,
|
|
key.offset: 101,
|
|
key.length: 18
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.doccomment,
|
|
key.offset: 125,
|
|
key.length: 27
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.attribute.builtin,
|
|
key.offset: 152,
|
|
key.length: 6
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.keyword,
|
|
key.offset: 159,
|
|
key.length: 5
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.identifier,
|
|
key.offset: 165,
|
|
key.length: 19
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.attribute.builtin,
|
|
key.offset: 192,
|
|
key.length: 6
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.keyword,
|
|
key.offset: 199,
|
|
key.length: 4
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.identifier,
|
|
key.offset: 204,
|
|
key.length: 1
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.attribute.builtin,
|
|
key.offset: 213,
|
|
key.length: 8
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.keyword,
|
|
key.offset: 222,
|
|
key.length: 3
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.identifier,
|
|
key.offset: 226,
|
|
key.length: 5
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.typeidentifier,
|
|
key.offset: 233,
|
|
key.length: 3
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.attribute.builtin,
|
|
key.offset: 240,
|
|
key.length: 6
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.keyword,
|
|
key.offset: 247,
|
|
key.length: 5
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.identifier,
|
|
key.offset: 253,
|
|
key.length: 22
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.typeidentifier,
|
|
key.offset: 278,
|
|
key.length: 19
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.attribute.builtin,
|
|
key.offset: 305,
|
|
key.length: 8
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.attribute.builtin,
|
|
key.offset: 314,
|
|
key.length: 6
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.keyword,
|
|
key.offset: 321,
|
|
key.length: 4
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.identifier,
|
|
key.offset: 326,
|
|
key.length: 1
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.attribute.builtin,
|
|
key.offset: 334,
|
|
key.length: 8
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.keyword,
|
|
key.offset: 343,
|
|
key.length: 5
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.identifier,
|
|
key.offset: 349,
|
|
key.length: 20
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.attribute.builtin,
|
|
key.offset: 375,
|
|
key.length: 8
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.keyword,
|
|
key.offset: 384,
|
|
key.length: 5
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.identifier,
|
|
key.offset: 390,
|
|
key.length: 22
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.attribute.builtin,
|
|
key.offset: 418,
|
|
key.length: 8
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.keyword,
|
|
key.offset: 427,
|
|
key.length: 5
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.identifier,
|
|
key.offset: 433,
|
|
key.length: 18
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.doccomment,
|
|
key.offset: 459,
|
|
key.length: 22
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.attribute.builtin,
|
|
key.offset: 485,
|
|
key.length: 8
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.keyword,
|
|
key.offset: 494,
|
|
key.length: 3
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.identifier,
|
|
key.offset: 498,
|
|
key.length: 4
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.typeidentifier,
|
|
key.offset: 504,
|
|
key.length: 3
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.doccomment,
|
|
key.offset: 513,
|
|
key.length: 19
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.attribute.builtin,
|
|
key.offset: 536,
|
|
key.length: 8
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.keyword,
|
|
key.offset: 545,
|
|
key.length: 3
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.identifier,
|
|
key.offset: 550,
|
|
key.length: 2
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.identifier,
|
|
key.offset: 554,
|
|
key.length: 2
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.typeidentifier,
|
|
key.offset: 560,
|
|
key.length: 3
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.typeidentifier,
|
|
key.offset: 565,
|
|
key.length: 3
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.attribute.builtin,
|
|
key.offset: 573,
|
|
key.length: 8
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.keyword,
|
|
key.offset: 582,
|
|
key.length: 4
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.identifier,
|
|
key.offset: 587,
|
|
key.length: 6
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.keyword,
|
|
key.offset: 601,
|
|
key.length: 4
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.identifier,
|
|
key.offset: 606,
|
|
key.length: 3
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.keyword,
|
|
key.offset: 615,
|
|
key.length: 4
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.syntaxtype.identifier,
|
|
key.offset: 620,
|
|
key.length: 4
|
|
}
|
|
]
|
|
[
|
|
{
|
|
key.kind: source.lang.swift.ref.module,
|
|
key.offset: 76,
|
|
key.length: 10,
|
|
key.is_system: 1
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.ref.struct,
|
|
key.offset: 233,
|
|
key.length: 3,
|
|
key.is_system: 1
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.ref.class,
|
|
key.offset: 278,
|
|
key.length: 19
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.ref.struct,
|
|
key.offset: 504,
|
|
key.length: 3,
|
|
key.is_system: 1
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.ref.struct,
|
|
key.offset: 560,
|
|
key.length: 3,
|
|
key.is_system: 1
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.ref.struct,
|
|
key.offset: 565,
|
|
key.length: 3,
|
|
key.is_system: 1
|
|
}
|
|
]
|
|
[
|
|
{
|
|
key.kind: source.lang.swift.decl.class,
|
|
key.accessibility: source.lang.swift.accessibility.public,
|
|
key.name: "NewLineAfterImport",
|
|
key.offset: 95,
|
|
key.length: 28,
|
|
key.nameoffset: 101,
|
|
key.namelength: 18,
|
|
key.bodyoffset: 121,
|
|
key.bodylength: 1,
|
|
key.attributes: [
|
|
{
|
|
key.offset: 88,
|
|
key.length: 6,
|
|
key.attribute: source.decl.attribute.public
|
|
}
|
|
]
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.decl.class,
|
|
key.accessibility: source.lang.swift.accessibility.public,
|
|
key.name: "FooOverlayClassBase",
|
|
key.offset: 159,
|
|
key.length: 79,
|
|
key.nameoffset: 165,
|
|
key.namelength: 19,
|
|
key.bodyoffset: 186,
|
|
key.bodylength: 51,
|
|
key.docoffset: 125,
|
|
key.doclength: 27,
|
|
key.attributes: [
|
|
{
|
|
key.offset: 152,
|
|
key.length: 6,
|
|
key.attribute: source.decl.attribute.public
|
|
}
|
|
],
|
|
key.substructure: [
|
|
{
|
|
key.kind: source.lang.swift.decl.function.method.instance,
|
|
key.accessibility: source.lang.swift.accessibility.public,
|
|
key.name: "f()",
|
|
key.offset: 199,
|
|
key.length: 8,
|
|
key.nameoffset: 204,
|
|
key.namelength: 3,
|
|
key.attributes: [
|
|
{
|
|
key.offset: 192,
|
|
key.length: 6,
|
|
key.attribute: source.decl.attribute.public
|
|
}
|
|
]
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.decl.var.instance,
|
|
key.accessibility: source.lang.swift.accessibility.internal,
|
|
key.setter_accessibility: source.lang.swift.accessibility.internal,
|
|
key.name: "Range",
|
|
key.offset: 222,
|
|
key.length: 14,
|
|
key.typename: "Int",
|
|
key.nameoffset: 226,
|
|
key.namelength: 5,
|
|
key.attributes: [
|
|
{
|
|
key.offset: 213,
|
|
key.length: 8,
|
|
key.attribute: source.decl.attribute.internal
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.decl.class,
|
|
key.accessibility: source.lang.swift.accessibility.public,
|
|
key.name: "FooOverlayClassDerived",
|
|
key.offset: 247,
|
|
key.length: 84,
|
|
key.nameoffset: 253,
|
|
key.namelength: 22,
|
|
key.bodyoffset: 299,
|
|
key.bodylength: 31,
|
|
key.inheritedtypes: [
|
|
{
|
|
key.name: "FooOverlayClassBase"
|
|
}
|
|
],
|
|
key.attributes: [
|
|
{
|
|
key.offset: 240,
|
|
key.length: 6,
|
|
key.attribute: source.decl.attribute.public
|
|
}
|
|
],
|
|
key.elements: [
|
|
{
|
|
key.kind: source.lang.swift.structure.elem.typeref,
|
|
key.offset: 278,
|
|
key.length: 19
|
|
}
|
|
],
|
|
key.substructure: [
|
|
{
|
|
key.kind: source.lang.swift.decl.function.method.instance,
|
|
key.accessibility: source.lang.swift.accessibility.public,
|
|
key.name: "f()",
|
|
key.offset: 321,
|
|
key.length: 8,
|
|
key.nameoffset: 326,
|
|
key.namelength: 3,
|
|
key.attributes: [
|
|
{
|
|
key.offset: 314,
|
|
key.length: 6,
|
|
key.attribute: source.decl.attribute.public
|
|
},
|
|
{
|
|
key.offset: 305,
|
|
key.length: 8,
|
|
key.attribute: source.decl.attribute.override
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.decl.class,
|
|
key.accessibility: source.lang.swift.accessibility.internal,
|
|
key.name: "InternalClassVisible",
|
|
key.offset: 343,
|
|
key.length: 30,
|
|
key.nameoffset: 349,
|
|
key.namelength: 20,
|
|
key.bodyoffset: 371,
|
|
key.bodylength: 1,
|
|
key.attributes: [
|
|
{
|
|
key.offset: 334,
|
|
key.length: 8,
|
|
key.attribute: source.decl.attribute.internal
|
|
}
|
|
]
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.decl.class,
|
|
key.accessibility: source.lang.swift.accessibility.internal,
|
|
key.name: "IgnoreBigWhiteSpaceGap",
|
|
key.offset: 384,
|
|
key.length: 32,
|
|
key.nameoffset: 390,
|
|
key.namelength: 22,
|
|
key.bodyoffset: 414,
|
|
key.bodylength: 1,
|
|
key.attributes: [
|
|
{
|
|
key.offset: 375,
|
|
key.length: 8,
|
|
key.attribute: source.decl.attribute.internal
|
|
}
|
|
]
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.decl.class,
|
|
key.accessibility: source.lang.swift.accessibility.internal,
|
|
key.name: "PropWithDocComment",
|
|
key.offset: 427,
|
|
key.length: 144,
|
|
key.nameoffset: 433,
|
|
key.namelength: 18,
|
|
key.bodyoffset: 453,
|
|
key.bodylength: 117,
|
|
key.attributes: [
|
|
{
|
|
key.offset: 418,
|
|
key.length: 8,
|
|
key.attribute: source.decl.attribute.internal
|
|
}
|
|
],
|
|
key.substructure: [
|
|
{
|
|
key.kind: source.lang.swift.decl.var.instance,
|
|
key.accessibility: source.lang.swift.accessibility.internal,
|
|
key.setter_accessibility: source.lang.swift.accessibility.internal,
|
|
key.name: "prop",
|
|
key.offset: 494,
|
|
key.length: 13,
|
|
key.typename: "Int",
|
|
key.nameoffset: 498,
|
|
key.namelength: 4,
|
|
key.docoffset: 459,
|
|
key.doclength: 22,
|
|
key.attributes: [
|
|
{
|
|
key.offset: 485,
|
|
key.length: 8,
|
|
key.attribute: source.decl.attribute.internal
|
|
}
|
|
]
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.decl.var.instance,
|
|
key.accessibility: source.lang.swift.accessibility.internal,
|
|
key.setter_accessibility: source.lang.swift.accessibility.internal,
|
|
key.name: "p1",
|
|
key.offset: 545,
|
|
key.length: 24,
|
|
key.typename: "(Int, Int)",
|
|
key.nameoffset: 550,
|
|
key.namelength: 2,
|
|
key.docoffset: 513,
|
|
key.doclength: 19,
|
|
key.attributes: [
|
|
{
|
|
key.offset: 536,
|
|
key.length: 8,
|
|
key.attribute: source.decl.attribute.internal
|
|
}
|
|
]
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.decl.var.instance,
|
|
key.accessibility: source.lang.swift.accessibility.internal,
|
|
key.setter_accessibility: source.lang.swift.accessibility.internal,
|
|
key.name: "p2",
|
|
key.offset: 545,
|
|
key.length: 24,
|
|
key.typename: "(Int, Int)",
|
|
key.nameoffset: 554,
|
|
key.namelength: 2,
|
|
key.docoffset: 513,
|
|
key.doclength: 19,
|
|
key.attributes: [
|
|
{
|
|
key.offset: 536,
|
|
key.length: 8,
|
|
key.attribute: source.decl.attribute.internal
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.decl.enum,
|
|
key.accessibility: source.lang.swift.accessibility.internal,
|
|
key.name: "Colors",
|
|
key.offset: 582,
|
|
key.length: 44,
|
|
key.nameoffset: 587,
|
|
key.namelength: 6,
|
|
key.bodyoffset: 595,
|
|
key.bodylength: 30,
|
|
key.attributes: [
|
|
{
|
|
key.offset: 573,
|
|
key.length: 8,
|
|
key.attribute: source.decl.attribute.internal
|
|
}
|
|
],
|
|
key.substructure: [
|
|
{
|
|
key.kind: source.lang.swift.decl.enumcase,
|
|
key.offset: 601,
|
|
key.length: 8,
|
|
key.substructure: [
|
|
{
|
|
key.kind: source.lang.swift.decl.enumelement,
|
|
key.accessibility: source.lang.swift.accessibility.internal,
|
|
key.name: "Red",
|
|
key.offset: 606,
|
|
key.length: 3,
|
|
key.nameoffset: 606,
|
|
key.namelength: 3
|
|
}
|
|
]
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.decl.enumcase,
|
|
key.offset: 615,
|
|
key.length: 9,
|
|
key.substructure: [
|
|
{
|
|
key.kind: source.lang.swift.decl.enumelement,
|
|
key.accessibility: source.lang.swift.accessibility.internal,
|
|
key.name: "Blue",
|
|
key.offset: 620,
|
|
key.length: 4,
|
|
key.nameoffset: 620,
|
|
key.namelength: 4
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|