[ffigen] Code cleanup (#496)
diff --git a/pkgs/ffigen/lib/src/header_parser/parser.dart b/pkgs/ffigen/lib/src/header_parser/parser.dart index b45b062..871da44 100644 --- a/pkgs/ffigen/lib/src/header_parser/parser.dart +++ b/pkgs/ffigen/lib/src/header_parser/parser.dart
@@ -56,24 +56,21 @@ final index = clang.clang_createIndex(0, 0); Pointer<Pointer<Utf8>> clangCmdArgs = nullptr; - final compilerOpts = <String>[]; + final compilerOpts = <String>[ + // Add compiler opt for comment parsing for clang based on config. + if (config.commentType.length != CommentLength.none && + config.commentType.style == CommentStyle.any) + strings.fparseAllComments, - // Add compiler opt for comment parsing for clang based on config. - if (config.commentType.length != CommentLength.none && - config.commentType.style == CommentStyle.any) { - compilerOpts.add(strings.fparseAllComments); - } - - // If the config targets Objective C, add a compiler opt for it. - if (config.language == Language.objc) { - compilerOpts.addAll([ + // If the config targets Objective C, add a compiler opt for it. + if (config.language == Language.objc) ...[ ...strings.clangLangObjC, ..._findObjectiveCSysroot(), - ]); - } + ], - // Add the user options last so they can override any other options. - compilerOpts.addAll(config.compilerOpts); + // Add the user options last so they can override any other options. + ...config.compilerOpts + ]; _logger.fine('CompilerOpts used: $compilerOpts'); clangCmdArgs = createDynamicStringArray(compilerOpts);