oicana 0.10.0.rc.1-aarch64-linux-gnu → 0.10.0.rc.3-aarch64-linux-gnu

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b43092492df7813de668261663918ad4578339024489a0c7b201d63f3269fc16
4
- data.tar.gz: 14986ca3a485d25c29bcbfd484de1c3b6d16041745bdfd9b74045914d05c64a0
3
+ metadata.gz: 31084e215313ebf1eb02cee8cbeb6fad354bfe65c101a977d0b5b64b4c329018
4
+ data.tar.gz: d93b086b0a2bde9e8b3cdd6c203087159dbc1d870ae218af6ece390c294bcbd1
5
5
  SHA512:
6
- metadata.gz: 8fa5bb66ca5bafebf3e87471b25e4611799ad3a5cc655b1d2931788856284af80a4207473d2408404d4eb50d4f7895c06cc586a8f9a39ed012ba642c622b21be
7
- data.tar.gz: 6cf66c1e0d2acab52b1a7de7233411b273b1e323aef27591a8449864f21512cb22745bfb9bb2a36fd33393f014fe6bf34082d48ffe526df33f1e7297a69513d4
6
+ metadata.gz: 55910fefd7fa3a33547c8b8ce0f3b65162c50cc5e5984ad45dd3db178878e5089d7b1295381ebb985dfa71e6330a7952dfaf0b7b13a7e55105b02b0ef9367d54
7
+ data.tar.gz: 8fe91bd83f13378dd743fe94f54c2bec07a62b8b7627c15a352197968849ddd1eec5cfca1b45c3ff7f70176387d753df53fd4e350086fd1b908241c2bb208b9b
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: data/lib/oicana/native/liboicana_uniffi.so
3
3
  size: 45952304 bytes
4
- sha256: 0c2af7bb71bf4cf881f667d3f2687e60dd3b1dc964b99a503ce8007b51daf02c
4
+ sha256: 0839a7395d1391562d71539612f598d732b5da3ca5c1425155b87b03f7533237
@@ -146,11 +146,35 @@ end
146
146
  end
147
147
  end
148
148
 
149
+ # The Record type Diagnostic.
150
+
151
+ def self.check_lower_TypeDiagnostic(v)
152
+ RustBuffer.check_lower_TypeDiagnosticSeverity(v.severity)
153
+
154
+ RustBuffer.check_lower_OptionalTypeSourceLocation(v.location)
155
+ RustBuffer.check_lower_Sequencestring(v.hints)
156
+ RustBuffer.check_lower_SequenceTypeTracePoint(v.trace)
157
+
158
+ end
159
+
160
+ def self.alloc_from_TypeDiagnostic(v)
161
+ RustBuffer.allocWithBuilder do |builder|
162
+ builder.write_TypeDiagnostic(v)
163
+ return builder.finalize
164
+ end
165
+ end
166
+
167
+ def consumeIntoTypeDiagnostic
168
+ consumeWithStream do |stream|
169
+ return stream.readTypeDiagnostic
170
+ end
171
+ end
172
+
149
173
  # The Record type ExportOnceResult.
150
174
 
151
175
  def self.check_lower_TypeExportOnceResult(v)
152
176
 
153
- RustBuffer.check_lower_Optionalstring(v.warnings)
177
+ RustBuffer.check_lower_SequenceTypeDiagnostic(v.warnings)
154
178
  end
155
179
 
156
180
  def self.alloc_from_TypeExportOnceResult(v)
@@ -226,6 +250,49 @@ end
226
250
  end
227
251
  end
228
252
 
253
+ # The Record type SourceLocation.
254
+
255
+ def self.check_lower_TypeSourceLocation(v)
256
+
257
+
258
+
259
+
260
+
261
+ end
262
+
263
+ def self.alloc_from_TypeSourceLocation(v)
264
+ RustBuffer.allocWithBuilder do |builder|
265
+ builder.write_TypeSourceLocation(v)
266
+ return builder.finalize
267
+ end
268
+ end
269
+
270
+ def consumeIntoTypeSourceLocation
271
+ consumeWithStream do |stream|
272
+ return stream.readTypeSourceLocation
273
+ end
274
+ end
275
+
276
+ # The Record type TracePoint.
277
+
278
+ def self.check_lower_TypeTracePoint(v)
279
+
280
+ RustBuffer.check_lower_OptionalTypeSourceLocation(v.location)
281
+ end
282
+
283
+ def self.alloc_from_TypeTracePoint(v)
284
+ RustBuffer.allocWithBuilder do |builder|
285
+ builder.write_TypeTracePoint(v)
286
+ return builder.finalize
287
+ end
288
+ end
289
+
290
+ def consumeIntoTypeTracePoint
291
+ consumeWithStream do |stream|
292
+ return stream.readTypeTracePoint
293
+ end
294
+ end
295
+
229
296
  # The Record type ZipLimits.
