• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

dart-lang / ffigen / 4364636722

pending completion
4364636722

Pull #527

github

GitHub
Merge 984472b2c into 1ac20ffd5
Pull Request #527: Bump dependencies and fix lints

21 of 21 new or added lines in 10 files covered. (100.0%)

3188 of 3452 relevant lines covered (92.35%)

24.67 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

85.71
/lib/src/header_parser/sub_parsers/var_parser.dart
1
// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
2
// for details. All rights reserved. Use of this source code is governed by a
3
// BSD-style license that can be found in the LICENSE file.
4

5
import 'package:ffigen/src/code_generator.dart';
6
import 'package:ffigen/src/header_parser/data.dart';
7
import 'package:ffigen/src/header_parser/includer.dart';
8
import 'package:logging/logging.dart';
9

10
import '../clang_bindings/clang_bindings.dart' as clang_types;
11
import '../utils.dart';
12

13
final _logger = Logger('ffigen.header_parser.var_parser');
12✔
14

15
/// Parses a global variable
16
Global? parseVarDeclaration(clang_types.CXCursor cursor) {
6✔
17
  final name = cursor.spelling();
6✔
18
  final usr = cursor.usr();
6✔
19
  if (bindingsIndex.isSeenGlobalVar(usr)) {
12✔
20
    return bindingsIndex.getSeenGlobalVar(usr);
×
21
  }
22
  if (!shouldIncludeGlobalVar(usr, name)) {
6✔
23
    return null;
24
  }
25

26
  _logger.fine('++++ Adding Global: ${cursor.completeStringRepr()}');
16✔
27

28
  final type = cursor.type().toCodeGenType();
8✔
29
  if (type.baseType is UnimplementedType) {
8✔
30
    _logger.fine('---- Removed Global, reason: unsupported type: '
3✔
31
        '${cursor.completeStringRepr()}');
1✔
32
    _logger.warning("Skipped global variable '$name', type not supported.");
3✔
33
    return null;
34
  }
35

36
  if (config.ffiNativeConfig.enabled) {
12✔
37
    _logger.warning(
×
38
        "Skipped global variable '$name', not supported in FfiNatives.");
×
39
    return null;
40
  }
41

42
  final global = Global(
4✔
43
    originalName: name,
44
    name: config.globals.renameUsingConfig(name),
12✔
45
    usr: usr,
46
    type: type,
47
    dartDoc: getCursorDocComment(cursor),
4✔
48
    exposeSymbolAddress: config.functionDecl.shouldIncludeSymbolAddress(name),
12✔
49
  );
50
  bindingsIndex.addGlobalVarToSeen(usr, global);
8✔
51
  return global;
52
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc