Compare commits

..
Author SHA1 Message Date
Anshul Nigham e38e7aa00c Removing _LIBCPP_DISABLE_UNUSED_STRUCT_WARNINGS from libc++ enables
`[[gnu::__warn_unused__]]` on standard library types (such as
`std::string` and `std::set`), surfacing `-Wunused-variable` warnings
in `//third_party/flatbuffers`. See [upstream LLVM commit](https://github.com/llvm/llvm-project/commit/ab8b037ef7b398aa864959a69f328fa69b567f74) for reference.

Remove unreferenced variable declarations across the code generators and
binary annotator whose initializers have no observable side effects.

PiperOrigin-RevId: 999136370
2026-10-26 16:02:57 -07:00
11 changed files with 78 additions and 107 deletions
-1
View File
@@ -504,7 +504,6 @@ grpc::string GenerateInterface(grpc_generator::File* file,
const grpc::string& filename) {
grpc::string output;
std::set<grpc::string> generated_functions;
std::map<grpc::string, grpc::string> vars;
vars["PATH"] = file->package();
+77 -83
View File
@@ -16,22 +16,22 @@ importers:
version: 24.0.3
'@typescript-eslint/eslint-plugin':
specifier: ^8.34.1
version: 8.34.1(@typescript-eslint/parser@8.34.1(eslint@9.29.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.8.3))(eslint@9.29.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.8.3)
version: 8.34.1(@typescript-eslint/parser@8.34.1(eslint@9.29.0)(typescript@5.8.3))(eslint@9.29.0)(typescript@5.8.3)
'@typescript-eslint/parser':
specifier: ^8.34.1
version: 8.34.1(eslint@9.29.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.8.3)
version: 8.34.1(eslint@9.29.0)(typescript@5.8.3)
esbuild:
specifier: ^0.25.5
version: 0.25.5
eslint:
specifier: ^9.29.0
version: 9.29.0(supports-color@7.2.0)
version: 9.29.0
typescript:
specifier: 5.8.3
version: 5.8.3
typescript-eslint:
specifier: ^8.34.1
version: 8.34.1(eslint@9.29.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.8.3)
version: 8.34.1(eslint@9.29.0)(typescript@5.8.3)
tests/ts:
dependencies:
@@ -239,22 +239,22 @@ packages:
resolution: {integrity: sha512-Z5kJ+wU3oA7MMIqVR9tyZRtjYPr4OC004Q4Rw7pgOKUOKkJfZ3O24nz3WYfGRpMDNmcOi3TwQOmgm7B7Tpii0w==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
'@humanfs/core@0.19.2':
resolution: {integrity: sha512-UhXNm+CFMWcbChXywFwkmhqjs3PRCmcSa/hfBgLIb7oQ5HNb1wS0icWsGtSAUNgefHeI+eBrA8I1fxmbHsGdvA==}
'@humanfs/core@0.19.1':
resolution: {integrity: sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==}
engines: {node: '>=18.18.0'}
'@humanfs/node@0.16.8':
resolution: {integrity: sha512-gE1eQNZ3R++kTzFUpdGlpmy8kDZD/MLyHqDwqjkVQI0JMdI1D51sy1H958PNXYkM2rAac7e5/CnIKZrHtPh3BQ==}
engines: {node: '>=18.18.0'}
'@humanfs/types@0.15.0':
resolution: {integrity: sha512-ZZ1w0aoQkwuUuC7Yf+7sdeaNfqQiiLcSRbfI08oAxqLtpXQr9AIVX7Ay7HLDuiLYAaFPu8oBYNq/QIi9URHJ3Q==}
'@humanfs/node@0.16.6':
resolution: {integrity: sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw==}
engines: {node: '>=18.18.0'}
'@humanwhocodes/module-importer@1.0.1':
resolution: {integrity: sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==}
engines: {node: '>=12.22'}
'@humanwhocodes/retry@0.3.1':
resolution: {integrity: sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==}
engines: {node: '>=18.18'}
'@humanwhocodes/retry@0.4.3':
resolution: {integrity: sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==}
engines: {node: '>=18.18'}
@@ -362,11 +362,11 @@ packages:
balanced-match@1.0.2:
resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==}
brace-expansion@1.1.21:
resolution: {integrity: sha512-9zeA+KLZNNzglF2TPKRQEDyx6Yby7daAkuy8MiPzpXPsYDWi/DRM8jmwUDxokQjYqBpv5DgPiwD4h4ZZSy1Ujw==}
brace-expansion@1.1.12:
resolution: {integrity: sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==}
brace-expansion@2.1.7:
resolution: {integrity: sha512-uZbew1NqdmPDTMJ8ah1y+b+9QEJrfkXFk3RcTQw3X0jW/xRUvFKsg1CfQdSYGdTbXZWExtU3J3ccxtnfw1Fi0g==}
brace-expansion@2.0.2:
resolution: {integrity: sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==}
braces@3.0.3:
resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==}
@@ -430,7 +430,6 @@ packages:
eslint@9.29.0:
resolution: {integrity: sha512-GsGizj2Y1rCWDu6XoEekL3RLilp0voSePurjZIkxL3wlm5o5EC9VpgaP7lrCvjnkuLvzFBQWB3vWB3K5KQTveQ==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
deprecated: This version is no longer supported. Please see https://eslint.org/version-support for other options.
hasBin: true
peerDependencies:
jiti: '*'
@@ -543,8 +542,8 @@ packages:
isexe@2.0.0:
resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==}
js-yaml@4.3.2:
resolution: {integrity: sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==}
js-yaml@4.1.1:
resolution: {integrity: sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==}
hasBin: true
json-buffer@3.0.1:
@@ -615,8 +614,8 @@ packages:
resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==}
engines: {node: '>=8'}
picomatch@2.3.2:
resolution: {integrity: sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==}
picomatch@2.3.1:
resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==}
engines: {node: '>=8.6'}
prelude-ls@1.2.1:
@@ -784,22 +783,22 @@ snapshots:
'@esbuild/win32-x64@0.25.5':
optional: true
'@eslint-community/eslint-utils@4.4.0(eslint@9.29.0(supports-color@7.2.0))':
'@eslint-community/eslint-utils@4.4.0(eslint@9.29.0)':
dependencies:
eslint: 9.29.0(supports-color@7.2.0)
eslint: 9.29.0
eslint-visitor-keys: 3.4.3
'@eslint-community/eslint-utils@4.7.0(eslint@9.29.0(supports-color@7.2.0))':
'@eslint-community/eslint-utils@4.7.0(eslint@9.29.0)':
dependencies:
eslint: 9.29.0(supports-color@7.2.0)
eslint: 9.29.0
eslint-visitor-keys: 3.4.3
'@eslint-community/regexpp@4.12.1': {}
'@eslint/config-array@0.20.1(supports-color@7.2.0)':
'@eslint/config-array@0.20.1':
dependencies:
'@eslint/object-schema': 2.1.6
debug: 4.3.7(supports-color@7.2.0)
debug: 4.3.7
minimatch: 3.1.5
transitivePeerDependencies:
- supports-color
@@ -814,15 +813,15 @@ snapshots:
dependencies:
'@types/json-schema': 7.0.15
'@eslint/eslintrc@3.3.1(supports-color@7.2.0)':
'@eslint/eslintrc@3.3.1':
dependencies:
ajv: 6.14.0
debug: 4.3.7(supports-color@7.2.0)
debug: 4.3.7
espree: 10.4.0
globals: 14.0.0
ignore: 5.3.2
import-fresh: 3.3.0
js-yaml: 4.3.2
js-yaml: 4.1.1
minimatch: 3.1.5
strip-json-comments: 3.1.1
transitivePeerDependencies:
@@ -837,20 +836,17 @@ snapshots:
'@eslint/core': 0.15.2
levn: 0.4.1
'@humanfs/core@0.19.2':
dependencies:
'@humanfs/types': 0.15.0
'@humanfs/core@0.19.1': {}
'@humanfs/node@0.16.8':
'@humanfs/node@0.16.6':
dependencies:
'@humanfs/core': 0.19.2
'@humanfs/types': 0.15.0
'@humanwhocodes/retry': 0.4.3
'@humanfs/types@0.15.0': {}
'@humanfs/core': 0.19.1
'@humanwhocodes/retry': 0.3.1
'@humanwhocodes/module-importer@1.0.1': {}
'@humanwhocodes/retry@0.3.1': {}
'@humanwhocodes/retry@0.4.3': {}
'@nodelib/fs.scandir@2.1.5':
@@ -873,15 +869,15 @@ snapshots:
dependencies:
undici-types: 7.8.0
'@typescript-eslint/eslint-plugin@8.34.1(@typescript-eslint/parser@8.34.1(eslint@9.29.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.8.3))(eslint@9.29.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.8.3)':
'@typescript-eslint/eslint-plugin@8.34.1(@typescript-eslint/parser@8.34.1(eslint@9.29.0)(typescript@5.8.3))(eslint@9.29.0)(typescript@5.8.3)':
dependencies:
'@eslint-community/regexpp': 4.12.1
'@typescript-eslint/parser': 8.34.1(eslint@9.29.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.8.3)
'@typescript-eslint/parser': 8.34.1(eslint@9.29.0)(typescript@5.8.3)
'@typescript-eslint/scope-manager': 8.34.1
'@typescript-eslint/type-utils': 8.34.1(eslint@9.29.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.8.3)
'@typescript-eslint/utils': 8.34.1(eslint@9.29.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.8.3)
'@typescript-eslint/type-utils': 8.34.1(eslint@9.29.0)(typescript@5.8.3)
'@typescript-eslint/utils': 8.34.1(eslint@9.29.0)(typescript@5.8.3)
'@typescript-eslint/visitor-keys': 8.34.1
eslint: 9.29.0(supports-color@7.2.0)
eslint: 9.29.0
graphemer: 1.4.0
ignore: 7.0.5
natural-compare: 1.4.0
@@ -890,23 +886,23 @@ snapshots:
transitivePeerDependencies:
- supports-color
'@typescript-eslint/parser@8.34.1(eslint@9.29.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.8.3)':
'@typescript-eslint/parser@8.34.1(eslint@9.29.0)(typescript@5.8.3)':
dependencies:
'@typescript-eslint/scope-manager': 8.34.1
'@typescript-eslint/types': 8.34.1
'@typescript-eslint/typescript-estree': 8.34.1(supports-color@7.2.0)(typescript@5.8.3)
'@typescript-eslint/typescript-estree': 8.34.1(typescript@5.8.3)
'@typescript-eslint/visitor-keys': 8.34.1
debug: 4.3.7(supports-color@7.2.0)
eslint: 9.29.0(supports-color@7.2.0)
debug: 4.3.7
eslint: 9.29.0
typescript: 5.8.3
transitivePeerDependencies:
- supports-color
'@typescript-eslint/project-service@8.34.1(supports-color@7.2.0)(typescript@5.8.3)':
'@typescript-eslint/project-service@8.34.1(typescript@5.8.3)':
dependencies:
'@typescript-eslint/tsconfig-utils': 8.34.1(typescript@5.8.3)
'@typescript-eslint/types': 8.34.1
debug: 4.3.7(supports-color@7.2.0)
debug: 4.3.7
typescript: 5.8.3
transitivePeerDependencies:
- supports-color
@@ -920,12 +916,12 @@ snapshots:
dependencies:
typescript: 5.8.3
'@typescript-eslint/type-utils@8.34.1(eslint@9.29.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.8.3)':
'@typescript-eslint/type-utils@8.34.1(eslint@9.29.0)(typescript@5.8.3)':
dependencies:
'@typescript-eslint/typescript-estree': 8.34.1(supports-color@7.2.0)(typescript@5.8.3)
'@typescript-eslint/utils': 8.34.1(eslint@9.29.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.8.3)
debug: 4.3.7(supports-color@7.2.0)
eslint: 9.29.0(supports-color@7.2.0)
'@typescript-eslint/typescript-estree': 8.34.1(typescript@5.8.3)
'@typescript-eslint/utils': 8.34.1(eslint@9.29.0)(typescript@5.8.3)
debug: 4.3.7
eslint: 9.29.0
ts-api-utils: 2.1.0(typescript@5.8.3)
typescript: 5.8.3
transitivePeerDependencies:
@@ -933,13 +929,13 @@ snapshots:
'@typescript-eslint/types@8.34.1': {}
'@typescript-eslint/typescript-estree@8.34.1(supports-color@7.2.0)(typescript@5.8.3)':
'@typescript-eslint/typescript-estree@8.34.1(typescript@5.8.3)':
dependencies:
'@typescript-eslint/project-service': 8.34.1(supports-color@7.2.0)(typescript@5.8.3)
'@typescript-eslint/project-service': 8.34.1(typescript@5.8.3)
'@typescript-eslint/tsconfig-utils': 8.34.1(typescript@5.8.3)
'@typescript-eslint/types': 8.34.1
'@typescript-eslint/visitor-keys': 8.34.1
debug: 4.3.7(supports-color@7.2.0)
debug: 4.3.7
fast-glob: 3.3.2
is-glob: 4.0.3
minimatch: 9.0.9
@@ -949,13 +945,13 @@ snapshots:
transitivePeerDependencies:
- supports-color
'@typescript-eslint/utils@8.34.1(eslint@9.29.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.8.3)':
'@typescript-eslint/utils@8.34.1(eslint@9.29.0)(typescript@5.8.3)':
dependencies:
'@eslint-community/eslint-utils': 4.7.0(eslint@9.29.0(supports-color@7.2.0))
'@eslint-community/eslint-utils': 4.7.0(eslint@9.29.0)
'@typescript-eslint/scope-manager': 8.34.1
'@typescript-eslint/types': 8.34.1
'@typescript-eslint/typescript-estree': 8.34.1(supports-color@7.2.0)(typescript@5.8.3)
eslint: 9.29.0(supports-color@7.2.0)
'@typescript-eslint/typescript-estree': 8.34.1(typescript@5.8.3)
eslint: 9.29.0
typescript: 5.8.3
transitivePeerDependencies:
- supports-color
@@ -986,12 +982,12 @@ snapshots:
balanced-match@1.0.2: {}
brace-expansion@1.1.21:
brace-expansion@1.1.12:
dependencies:
balanced-match: 1.0.2
concat-map: 0.0.1
brace-expansion@2.1.7:
brace-expansion@2.0.2:
dependencies:
balanced-match: 1.0.2
@@ -1020,11 +1016,9 @@ snapshots:
shebang-command: 2.0.0
which: 2.0.2
debug@4.3.7(supports-color@7.2.0):
debug@4.3.7:
dependencies:
ms: 2.1.3
optionalDependencies:
supports-color: 7.2.0
deep-is@0.1.4: {}
@@ -1067,17 +1061,17 @@ snapshots:
eslint-visitor-keys@4.2.1: {}
eslint@9.29.0(supports-color@7.2.0):
eslint@9.29.0:
dependencies:
'@eslint-community/eslint-utils': 4.4.0(eslint@9.29.0(supports-color@7.2.0))
'@eslint-community/eslint-utils': 4.4.0(eslint@9.29.0)
'@eslint-community/regexpp': 4.12.1
'@eslint/config-array': 0.20.1(supports-color@7.2.0)
'@eslint/config-array': 0.20.1
'@eslint/config-helpers': 0.2.3
'@eslint/core': 0.14.0
'@eslint/eslintrc': 3.3.1(supports-color@7.2.0)
'@eslint/eslintrc': 3.3.1
'@eslint/js': 9.29.0
'@eslint/plugin-kit': 0.3.5
'@humanfs/node': 0.16.8
'@humanfs/node': 0.16.6
'@humanwhocodes/module-importer': 1.0.1
'@humanwhocodes/retry': 0.4.3
'@types/estree': 1.0.8
@@ -1085,7 +1079,7 @@ snapshots:
ajv: 6.14.0
chalk: 4.1.2
cross-spawn: 7.0.6
debug: 4.3.7(supports-color@7.2.0)
debug: 4.3.7
escape-string-regexp: 4.0.0
eslint-scope: 8.4.0
eslint-visitor-keys: 4.2.1
@@ -1198,7 +1192,7 @@ snapshots:
isexe@2.0.0: {}
js-yaml@4.3.2:
js-yaml@4.1.1:
dependencies:
argparse: 2.0.1
@@ -1228,15 +1222,15 @@ snapshots:
micromatch@4.0.8:
dependencies:
braces: 3.0.3
picomatch: 2.3.2
picomatch: 2.3.1
minimatch@3.1.5:
dependencies:
brace-expansion: 1.1.21
brace-expansion: 1.1.12
minimatch@9.0.9:
dependencies:
brace-expansion: 2.1.7
brace-expansion: 2.0.2
ms@2.1.3: {}
@@ -1267,7 +1261,7 @@ snapshots:
path-key@3.1.1: {}
picomatch@2.3.2: {}
picomatch@2.3.1: {}
prelude-ls@1.2.1: {}
@@ -1309,12 +1303,12 @@ snapshots:
dependencies:
prelude-ls: 1.2.1
typescript-eslint@8.34.1(eslint@9.29.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.8.3):
typescript-eslint@8.34.1(eslint@9.29.0)(typescript@5.8.3):
dependencies:
'@typescript-eslint/eslint-plugin': 8.34.1(@typescript-eslint/parser@8.34.1(eslint@9.29.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.8.3))(eslint@9.29.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.8.3)
'@typescript-eslint/parser': 8.34.1(eslint@9.29.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.8.3)
'@typescript-eslint/utils': 8.34.1(eslint@9.29.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.8.3)
eslint: 9.29.0(supports-color@7.2.0)
'@typescript-eslint/eslint-plugin': 8.34.1(@typescript-eslint/parser@8.34.1(eslint@9.29.0)(typescript@5.8.3))(eslint@9.29.0)(typescript@5.8.3)
'@typescript-eslint/parser': 8.34.1(eslint@9.29.0)(typescript@5.8.3)
'@typescript-eslint/utils': 8.34.1(eslint@9.29.0)(typescript@5.8.3)
eslint: 9.29.0
typescript: 5.8.3
transitivePeerDependencies:
- supports-color
-2
View File
@@ -722,8 +722,6 @@ void BinaryAnnotator::BuildTable(const uint64_t table_offset,
BinaryRegionComment offset_field_comment;
offset_field_comment.type = BinaryRegionCommentType::TableOffsetField;
offset_field_comment.name = field->name()->c_str();
const std::string offset_prefix =
"offset to field `" + std::string(field->name()->c_str()) + "`";
// Validate any field that isn't inline (i.e., non-structs).
if (!IsInlineField(field)) {
-2
View File
@@ -2737,7 +2737,6 @@ class CppGenerator : public BaseGenerator {
if (!field.IsScalarOptional()) {
const bool is_scalar = IsScalar(type.base_type);
std::string accessor;
std::string offset_size = "";
if (is_scalar) {
accessor = "GetField<";
} else if (IsStruct(type)) {
@@ -2815,7 +2814,6 @@ class CppGenerator : public BaseGenerator {
void GenTableFieldType(const FieldDef& field) {
const auto& type = field.value.type;
const auto offset_str = GenFieldOffsetName(field);
if (!field.IsScalarOptional()) {
std::string afterptr = " *" + NullableExtension();
code_.SetValue("FIELD_TYPE",
-2
View File
@@ -1149,8 +1149,6 @@ static bool GenerateDart(const Parser& parser, const std::string& path,
static std::string DartMakeRule(const Parser& parser, const std::string& path,
const std::string& file_name) {
auto filebase =
flatbuffers::StripPath(flatbuffers::StripExtension(file_name));
dart::DartGenerator generator(parser, path, file_name);
auto make_rule = generator.Filename("") + ": ";
-2
View File
@@ -966,8 +966,6 @@ class KotlinGenerator : public BaseGenerator {
auto bbgetter = ByteBufferGetter(field.value.type, "bb");
auto ucast = CastToUsigned(field);
auto offset_val = NumToString(field.value.offset);
auto offset_prefix =
"val o = __offset(" + offset_val + "); return o != 0 ? ";
auto value_base_type = field.value.type.base_type;
// Most field accessors need to retrieve and test the field offset
// first, this is the offset value for that:
-5
View File
@@ -146,7 +146,6 @@ class KotlinKMPGenerator : public BaseGenerator {
std::string code =
"// " + std::string(FlatBuffersGeneratedWarning()) + "\n\n";
auto qualified = ns.GetFullyQualifiedName("");
std::string namespace_name = namer_.Namespace(ns);
if (!namespace_name.empty()) {
code += "package " + namespace_name;
@@ -341,7 +340,6 @@ class KotlinKMPGenerator : public BaseGenerator {
std::string GenDefaultBufferValue(const FieldDef& field) const {
auto& value = field.value;
auto base_type = value.type.base_type;
auto field_name = field.name;
std::string suffix = IsScalar(base_type) ? LiteralSuffix(value.type) : "";
if (field.IsScalarOptional()) {
return "null";
@@ -373,7 +371,6 @@ class KotlinKMPGenerator : public BaseGenerator {
std::string GenDefaultValue(const FieldDef& field) const {
auto& value = field.value;
auto base_type = value.type.base_type;
auto field_name = field.name;
std::string suffix = LiteralSuffix(value.type);
if (field.IsScalarOptional()) {
return "null";
@@ -1082,8 +1079,6 @@ class KotlinKMPGenerator : public BaseGenerator {
auto return_type = GetterReturnType(field);
auto bbgetter = ByteBufferGetter(field.value.type, "bb");
auto offset_val = NumToString(field.value.offset);
auto offset_prefix =
"val o = offset(" + offset_val + "); return o != 0 ? ";
auto value_base_type = field.value.type.base_type;
// Most field accessors need to retrieve and test the field offset
// first, this is the offset value for that:
-2
View File
@@ -2010,8 +2010,6 @@ class PythonGenerator : public BaseGenerator {
void InitializeFromPackedBuf(const StructDef& struct_def,
std::string* code_ptr) const {
auto& code = *code_ptr;
const auto struct_var = namer_.Variable(struct_def);
const auto struct_type = namer_.Type(struct_def);
code += GenIndents(1) + "@classmethod";
code += GenIndents(1) + "def InitFromPackedBuf(cls, buf, pos=0):";
-2
View File
@@ -787,7 +787,6 @@ class SwiftGenerator : public BaseGenerator {
}
void GenTableReaderFields(const FieldDef& field) {
const auto offset = NumToString(field.value.offset);
const auto field_field = namer_.Field(field);
const auto type = GenType(field.value.type);
code_.SetValue("FIELDVAR", namer_.Variable(field));
@@ -1382,7 +1381,6 @@ class SwiftGenerator : public BaseGenerator {
const auto& field = **it;
if (field.deprecated) continue;
const auto type = GenType(field.value.type);
code_.SetValue("FIELDVAR", namer_.Variable(field));
if (IsArray(field.value.type)) {
code_.SetValue(
-5
View File
@@ -196,7 +196,6 @@ class TsGenerator : public BaseGenerator {
SkipDir::OutputPathAndTrailingPathSeparator);
symbolic_name = definition.defined_namespace->components.back();
} else {
auto def_mod_name = namer_.File(definition, SkipFile::SuffixAndExtension);
symbolic_name = file_name_;
filepath = path_ + symbolic_name + ".ts";
}
@@ -286,12 +285,10 @@ class TsGenerator : public BaseGenerator {
auto base_name =
namer_.Directories(it.second.ns->components, SkipDir::OutputPath) +
base_file_name;
auto ts_file_path = base_name + ".ts";
auto base_name_rel = std::string("./");
base_name_rel +=
namer_.Directories(rel_components, SkipDir::OutputPath);
base_name_rel += base_file_name;
auto ts_file_path_rel = base_name_rel + ".ts";
auto type_name = def.first;
auto fully_qualified_type_name =
it.second.ns->GetFullyQualifiedName(type_name);
@@ -311,7 +308,6 @@ class TsGenerator : public BaseGenerator {
const auto child_ns_level = it.second.ns->components.size() + 1;
for (const auto& it2 : ns_defs_) {
if (it2.second.ns->components.size() != child_ns_level) continue;
auto ts_file_path = it2.second.path + ".ts";
code += "export * as " + it2.second.symbolic_name + " from './";
int count = it2.second.ns->components.size() > 1 ? 2 : 1;
std::vector<std::string> rel_path;
@@ -1176,7 +1172,6 @@ class TsGenerator : public BaseGenerator {
if (union_type.enum_def) {
const auto& enum_def = *union_type.enum_def;
const auto enum_type = AddImport(imports, dependent, enum_def).name;
const std::string union_accessor = "this." + field_name;
const auto union_has_string = UnionHasStringType(enum_def);
const auto field_binded_method = "this." + field_name + ".bind(this)";
@@ -3,6 +3,6 @@
"type": "module",
"private": true,
"devDependencies": {
"lodash": "4.18.1"
"lodash": "4.17.23"
}
}