230
297
 
231
298
  def self.check_lower_TypeZipLimits(v)
@@ -284,6 +351,25 @@ end
284
351
  end
285
352
 
286
353
 
354
+ # The Enum type DiagnosticSeverity.
355
+
356
+ def self.check_lower_TypeDiagnosticSeverity(v)
357
+ end
358
+
359
+ def self.alloc_from_TypeDiagnosticSeverity(v)
360
+ RustBuffer.allocWithBuilder do |builder|
361
+ builder.write_TypeDiagnosticSeverity(v)
362
+ return builder.finalize
363
+ end
364
+ end
365
+
366
+ def consumeIntoTypeDiagnosticSeverity
367
+ consumeWithStream do |stream|
368
+ return stream.readTypeDiagnosticSeverity
369
+ end
370
+ end
371
+
372
+
287
373
  # The Enum type ExportFormat.
288
374
 
289
375
  def self.check_lower_TypeExportFormat(v)
@@ -378,6 +464,27 @@ end
378
464
  end
379
465
  end
380
466
 
467
+ # The Optional<T> type for TypeSourceLocation.
468
+
469
+ def self.check_lower_OptionalTypeSourceLocation(v)
470
+ if not v.nil?
471
+ RustBuffer.check_lower_TypeSourceLocation(v)
472
+ end
473
+ end
474
+
475
+ def self.alloc_from_OptionalTypeSourceLocation(v)
476
+ RustBuffer.allocWithBuilder do |builder|
477
+ builder.write_OptionalTypeSourceLocation(v)
478
+ return builder.finalize()
479
+ end
480
+ end
481
+
482
+ def consumeIntoOptionalTypeSourceLocation
483
+ consumeWithStream do |stream|
484
+ return stream.readOptionalTypeSourceLocation
485
+ end
486
+ end
487
+
381
488
  # The Optional<T> type for TypeZipLimits.
382
489
 
383
490
  def self.check_lower_OptionalTypeZipLimits(v)
@@ -441,6 +548,27 @@ end
441
548
  end
442
549
  end
443
550
 
551
+ # The Sequence<T> type for TypeDiagnostic.
552
+
553
+ def self.check_lower_SequenceTypeDiagnostic(v)
554
+ v.each do |item|
555
+ RustBuffer.check_lower_TypeDiagnostic(item)
556
+ end
557
+ end
558
+
559
+ def self.alloc_from_SequenceTypeDiagnostic(v)
560
+ RustBuffer.allocWithBuilder do |builder|
561
+ builder.write_SequenceTypeDiagnostic(v)
562
+ return builder.finalize()
563
+ end
564
+ end
565
+
566
+ def consumeIntoSequenceTypeDiagnostic
567
+ consumeWithStream do |stream|
568
+ return stream.readSequenceTypeDiagnostic
569
+ end
570
+ end
571
+
444
572
  # The Sequence<T> type for TypePageSize.
445
573
 
446
574
  def self.check_lower_SequenceTypePageSize(v)
@@ -483,6 +611,27 @@ end
483
611
  end
484
612
  end
485
613
 
614
+ # The Sequence<T> type for TypeTracePoint.
615
+
616
+ def self.check_lower_SequenceTypeTracePoint(v)
617
+ v.each do |item|
618
+ RustBuffer.check_lower_TypeTracePoint(item)
619
+ end
620
+ end
621
+
622
+ def self.alloc_from_SequenceTypeTracePoint(v)
623
+ RustBuffer.allocWithBuilder do |builder|
624
+ builder.write_SequenceTypeTracePoint(v)
625
+ return builder.finalize()
626
+ end
627
+ end
628
+
629
+ def consumeIntoSequenceTypeTracePoint
630
+ consumeWithStream do |stream|
631
+ return stream.readSequenceTypeTracePoint
632
+ end
633
+ end
634
+
486
635
  # The Map<T> type for string.
