mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
* Implement the majority of parsing support for SE-0039.
* Parse old object literals names using new syntax and provide FixIt.
For example, parse "#Image(imageLiteral:...)" and provide a FixIt to
change it to "#imageLiteral(resourceName:...)". Now we see something like:
test.swift:4:9: error: '#Image' has been renamed to '#imageLiteral
var y = #Image(imageLiteral: "image.jpg")
^~~~~~ ~~~~~~~~~~~~
#imageLiteral resourceName
Handling the old syntax, and providing a FixIt for that, will be handled in a separate
commit.
Needs tests. Will be provided in later commit once full parsing support is done.
* Add back pieces of syntax map for object literals.
* Add parsing support for old object literal syntax.
... and provide fixits to new syntax.
Full tests to come in later commit.
* Improve parsing of invalid object literals with old syntax.
* Do not include bracket in code completion results.
* Remove defunct code in SyntaxModel.
* Add tests for migration fixits.
* Add literals to code completion overload tests.
@akyrtzi told me this should be fine.
* Clean up response tests not to include full paths.
* Further adjust offsets.
* Mark initializer for _ColorLiteralConvertible in UIKit as @nonobjc.
* Put attribute in the correct place.
107 lines
2.7 KiB
Plaintext
107 lines
2.7 KiB
Plaintext
{
|
|
key.offset: 0,
|
|
key.length: 267,
|
|
key.diagnostic_stage: source.diagnostic.stage.swift.parse,
|
|
key.substructure: [
|
|
{
|
|
key.kind: source.lang.swift.decl.var.global,
|
|
key.accessibility: source.lang.swift.accessibility.internal,
|
|
key.name: "color",
|
|
key.offset: 144,
|
|
key.length: 65,
|
|
key.typename: "S",
|
|
key.nameoffset: 148,
|
|
key.namelength: 5,
|
|
key.attributes: [
|
|
{
|
|
key.attribute: source.decl.attribute.__raw_doc_comment
|
|
}
|
|
]
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.expr.object_literal,
|
|
key.name: "colorLiteral",
|
|
key.offset: 159,
|
|
key.length: 50,
|
|
key.nameoffset: 160,
|
|
key.namelength: 12,
|
|
key.bodyoffset: 172,
|
|
key.bodylength: 36,
|
|
key.substructure: [
|
|
{
|
|
key.kind: source.lang.swift.decl.var.parameter,
|
|
key.name: "red",
|
|
key.offset: 173,
|
|
key.length: 6,
|
|
key.nameoffset: 173,
|
|
key.namelength: 3,
|
|
key.bodyoffset: 178,
|
|
key.bodylength: 1
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.decl.var.parameter,
|
|
key.name: "green",
|
|
key.offset: 181,
|
|
key.length: 8,
|
|
key.nameoffset: 181,
|
|
key.namelength: 5,
|
|
key.bodyoffset: 188,
|
|
key.bodylength: 1
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.decl.var.parameter,
|
|
key.name: "blue",
|
|
key.offset: 191,
|
|
key.length: 7,
|
|
key.nameoffset: 191,
|
|
key.namelength: 4,
|
|
key.bodyoffset: 197,
|
|
key.bodylength: 1
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.decl.var.parameter,
|
|
key.name: "alpha",
|
|
key.offset: 200,
|
|
key.length: 8,
|
|
key.nameoffset: 200,
|
|
key.namelength: 5,
|
|
key.bodyoffset: 207,
|
|
key.bodylength: 1
|
|
}
|
|
]
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.decl.var.global,
|
|
key.accessibility: source.lang.swift.accessibility.internal,
|
|
key.name: "image",
|
|
key.offset: 210,
|
|
key.length: 56,
|
|
key.typename: "I?",
|
|
key.nameoffset: 214,
|
|
key.namelength: 5
|
|
},
|
|
{
|
|
key.kind: source.lang.swift.expr.object_literal,
|
|
key.name: "imageLiteral",
|
|
key.offset: 226,
|
|
key.length: 40,
|
|
key.nameoffset: 227,
|
|
key.namelength: 12,
|
|
key.bodyoffset: 239,
|
|
key.bodylength: 26,
|
|
key.substructure: [
|
|
{
|
|
key.kind: source.lang.swift.decl.var.parameter,
|
|
key.name: "resourceName",
|
|
key.offset: 240,
|
|
key.length: 25,
|
|
key.nameoffset: 240,
|
|
key.namelength: 12,
|
|
key.bodyoffset: 254,
|
|
key.bodylength: 11
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|