Skip to content

Commit e5ae60a

Browse files
committed
stdlib: Rename some helpers inside UnicodeTrie. NFC.
1 parent e45dfe0 commit e5ae60a

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

Diff for: stdlib/public/core/UnicodeTrie.swift.gyb

+12-10
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ SuppDataBytesOffset = 12817
4444

4545
import SwiftShims
4646

47+
// These case names must be kept in sync with the 'GraphemeClusterBreakProperty'
48+
// enum in C++ and with the names in the GYBUnicodeDataUtils script.
4749
public // @testable
4850
enum _GraphemeClusterBreakPropertyValue : Int {
4951
case Other = 0
@@ -107,31 +109,31 @@ struct _UnicodeGraphemeClusterBreakPropertyTrie {
107109
let _trieData: UnsafePointer<UInt8>
108110

109111
% if BMPLookupBytesPerEntry == 1:
110-
@_transparent var _BMPLookup: UnsafePointer<UInt8> {
112+
@_transparent var _bmpLookup: UnsafePointer<UInt8> {
111113
return _trieData + ${BMPLookupBytesOffset}
112114
}
113115
% end
114116

115117
% if BMPDataBytesPerEntry == 1:
116-
@_transparent var _BMPData: UnsafePointer<UInt8> {
118+
@_transparent var _bmpData: UnsafePointer<UInt8> {
117119
return _trieData + ${BMPDataBytesOffset}
118120
}
119121
% end
120122

121123
% if SuppLookup1BytesPerEntry == 1:
122-
@_transparent var _SuppLookup1: UnsafePointer<UInt8> {
124+
@_transparent var _suppLookup1: UnsafePointer<UInt8> {
123125
return _trieData + ${SuppLookup1BytesOffset}
124126
}
125127
% end
126128

127129
% if SuppLookup2BytesPerEntry == 1:
128-
@_transparent var _SuppLookup2: UnsafePointer<UInt8> {
130+
@_transparent var _suppLookup2: UnsafePointer<UInt8> {
129131
return _trieData + ${SuppLookup2BytesOffset}
130132
}
131133
% end
132134

133135
% if SuppDataBytesPerEntry == 1:
134-
@_transparent var _SuppData: UnsafePointer<UInt8> {
136+
@_transparent var _suppData: UnsafePointer<UInt8> {
135137
return _trieData + ${SuppDataBytesOffset}
136138
}
137139
% end
@@ -184,19 +186,19 @@ struct _UnicodeGraphemeClusterBreakPropertyTrie {
184186
// if '+' is used.
185187

186188
if _fastPath(codePoint <= 0xffff) {
187-
let dataBlockIndex = Int(_BMPLookup[_getBMPFirstLevelIndex(codePoint)])
189+
let dataBlockIndex = Int(_bmpLookup[_getBMPFirstLevelIndex(codePoint)])
188190
return _GraphemeClusterBreakPropertyRawValue(
189-
_BMPData[
191+
_bmpData[
190192
(dataBlockIndex << ${BMPDataOffsetBits}) &+
191193
_getBMPDataOffset(codePoint)])
192194
} else {
193195
_precondition(codePoint <= 0x10ffff)
194-
let secondLookupIndex = Int(_SuppLookup1[_getSuppFirstLevelIndex(codePoint)])
195-
let dataBlockIndex = Int(_SuppLookup2[
196+
let secondLookupIndex = Int(_suppLookup1[_getSuppFirstLevelIndex(codePoint)])
197+
let dataBlockIndex = Int(_suppLookup2[
196198
(secondLookupIndex << ${SuppSecondLevelIndexBits}) &+
197199
_getSuppSecondLevelIndex(codePoint)])
198200
return _GraphemeClusterBreakPropertyRawValue(
199-
_SuppData[
201+
_suppData[
200202
(dataBlockIndex << ${SuppDataOffsetBits}) &+
201203
_getSuppDataOffset(codePoint)])
202204
}

Diff for: utils/GYBUnicodeDataUtils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class GraphemeClusterBreakPropertyTable(UnicodeProperty):
3737

3838
property_values = [None for i in range(0, 0x110000)]
3939

40-
# Note: Numeric values should be consistent with
40+
# Note: Numeric values (including the names) should be consistent with
4141
# '_GraphemeClusterBreakPropertyValue' enum on the Swift side, and with
4242
# 'GraphemeClusterBreakProperty' in the compiler C++ code. If there is a
4343
# reason for either of those to differ, then this mapping can be overridden

0 commit comments

Comments
 (0)