487
636
 
488
637
  def self.check_lower_MapStringString(v)
@@ -569,6 +718,10 @@ class RustBufferStream
569
718
  data
570
719
  end
571
720
 
721
+ def readU32
722
+ unpack_from 4, 'L>'
723
+ end
724
+
572
725
  def readU64
573
726
  unpack_from 8, 'Q>'
574
727
  end
@@ -629,12 +782,25 @@ class RustBufferStream
629
782
  )
630
783
  end
631
784
 
785
+ # The Record type Diagnostic.
786
+
787
+ def readTypeDiagnostic
788
+ Diagnostic.new(
789
+ severity: readTypeDiagnosticSeverity,
790
+ message: readString,
791
+ location: readOptionalTypeSourceLocation,
792
+ hints: readSequencestring,
793
+ trace: readSequenceTypeTracePoint,
794
+ formatted: readString
795
+ )
796
+ end
797
+
632
798
  # The Record type ExportOnceResult.
633
799
 
634
800
  def readTypeExportOnceResult
635
801
  ExportOnceResult.new(
636
802
  bytes: readBytes,
637
- warnings: readOptionalstring
803
+ warnings: readSequenceTypeDiagnostic
638
804
  )
639
805
  end
640
806
 
@@ -665,6 +831,27 @@ class RustBufferStream
665
831
  )
666
832
  end
667
833
 
834
+ # The Record type SourceLocation.
835
+
836
+ def readTypeSourceLocation
837
+ SourceLocation.new(
838
+ file: readString,
839
+ line: readU32,
840
+ column: readU32,
841
+ end_line: readU32,
842
+ end_column: readU32
843
+ )
844
+ end
845
+
846
+ # The Record type TracePoint.
847
+
848
+ def readTypeTracePoint
849
+ TracePoint.new(
850
+ message: readString,
851
+ location: readOptionalTypeSourceLocation
852
+ )
853
+ end
854
+
668
855
  # The Record type ZipLimits.
669
856
 
670
857
  def readTypeZipLimits
@@ -714,6 +901,25 @@ class RustBufferStream
714
901
 
715
902
 
716
903
 
904
+ # The Enum type DiagnosticSeverity.
905
+
906
+ def readTypeDiagnosticSeverity
907
+ variant = unpack_from 4, 'l>'
908
+
909
+ if variant == 1
910
+ return DiagnosticSeverity::ERROR
911
+ end
912
+ if variant == 2
913
+ return DiagnosticSeverity::WARNING
914
+ end
915
+
916
+ raise InternalError, 'Unexpected variant tag for TypeDiagnosticSeverity'
917
+ end
918
+
919
+
920
+
921
+
922
+
717
923
  # The Enum type ExportFormat.
718
924
 
719
925
  def readTypeExportFormat
@@ -747,39 +953,39 @@ class RustBufferStream
747
953
  variant = unpack_from 4, 'l>'
748
954
 
749
955
  if variant == 1
750
- return OicanaError::InvalidTemplate.new(
751
- readString()
752
- )
956
+ return OicanaError::InvalidTemplate.new(
957
+ readString()
958
+ )
753
959
  end
754
960
  if variant == 2
755
- return OicanaError::InvalidInput.new(
756
- readString()
757
- )
961
+ return OicanaError::InvalidInput.new(
962
+ readString()
963
+ )
758
964
  end
759
965
  if variant == 3
760
- return OicanaError::Compilation.new(
761
- readString()
762
- )
966
+ return OicanaError::Compilation.new(
967
+ readString()
968
+ )
763
969
  end
764
970
  if variant == 4
765
- return OicanaError::FileNotFound.new(
766
- readString()
767
- )
971
+ return OicanaError::FileNotFound.new(
972
+ readString()
973
+ )
768
974
  end
769
975
  if variant == 5
770
- return OicanaError::Export.new(
771
- readString()
772
- )
976
+ return OicanaError::Export.new(
977
+ readString()
978
+ )
773
979
  end
