Skip to content

Commit 2e79e23

Browse files
committed
Daco's comments
1 parent 9fe667d commit 2e79e23

File tree

4 files changed

+15
-10
lines changed

4 files changed

+15
-10
lines changed

pkgs/ffigen/lib/src/code_generator/imports.dart

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,15 @@ import 'writer.dart';
99
class LibraryImport {
1010
final String name;
1111
final String _importPath;
12-
final String? importPathWhenImportedByPackageObjC;
12+
final String? _importPathWhenImportedByPackageObjC;
13+
1314
String prefix;
1415

1516
LibraryImport(this.name, this._importPath,
16-
{this.importPathWhenImportedByPackageObjC})
17-
: prefix = name;
17+
{String? importPathWhenImportedByPackageObjC})
18+
: _importPathWhenImportedByPackageObjC =
19+
importPathWhenImportedByPackageObjC,
20+
prefix = name;
1821

1922
@override
2023
bool operator ==(other) {
@@ -24,9 +27,11 @@ class LibraryImport {
2427
@override
2528
int get hashCode => name.hashCode;
2629

30+
// The import path, which may be different if this library is being imported
31+
// into package:objective_c's generated code.
2732
String importPath(bool generateForPackageObjectiveC) {
2833
if (!generateForPackageObjectiveC) return _importPath;
29-
return importPathWhenImportedByPackageObjC ?? _importPath;
34+
return _importPathWhenImportedByPackageObjC ?? _importPath;
3035
}
3136
}
3237

pkgs/objective_c/analysis_options.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ include: package:flutter_lints/flutter.yaml
22

33
analyzer:
44
exclude:
5-
- tool/extra_methods.dart
5+
- tool/data/extra_methods.dart
66
language:
77
strict-casts: true
88
strict-inference: true

pkgs/objective_c/tool/extra_methods.dart renamed to pkgs/objective_c/tool/data/extra_methods.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
1+
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
// Extra methods inserted into NSString by generate_code.dart.
5+
// Extra methods inserted into NSString by tool/generate_code.dart.
66
class NSString extends NSObject {
77
factory NSString(String str) {
88
final cstr = str.toNativeUtf16();

pkgs/objective_c/tool/generate_code.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
// Runs the ffigen configs, then merges extra_methods.dart into the Objective C
6-
// bindings.
5+
// Runs the ffigen configs, then merges tool/data/extra_methods.dart into the
6+
// Objective C bindings.
77

88
// ignore_for_file: avoid_print
99

@@ -15,7 +15,7 @@ const cConfig = 'ffigen_c.yaml';
1515
const objcConfig = 'ffigen_objc.yaml';
1616
const cBindings = 'lib/src/c_bindings_generated.dart';
1717
const objcBindings = 'lib/src/objective_c_bindings_generated.dart';
18-
const extraMethodsFile = 'tool/extra_methods.dart';
18+
const extraMethodsFile = 'tool/data/extra_methods.dart';
1919

2020
void dartCmd(List<String> args) {
2121
final exec = Platform.resolvedExecutable;

0 commit comments

Comments
 (0)