Skip to content

Commit df24b03

Browse files
authored
ASTGen: more type changes
1 parent 5633a31 commit df24b03

File tree

4 files changed

+19
-15
lines changed

4 files changed

+19
-15
lines changed

lib/ASTGen/Sources/ASTGen/Decls.swift

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import CASTBridging
2+
import CBasicBridging
23
import SwiftParser
34
import SwiftSyntax
45

@@ -8,7 +9,7 @@ extension ASTGenVisitor {
89
let equalLoc = self.base.advanced(by: node.initializer.equal.position.utf8Offset).raw
910
var nameText = node.identifier.text
1011
let name = nameText.withUTF8 { buf in
11-
return SwiftASTContext_getIdentifier(ctx, buf.baseAddress, buf.count)
12+
return SwiftASTContext_getIdentifier(ctx, buf.baseAddress, SwiftInt(buf.count))
1213
}
1314
let nameLoc = self.base.advanced(by: node.identifier.position.utf8Offset).raw
1415
let genericParams = node.genericParameterClause.map { self.visit($0).rawValue }
@@ -29,7 +30,7 @@ extension ASTGenVisitor {
2930
let loc = self.base.advanced(by: node.position.utf8Offset).raw
3031
var nameText = node.identifier.text
3132
let name = nameText.withUTF8 { buf in
32-
return SwiftASTContext_getIdentifier(ctx, buf.baseAddress, buf.count)
33+
return SwiftASTContext_getIdentifier(ctx, buf.baseAddress, SwiftInt(buf.count))
3334
}
3435

3536
let genericParams = node.genericParameterClause
@@ -52,7 +53,7 @@ extension ASTGenVisitor {
5253
let loc = self.base.advanced(by: node.position.utf8Offset).raw
5354
var nameText = node.identifier.text
5455
let name = nameText.withUTF8 { buf in
55-
return SwiftASTContext_getIdentifier(ctx, buf.baseAddress, buf.count)
56+
return SwiftASTContext_getIdentifier(ctx, buf.baseAddress, SwiftInt(buf.count))
5657
}
5758

5859
let out = ClassDecl_create(ctx, loc, name, loc, declContext)
@@ -95,7 +96,7 @@ extension ASTGenVisitor {
9596
// Swift AST represents "_" as nil.
9697
var text = nodeFirstName.text
9798
firstName = text.withUTF8 { buf in
98-
SwiftASTContext_getIdentifier(ctx, buf.baseAddress, buf.count)
99+
SwiftASTContext_getIdentifier(ctx, buf.baseAddress, SwiftInt(buf.count))
99100
}
100101
} else {
101102
firstName = nil
@@ -104,7 +105,7 @@ extension ASTGenVisitor {
104105
if let nodeSecondName = node.secondName {
105106
var text = nodeSecondName.text
106107
secondName = text.withUTF8 { buf in
107-
SwiftASTContext_getIdentifier(ctx, buf.baseAddress, buf.count)
108+
SwiftASTContext_getIdentifier(ctx, buf.baseAddress, SwiftInt(buf.count))
108109
}
109110
} else {
110111
secondName = nil
@@ -124,7 +125,7 @@ extension ASTGenVisitor {
124125

125126
var nameText = node.identifier.text
126127
let name = nameText.withUTF8 { buf in
127-
return SwiftASTContext_getIdentifier(ctx, buf.baseAddress, buf.count)
128+
return SwiftASTContext_getIdentifier(ctx, buf.baseAddress, SwiftInt(buf.count))
128129
}
129130

130131
let returnType: ASTNode?

lib/ASTGen/Sources/ASTGen/Diagnostics.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import CASTBridging
2+
import CBasicBridging
23
import SwiftDiagnostics
34
import SwiftSyntax
45

@@ -37,7 +38,7 @@ fileprivate func emitDiagnosticParts(
3738
let diag = mutableMessage.withUTF8 { messageBuffer in
3839
SwiftDiagnostic_create(
3940
diagEnginePtr, bridgedSeverity, sourceLoc(at: position),
40-
messageBuffer.baseAddress, messageBuffer.count
41+
messageBuffer.baseAddress, SwiftInt(messageBuffer.count)
4142
)
4243
}
4344

@@ -76,7 +77,7 @@ fileprivate func emitDiagnosticParts(
7677
newText.withUTF8 { textBuffer in
7778
SwiftDiagnostic_fixItReplace(
7879
diag, replaceStartLoc, replaceEndLoc,
79-
textBuffer.baseAddress, textBuffer.count
80+
textBuffer.baseAddress, SwiftInt(textBuffer.count)
8081
)
8182
}
8283
}
@@ -149,7 +150,7 @@ extension SourceManager {
149150
SwiftDiagnostic_create(
150151
cxxDiagnosticEngine, bridgedSeverity,
151152
cxxSourceLocation(for: node, at: position),
152-
messageBuffer.baseAddress, messageBuffer.count
153+
messageBuffer.baseAddress, SwiftInt(messageBuffer.count)
153154
)
154155
}
155156

@@ -202,7 +203,7 @@ extension SourceManager {
202203
newText.withUTF8 { textBuffer in
203204
SwiftDiagnostic_fixItReplace(
204205
diag, replaceStartLoc, replaceEndLoc,
205-
textBuffer.baseAddress, textBuffer.count
206+
textBuffer.baseAddress, SwiftInt(textBuffer.count)
206207
)
207208
}
208209
}

lib/ASTGen/Sources/ASTGen/Exprs.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import CASTBridging
2+
import CBasicBridging
23
import SwiftParser
34
import SwiftSyntax
45

@@ -34,7 +35,7 @@ extension ASTGenVisitor {
3435

3536
var text = node.identifier.text
3637
let id = text.withUTF8 { buf in
37-
return SwiftASTContext_getIdentifier(ctx, buf.baseAddress, buf.count)
38+
return SwiftASTContext_getIdentifier(ctx, buf.baseAddress, SwiftInt(buf.count))
3839
}
3940

4041
return .expr(SwiftIdentifierExpr_create(ctx, id, loc))
@@ -45,7 +46,7 @@ extension ASTGenVisitor {
4546

4647
var text = node.identifier.text
4748
let id = text.withUTF8 { buf in
48-
return SwiftASTContext_getIdentifier(ctx, buf.baseAddress, buf.count)
49+
return SwiftASTContext_getIdentifier(ctx, buf.baseAddress, SwiftInt(buf.count))
4950
}
5051

5152
return .expr(SwiftIdentifierExpr_create(ctx, id, loc))
@@ -56,7 +57,7 @@ extension ASTGenVisitor {
5657
let base = visit(node.base!).rawValue
5758
var nameText = node.name.text
5859
let name = nameText.withUTF8 { buf in
59-
return SwiftASTContext_getIdentifier(ctx, buf.baseAddress, buf.count)
60+
return SwiftASTContext_getIdentifier(ctx, buf.baseAddress, SwiftInt(buf.count))
6061
}
6162

6263
return .expr(UnresolvedDotExpr_create(ctx, base, loc, name, loc))

lib/ASTGen/Sources/ASTGen/Literals.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import CASTBridging
2+
import CBasicBridging
23
import SwiftParser
34
import SwiftSyntax
45

@@ -8,7 +9,7 @@ extension ASTGenVisitor {
89
var segment = node.segments.first!.as(StringSegmentSyntax.self)!.content.text
910
return .expr(
1011
segment.withUTF8 { buf in
11-
return SwiftStringLiteralExpr_create(ctx, buf.baseAddress, buf.count, loc)
12+
return SwiftStringLiteralExpr_create(ctx, buf.baseAddress, SwiftInt(buf.count), loc)
1213
})
1314
}
1415

@@ -17,7 +18,7 @@ extension ASTGenVisitor {
1718
var segment = node.digits.text
1819
return .expr(
1920
segment.withUTF8 { buf in
20-
return SwiftIntegerLiteralExpr_create(ctx, buf.baseAddress, buf.count, loc)
21+
return SwiftIntegerLiteralExpr_create(ctx, buf.baseAddress, SwiftInt(buf.count), loc)
2122
})
2223
}
2324

0 commit comments

Comments
 (0)