774
980
  if variant == 6
775
- return OicanaError::NotFound.new(
776
- readString()
777
- )
981
+ return OicanaError::NotFound.new(
982
+ readString()
983
+ )
778
984
  end
779
985
  if variant == 7
780
- return OicanaError::Internal.new(
781
- readString()
782
- )
986
+ return OicanaError::Internal.new(
987
+ readString()
988
+ )
783
989
  end
784
990
 
785
991
  raise InternalError, 'Unexpected variant tag for TypeOicanaError'
@@ -828,6 +1034,20 @@ class RustBufferStream
828
1034
  end
829
1035
  end
830
1036
 
1037
+ # The Optional<T> type for TypeSourceLocation.
1038
+
1039
+ def readOptionalTypeSourceLocation
1040
+ flag = unpack_from 1, 'c'
1041
+
1042
+ if flag == 0
1043
+ return nil
1044
+ elsif flag == 1
1045
+ return readTypeSourceLocation
1046
+ else
1047
+ raise InternalError, 'Unexpected flag byte for OptionalTypeSourceLocation'
1048
+ end
1049
+ end
1050
+
831
1051
  # The Optional<T> type for TypeZipLimits.
832
1052
 
833
1053
  def readOptionalTypeZipLimits
@@ -874,6 +1094,22 @@ class RustBufferStream
874
1094
  items
875
1095
  end
876
1096
 
1097
+ # The Sequence<T> type for TypeDiagnostic.
1098
+
1099
+ def readSequenceTypeDiagnostic
1100
+ count = unpack_from 4, 'l>'
1101
+
1102
+ raise InternalError, 'Unexpected negative sequence length' if count.negative?
1103
+
1104
+ items = []
1105
+
1106
+ count.times do
1107
+ items.append readTypeDiagnostic
1108
+ end
1109
+
1110
+ items
1111
+ end
1112
+
877
1113
  # The Sequence<T> type for TypePageSize.
878
1114
 
879
1115
  def readSequenceTypePageSize
@@ -906,6 +1142,22 @@ class RustBufferStream
906
1142
  items
907
1143
  end
908
1144
 
1145
+ # The Sequence<T> type for TypeTracePoint.
1146
+
1147
+ def readSequenceTypeTracePoint
1148
+ count = unpack_from 4, 'l>'
1149
+
1150
+ raise InternalError, 'Unexpected negative sequence length' if count.negative?
1151
+
1152
+ items = []
1153
+
1154
+ count.times do
1155
+ items.append readTypeTracePoint
1156
+ end
1157
+
1158
+ items
1159
+ end
1160
+
909
1161
  # The Map<T> type for string.
910
1162
 
911
1163
  def readMapStringString
@@ -978,6 +1230,11 @@ class RustBufferBuilder
978
1230
  end
979
1231
  end
980
1232
 
1233
+ def write_U32(v)
1234
+ v = OicanaUniffi::uniffi_in_range(v, "u32", 0, 2**32)
1235
+ pack_into(4, 'L>', v)
1236
+ end
1237
+
981
1238
  def write_U64(v)
982
1239
  v = OicanaUniffi::uniffi_in_range(v, "u64", 0, 2**64)
983
1240
  pack_into(8, 'Q>', v)
@@ -1028,11 +1285,22 @@ class RustBufferBuilder
1028
1285
  self.write_String(v.metadata)
1029
1286
  end
1030
1287
 
1288
+ # The Record type Diagnostic.
1289
+
1290
+ def write_TypeDiagnostic(v)
1291
+ self.write_TypeDiagnosticSeverity(v.severity)
1292
+ self.write_String(v.message)
1293
+ self.write_OptionalTypeSourceLocation(v.location)
1294
+ self.write_Sequencestring(v.hints)
1295
+ self.write_SequenceTypeTracePoint(v.trace)
1296
+ self.write_String(v.formatted)
1297
+ end
1298
+
1031
1299
  # The Record type ExportOnceResult.
1032
1300
 
1033
1301
  def write_TypeExportOnceResult(v)
1034
1302
  self.write_Bytes(v.bytes)
1035
- self.write_Optionalstring(v.warnings)
1303
+ self.write_SequenceTypeDiagnostic(v.warnings)
1036
1304
  end
