Skip to content

Commit 5736d84

Browse files
committed
Resolved Tests and Code
1 parent ad88f1f commit 5736d84

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

pkgs/swift2objc/lib/src/parser/parsers/declaration_parsers/parse_variable_declaration.dart

+5-7
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,7 @@ bool _parseVariableIsConstant(Json fragmentsJson) {
6666
}
6767

6868
bool _findKeywordInFragments(Json json, String keyword) {
69-
final keywordIsPresent =
70-
json.any((frag) => matchFragment(frag, 'keyword', keyword));
71-
return keywordIsPresent;
69+
return json.any((frag) => matchFragment(frag, 'keyword', keyword));
7270
}
7371

7472
typedef ParsedPropertyInfo = ({
@@ -81,7 +79,7 @@ typedef ParsedPropertyInfo = ({
8179
});
8280

8381
ParsedPropertyInfo parsePropertyInfo(Json json) {
84-
final (getter, setter) = _parsePropertyGetandSet(json);
82+
final (getter, setter) = _parsePropertyGetAndSet(json);
8583
return (
8684
constant: _parseVariableIsConstant(json),
8785
async: _findKeywordInFragments(json, 'async'),
@@ -92,7 +90,7 @@ ParsedPropertyInfo parsePropertyInfo(Json json) {
9290
);
9391
}
9492

95-
(bool, bool) _parsePropertyGetandSet(Json fragmentsJson, {String? path}) {
93+
(bool, bool) _parsePropertyGetAndSet(Json fragmentsJson, {String? path}) {
9694
if (fragmentsJson.any((frag) => matchFragment(frag, 'text', ' { get }'))) {
9795
// has explicit getter and no explicit setter
9896
return (true, false);
@@ -119,8 +117,8 @@ ParsedPropertyInfo parsePropertyInfo(Json json) {
119117
'Properties can not have a setter without a getter',
120118
);
121119
} else {
122-
// has no explicit getter and no explicit setter
123-
return (false, false);
120+
// has implicit getter and implicit setter
121+
return (true, true);
124122
}
125123
}
126124
}

pkgs/swift2objc/test/unit/parse_variable_info_test.dart

-6
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@ import 'package:swift2objc/src/parser/parsers/declaration_parsers/parse_variable
77
import 'package:test/test.dart';
88

99
void main() {
10-
// final parsedSymbols = {
11-
// for (final decl in builtInDeclarations)
12-
// decl.id: ParsedSymbol(json: Json(null), declaration: decl)
13-
// };
14-
// final emptySymbolgraph = ParsedSymbolgraph(parsedSymbols, {});
15-
1610
group('Variable Valid json', () {
1711
test('Variable with getter', () {
1812
final json = Json(jsonDecode('''[

0 commit comments

Comments
 (0)