1037
1305
 
1038
1306
  # The Record type PageRange.
@@ -1056,6 +1324,23 @@ class RustBufferBuilder
1056
1324
  self.write_Optionalstring(v.path)
1057
1325
  end
1058
1326
 
1327
+ # The Record type SourceLocation.
1328
+
1329
+ def write_TypeSourceLocation(v)
1330
+ self.write_String(v.file)
1331
+ self.write_U32(v.line)
1332
+ self.write_U32(v.column)
1333
+ self.write_U32(v.end_line)
1334
+ self.write_U32(v.end_column)
1335
+ end
1336
+
1337
+ # The Record type TracePoint.
1338
+
1339
+ def write_TypeTracePoint(v)
1340
+ self.write_String(v.message)
1341
+ self.write_OptionalTypeSourceLocation(v.location)
1342
+ end
1343
+
1059
1344
  # The Record type ZipLimits.
1060
1345
 
1061
1346
  def write_TypeZipLimits(v)
@@ -1077,6 +1362,13 @@ class RustBufferBuilder
1077
1362
  end
1078
1363
 
1079
1364
 
1365
+ # The Enum type DiagnosticSeverity.
1366
+
1367
+ def write_TypeDiagnosticSeverity(v)
1368
+ pack_into(4, 'l>', v)
1369
+ end
1370
+
1371
+
1080
1372
  # The Enum type ExportFormat.
1081
1373
 
1082
1374
  def write_TypeExportFormat(v)
@@ -1128,6 +1420,17 @@ class RustBufferBuilder
1128
1420
  end
1129
1421
  end
1130
1422
 
1423
+ # The Optional<T> type for TypeSourceLocation.
1424
+
1425
+ def write_OptionalTypeSourceLocation(v)
1426
+ if v.nil?
1427
+ pack_into(1, 'c', 0)
1428
+ else
1429
+ pack_into(1, 'c', 1)
1430
+ self.write_TypeSourceLocation(v)
1431
+ end
1432
+ end
1433
+
1131
1434
  # The Optional<T> type for TypeZipLimits.
1132
1435
 
1133
1436
  def write_OptionalTypeZipLimits(v)
@@ -1159,6 +1462,16 @@ class RustBufferBuilder
1159
1462
  end
1160
1463
  end
1161
1464
 
1465
+ # The Sequence<T> type for TypeDiagnostic.
1466
+
1467
+ def write_SequenceTypeDiagnostic(items)
1468
+ pack_into(4, 'l>', items.size)
1469
+
1470
+ items.each do |item|
1471
+ self.write_TypeDiagnostic(item)
1472
+ end
1473
+ end
1474
+
1162
1475
  # The Sequence<T> type for TypePageSize.
1163
1476
 
1164
1477
  def write_SequenceTypePageSize(items)
@@ -1179,6 +1492,16 @@ class RustBufferBuilder
1179
1492
  end
1180
1493
  end
1181
1494
 
1495
+ # The Sequence<T> type for TypeTracePoint.
1496
+
1497
+ def write_SequenceTypeTracePoint(items)
1498
+ pack_into(4, 'l>', items.size)
1499
+
1500
+ items.each do |item|
1501
+ self.write_TypeTracePoint(item)
1502
+ end
1503
+ end
1504
+
1182
1505
  # The Map<T> type for string.
1183
1506
 
1184
1507
  def write_MapStringString(items)
@@ -1244,14 +1567,98 @@ CALL_ERROR = 1
1244
1567
  CALL_PANIC = 2
1245
1568
 
1246
1569
 
1247
- class OicanaError
1248
- InvalidTemplate = Class.new StandardError
1249
- InvalidInput = Class.new StandardError
1250
- Compilation = Class.new StandardError
1251
- FileNotFound = Class.new StandardError
1252
- Export = Class.new StandardError
1253
- NotFound = Class.new StandardError
1254
- Internal = Class.new StandardError
1570
+ module OicanaError
1571
+ class InvalidTemplate < StandardError
1572
+ def initialize(message)
1573
+ @message = message
1574
+ super()
1575
+ end
1576
+
1577
+ attr_reader :message
1578
+
1579
+
1580
+ def to_s
1581
+ "#{self.class.name}(message=#{@message.inspect})"
1582
+ end
1583
+ end
1584
+ class InvalidInput < StandardError
1585
+ def initialize(message)
1586
+ @message = message
1587
+ super()
1588
+ end
1589
+
1590
+ attr_reader :message
1591
+
1592
+
1593
+ def to_s
1594
+ "#{self.class.name}(message=#{@message.inspect})"
1595
+ end
1596
+ end
1597
+ class Compilation < StandardError
1598
+ def initialize(message)
1599
+ @message = message
1600
+ super()
1601
+ end
1602
+
1603
+ attr_reader :message
1604
+
1605
+
1606
+ def to_s
1607
+ "#{self.class.name}(message=#{@message.inspect})"
1608
+ end
1609
+ end
1610
+ class FileNotFound < StandardError
1611
+ def initialize(message)
1612
+ @message = message
1613
+ super()
1614
+ end
1615
+
1616
+ attr_reader :message
1617
+
1618
+
1619
+ def to_s
1620
+ "#{self.class.name}(message=#{@message.inspect})"
1621
+ end
1622
+ end
1623
+ class Export < StandardError
1624
+ def initialize(message)
1625
+ @message = message
1626
+ super()
1627
+ end
1628
+
1629
+ attr_reader :message
1630
+
1631
+
1632
+ def to_s
1633
+ "#{self.class.name}(message=#{@message.inspect})"
1634
+ end
1635
+ end
1636
+ class NotFound < StandardError
1637
+ def initialize(message)
1638
+ @message = message
1639
+ super()
1640
+ end
1641
+
1642
+ attr_reader :message
1643
+
1644
+
1645
+ def to_s
1646
+ "#{self.class.name}(message=#{@message.inspect})"
1647
+ end
1648
+ end
1649
+ class Internal < StandardError
1650
+ def initialize(message)
1651
+ @message = message
1652
+ super()
1653
+ end
1654
+
1655
+ attr_reader :message
1656
+
1657
+
1658
+ def to_s
1659
+ "#{self.class.name}(message=#{@message.inspect})"
1660
+ end
1661
+ end
1255
1662
 
1256
1663
  end
1257
1664
 
@@ -1259,6 +1666,7 @@ end
1259
1666
 
1260
1667
 
1261
1668
 
1669
+
1262
1670
  # Map error modules to the RustBuffer method name that reads them
1263
1671
  ERROR_MODULE_TO_READER_METHOD = {
1264
1672
 
@@ -1267,6 +1675,7 @@ ERROR_MODULE_TO_READER_METHOD = {
1267
1675
 
1268
1676
 
1269
1677
 
1678
+
1270
1679
  }
1271
1680
 
1272
1681
  private_constant :ERROR_MODULE_TO_READER_METHOD, :CALL_SUCCESS, :CALL_ERROR, :CALL_PANIC,
@@ -1509,6 +1918,17 @@ end
1509
1918
 
1510
1919
 
1511
1920
 
1921
+ class DiagnosticSeverity
1922
+ ERROR = 1
1923
+ WARNING = 2
1924
+
1925
+ end
1926
+
1927
+
1928
+
1929
+
1930
+
1931
+
1512
1932
  class ExportFormat
1513
1933
  def initialize
1514
1934
  raise RuntimeError, 'ExportFormat cannot be instantiated directly'
@@ -1652,6 +2072,43 @@ class BlobInput
1652
2072
  end
1653
2073
  end
1654
2074
 
2075
+ # Record type Diagnostic
2076
+ class Diagnostic
2077
+ attr_reader :severity, :message, :location, :hints, :trace, :formatted
2078
+
2079
+ def initialize(severity:, message:, location:, hints:, trace:, formatted:)
2080
+ @severity = severity
2081
+ @message = message
2082
+ @location = location
2083
+ @hints = hints
2084
+ @trace = trace
2085
+ @formatted = formatted
2086
+ end
2087
+
2088
+ def ==(other)
2089
+ if @severity != other.severity
2090
+ return false
2091
+ end
2092
+ if @message != other.message
2093
+ return false
2094
+ end
2095
+ if @location != other.location
2096
+ return false
2097
+ end
2098
+ if @hints != other.hints
2099
+ return false
2100
+ end
2101
+ if @trace != other.trace
2102
+ return false
2103
+ end
2104
+ if @formatted != other.formatted
2105
+ return false
2106
+ end
2107
+
2108
+ true
2109
+ end
2110
+ end
2111
+
1655
2112
  # Record type ExportOnceResult
1656
2113
  class ExportOnceResult
1657
2114
  attr_reader :bytes, :warnings
@@ -1736,6 +2193,60 @@ class RegisteredFont
1736
2193
  end
1737
2194
  end
1738
2195
 
2196
+ # Record type SourceLocation
2197
+ class SourceLocation
2198
+ attr_reader :file, :line, :column, :end_line, :end_column
2199
+
2200
+ def initialize(file:, line:, column:, end_line:, end_column:)
2201
+ @file = file
2202
+ @line = line
2203
+ @column = column
2204
+ @end_line = end_line
2205
+ @end_column = end_column
2206
+ end
2207
+
2208
+ def ==(other)
2209
+ if @file != other.file
2210
+ return false
2211
+ end
2212
+ if @line != other.line
2213
+ return false
2214
+ end
2215
+ if @column != other.column
2216
+ return false
2217
+ end
2218
+ if @end_line != other.end_line
2219
+ return false
2220
+ end
2221
+ if @end_column != other.end_column
2222
+ return false
2223
+ end
2224
+
2225
+ true
2226
+ end
2227
+ end
2228
+
2229
+ # Record type TracePoint
2230
+ class TracePoint
2231
+ attr_reader :message, :location
2232
+
2233
+ def initialize(message:, location:)
2234
+ @message = message
2235
+ @location = location
2236
+ end
2237
+
2238
+ def ==(other)
2239
+ if @message != other.message
2240
+ return false
2241
+ end
2242
+ if @location != other.location
2243
+ return false
2244
+ end
2245
+
2246
+ true
2247
+ end
2248
+ end
2249
+
1739
2250
  # Record type ZipLimits
1740
2251
  class ZipLimits
1741
2252
  attr_reader :max_entries, :max_total_decompressed_bytes
@@ -1929,7 +2440,7 @@ end
1929
2440
  end
1930
2441
  def warnings()
1931
2442
  result = OicanaUniffi.rust_call(:uniffi_oicana_uniffi_fn_method_compileddocument_warnings,uniffi_clone_handle(),)
1932
- return result.consumeIntoOptionalstring
2443
+ return result.consumeIntoSequenceTypeDiagnostic
1933
2444
  end
1934
2445
 
1935
2446
  end
@@ -2028,7 +2539,7 @@ end
2028
2539
  end
2029
2540
  def warnings()
2030
2541
  result = OicanaUniffi.rust_call(:uniffi_oicana_uniffi_fn_method_template_warnings,uniffi_clone_handle(),)
2031
- return result.consumeIntoOptionalstring
2542
+ return result.consumeIntoSequenceTypeDiagnostic
2032
2543
  end
2033
2544
 
2034
2545
  end
@@ -57,7 +57,7 @@ module Oicana
57
57
  # pdf = template.export_pdf(json_inputs: { "invoice" => { "number" => "2026-001" } })
58
58
  # end
59
59
  class Template
60
- # Warnings of the warm-up compilation, or nil.
60
+ # Diagnostic values for the warnings of the warm-up compilation.
61
61
  attr_reader :warnings
62
62
 
63
63
  # Load a packed template and compile it once to warm up its caches.
@@ -69,7 +69,7 @@ module Oicana
69
69
  OicanaUniffi::Template.new(template.b, Convert.json_inputs(json_inputs), Convert.blob_inputs(blob_inputs),
70
70
  Convert.mode(mode), Convert.limits(limits))
71
71
  end
72
- @warnings = object.warnings
72
+ @warnings = Convert.diagnostics(object.warnings)
73
73
  @handle = NativeHandle.new(object, :uniffi_oicana_uniffi_fn_free_template, "template")
74
74
  end
75
75
 
@@ -96,7 +96,7 @@ module Oicana
96
96
  Convert.mode(mode), Convert.format(format, pixels_per_pt), Convert.pages(pages),
97
97
  Convert.limits(limits))
98
98
  end
99
- ExportOnceResult.new(document: result.bytes, warnings: result.warnings)
99
+ ExportOnceResult.new(document: result.bytes, warnings: Convert.diagnostics(result.warnings))
100
100
  end
101
101
 
102
102
  # Compile the template into a CompiledDocument whose pages can be exported repeatedly.
@@ -168,13 +168,13 @@ module Oicana
168
168
  class CompiledDocument
169
169
  # PageSize of every page, in document order.
170
170
  attr_reader :pages
171
- # Warnings of the compilation, or nil.
171
+ # Diagnostic values for the warnings of the compilation.
172
172
  attr_reader :warnings
173
173
 
174
174
  # @api private
175
175
  def initialize(object)
176
176
  @pages = object.pages.map { |page| PageSize.new(width: page.width, height: page.height) }.freeze
177
- @warnings = object.warnings
177
+ @warnings = Convert.diagnostics(object.warnings)
178
178
  @handle = NativeHandle.new(object, :uniffi_oicana_uniffi_fn_free_compileddocument, "document")
179
179
  end
180
180
 
data/lib/oicana/types.rb CHANGED
@@ -24,9 +24,30 @@ module Oicana
24
24
  # A font face registered by the host. path is nil for fonts registered from memory.
25
25
  RegisteredFont = Data.define(:family, :path)
26
26
 
27
- # The result of Template.export_once. warnings is nil when there are none.
27
+ # The result of Template.export_once. warnings is an Array of Diagnostic values.
28
28
  ExportOnceResult = Data.define(:document, :warnings)
29
29
 
30
+ # A compilation diagnostic, like a warning, with its location in the template.
31
+ #
32
+ # severity is :error or :warning. location is a SourceLocation, or nil if the
33
+ # diagnostic does not point into a file. hints is an Array of Strings and trace an
34
+ # Array of TracePoint values, innermost first. formatted is the diagnostic formatted
35
+ # for humans, with source excerpts and the configured diagnostic color.
36
+ Diagnostic = Data.define(:severity, :message, :location, :hints, :trace, :formatted) do
37
+ def to_s
38
+ formatted
39
+ end
40
+ end
41
+
42
+ # A range in a file of the template. Lines and columns are 1-based, columns count
43
+ # characters, and end_column is exclusive. file is the path in the template, like
44
+ # "/main.typ"; files of packages are prefixed with the package.
45
+ SourceLocation = Data.define(:file, :line, :column, :end_line, :end_column)
46
+
47
+ # A step in the function calls leading to a Diagnostic. location is nil if the step
48
+ # does not point into a file.
49
+ TracePoint = Data.define(:message, :location)
50
+
30
51
  # A template's manifest.
31
52
  Manifest = Data.define(:package, :oicana)
32
53
 
@@ -155,5 +176,27 @@ module Oicana
155
176
  def blob_fallback(fallback)
156
177
  fallback && BlobFallback.new(file: fallback.fetch("file"), meta: fallback["meta"])
157
178
  end
179
+
180
+ def diagnostics(diagnostics)
181
+ diagnostics.map do |diagnostic|
182
+ Diagnostic.new(
183
+ severity: diagnostic.severity == OicanaUniffi::DiagnosticSeverity::ERROR ? :error : :warning,
184
+ message: diagnostic.message,
185
+ location: location(diagnostic.location),
186
+ hints: diagnostic.hints.freeze,
187
+ trace: diagnostic.trace.map { |point| trace_point(point) }.freeze,
188
+ formatted: diagnostic.formatted
189
+ )
190
+ end.freeze
191
+ end
192
+
193
+ def trace_point(point)
194
+ TracePoint.new(message: point.message, location: location(point.location))
195
+ end
196
+
197
+ def location(location)
198
+ location && SourceLocation.new(file: location.file, line: location.line, column: location.column,
199
+ end_line: location.end_line, end_column: location.end_column)
200
+ end
158
201
  end
159
202
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Oicana
4
- VERSION = "0.10.0.rc.1"
4
+ VERSION = "0.10.0.rc.3"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oicana
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0.rc.1
4
+ version: 0.10.0.rc.3
5
5
  platform: aarch64-linux-gnu
6
6
  authors:
7
7
  - Oicana