Version 2.10.0-8.0.dev
Merge commit '8405d7c8e37da3b0df06310f61fb91778cb590bb' into 'dev'
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a03d376..c3e87cc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,9 +9,13 @@
### Dart VM
+* **Breaking Change** [#42982][]: `dart_api_dl.cc` is renamed to
+ `dart_api_dl.c` and changed to a pure C file.
* Introduces `Dart_FinalizableHandle`s. They do auto-delete, and the weakly
referred object cannot be accessed through them.
+[#42982]: https://github.com/dart-lang/sdk/issues/42982
+
### Tools
#### Linter
diff --git a/DEPS b/DEPS
index e03a4be..54f5bb7 100644
--- a/DEPS
+++ b/DEPS
@@ -112,7 +112,7 @@
"idl_parser_rev": "5fb1ebf49d235b5a70c9f49047e83b0654031eb7",
"intl_tag": "0.16.1",
"jinja2_rev": "2222b31554f03e62600cd7e383376a7c187967a1",
- "json_rpc_2_rev": "d589e635d8ccb7cda6a804bd571f88abbabab146",
+ "json_rpc_2_rev": "413ee9d1d1841c23ebfd2248abc4fc950e0d6946",
"linter_tag": "0.1.118",
"logging_rev": "9561ba016ae607747ae69b846c0e10958ca58ed4",
"markupsafe_rev": "8f45f5cfa0009d2a70589bcda0349b8cb2b72783",
diff --git a/pkg/analysis_server/lib/src/domain_analysis.dart b/pkg/analysis_server/lib/src/domain_analysis.dart
index 1612bb1..b237a10 100644
--- a/pkg/analysis_server/lib/src/domain_analysis.dart
+++ b/pkg/analysis_server/lib/src/domain_analysis.dart
@@ -443,11 +443,6 @@
var params = AnalysisUpdateOptionsParams.fromRequest(request);
var newOptions = params.options;
var updaters = <OptionUpdater>[];
- if (newOptions.generateDart2jsHints != null) {
- updaters.add((engine.AnalysisOptionsImpl options) {
- options.dart2jsHint = newOptions.generateDart2jsHints;
- });
- }
if (newOptions.generateHints != null) {
updaters.add((engine.AnalysisOptionsImpl options) {
options.hint = newOptions.generateHints;
diff --git a/pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart b/pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart
index ce9d943..c0b1a66 100644
--- a/pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart
+++ b/pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart
@@ -15,6 +15,7 @@
import 'package:analysis_server/src/services/correction/dart/convert_quotes.dart';
import 'package:analysis_server/src/services/correction/dart/convert_to_contains.dart';
import 'package:analysis_server/src/services/correction/dart/create_method.dart';
+import 'package:analysis_server/src/services/correction/dart/make_final.dart';
import 'package:analysis_server/src/services/correction/dart/remove_argument.dart';
import 'package:analysis_server/src/services/correction/dart/remove_await.dart';
import 'package:analysis_server/src/services/correction/dart/remove_const.dart';
@@ -78,6 +79,7 @@
LintNames.prefer_contains: ConvertToContains.newInstance,
LintNames.prefer_equal_for_default_values:
ReplaceColonWithEquals.newInstance,
+ LintNames.prefer_final_fields: MakeFinal.newInstance,
LintNames.prefer_if_elements_to_conditional_expressions:
ConvertConditionalExpressionToIfElement.newInstance,
LintNames.prefer_is_empty: ReplaceWithIsEmpty.newInstance,
diff --git a/pkg/analysis_server/lib/src/status/diagnostics.dart b/pkg/analysis_server/lib/src/status/diagnostics.dart
index de1b34ac..6c165e4 100644
--- a/pkg/analysis_server/lib/src/status/diagnostics.dart
+++ b/pkg/analysis_server/lib/src/status/diagnostics.dart
@@ -446,7 +446,6 @@
b.write(writeOption('Feature set', options.contextFeatures.toString()));
b.write('<br>');
- b.write(writeOption('Generate dart2js hints', options.dart2jsHint));
b.write(writeOption('Generate hints', options.hint));
return b.toString();
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/make_final_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/make_final_test.dart
new file mode 100644
index 0000000..d31d543
--- /dev/null
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/make_final_test.dart
@@ -0,0 +1,39 @@
+// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analysis_server/src/services/linter/lint_names.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import 'bulk_fix_processor.dart';
+
+void main() {
+ defineReflectiveSuite(() {
+ defineReflectiveTests(PreferFinalFieldsTest);
+ });
+}
+
+@reflectiveTest
+class PreferFinalFieldsTest extends BulkFixProcessorTest {
+ @override
+ String get lintCode => LintNames.prefer_final_fields;
+
+ Future<void> test_singleFile() async {
+ await resolveTestUnit('''
+class C {
+ int _f = 2;
+ var _f2 = 2;
+ int get g => _f;
+ int get g2 => _f2;
+}
+''');
+ await assertHasFix('''
+class C {
+ final int _f = 2;
+ final _f2 = 2;
+ int get g => _f;
+ int get g2 => _f2;
+}
+''');
+ }
+}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/test_all.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/test_all.dart
index 25bddfa..8267b5d 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/test_all.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/test_all.dart
@@ -13,6 +13,7 @@
as convert_to_single_quoted_strings;
import 'convert_to_spread_test.dart' as convert_to_spread;
import 'create_method_test.dart' as create_method;
+import 'make_final_test.dart' as make_final;
import 'remove_argument_test.dart' as remove_argument;
import 'remove_await_test.dart' as remove_await;
import 'remove_duplicate_case_test.dart' as remove_duplicate_case;
@@ -47,6 +48,7 @@
convert_to_single_quoted_strings.main();
convert_to_spread.main();
create_method.main();
+ make_final.main();
remove_argument.main();
remove_await.main();
remove_duplicate_case.main();
diff --git a/pkg/analyzer/lib/error/error.dart b/pkg/analyzer/lib/error/error.dart
index a0780e0..cdcfeb7 100644
--- a/pkg/analyzer/lib/error/error.dart
+++ b/pkg/analyzer/lib/error/error.dart
@@ -509,10 +509,6 @@
HintCode.INVALID_USE_OF_VISIBLE_FOR_TEMPLATE_MEMBER,
HintCode.INVALID_USE_OF_VISIBLE_FOR_TESTING_MEMBER,
HintCode.INVALID_VISIBILITY_ANNOTATION,
- HintCode.IS_DOUBLE,
- HintCode.IS_INT,
- HintCode.IS_NOT_DOUBLE,
- HintCode.IS_NOT_INT,
HintCode.MISSING_JS_LIB_ANNOTATION,
HintCode.MISSING_REQUIRED_PARAM,
HintCode.MISSING_REQUIRED_PARAM_WITH_DETAILS,
diff --git a/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart b/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
index a60d615..1e14234 100644
--- a/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
@@ -26,7 +26,6 @@
import 'package:analyzer/src/dart/resolver/resolution_visitor.dart';
import 'package:analyzer/src/error/best_practices_verifier.dart';
import 'package:analyzer/src/error/codes.dart';
-import 'package:analyzer/src/error/dart2js_verifier.dart';
import 'package:analyzer/src/error/dead_code_verifier.dart';
import 'package:analyzer/src/error/imports_verifier.dart';
import 'package:analyzer/src/error/inheritance_override.dart';
@@ -272,11 +271,6 @@
unit.accept(DeadCodeVerifier(errorReporter));
- // Dart2js analysis.
- if (_analysisOptions.dart2jsHint) {
- unit.accept(Dart2JSVerifier(errorReporter));
- }
-
unit.accept(
BestPracticesVerifier(
errorReporter,
diff --git a/pkg/analyzer/lib/src/dart/error/hint_codes.dart b/pkg/analyzer/lib/src/dart/error/hint_codes.dart
index 9645945..70cc4ba 100644
--- a/pkg/analyzer/lib/src/dart/error/hint_codes.dart
+++ b/pkg/analyzer/lib/src/dart/error/hint_codes.dart
@@ -995,46 +995,6 @@
hasPublishedDocs: true);
/**
- * Hint for the `x is double` type checks.
- */
- static const HintCode IS_DOUBLE = HintCode(
- 'IS_DOUBLE',
- "When compiled to JS, this test might return true when the left hand "
- "side is an int.",
- correction: "Try testing for 'num' instead.");
-
- /**
- * Hint for the `x is int` type checks.
- */
- // TODO(brianwilkerson) This hint isn't being generated. Decide whether to
- // generate it or remove it.
- static const HintCode IS_INT = HintCode(
- 'IS_INT',
- "When compiled to JS, this test might return true when the left hand "
- "side is a double.",
- correction: "Try testing for 'num' instead.");
-
- /**
- * Hint for the `x is! double` type checks.
- */
- static const HintCode IS_NOT_DOUBLE = HintCode(
- 'IS_NOT_DOUBLE',
- "When compiled to JS, this test might return false when the left hand "
- "side is an int.",
- correction: "Try testing for 'num' instead.");
-
- /**
- * Hint for the `x is! int` type checks.
- */
- // TODO(brianwilkerson) This hint isn't being generated. Decide whether to
- // generate it or remove it.
- static const HintCode IS_NOT_INT = HintCode(
- 'IS_NOT_INT',
- "When compiled to JS, this test might return false when the left hand "
- "side is a double.",
- correction: "Try testing for 'num' instead.");
-
- /**
* Generate a hint for an element that is annotated with `@JS(...)` whose
* library declaration is not similarly annotated.
*/
diff --git a/pkg/analyzer/lib/src/dart/micro/library_analyzer.dart b/pkg/analyzer/lib/src/dart/micro/library_analyzer.dart
index a029dc9..5e5d888 100644
--- a/pkg/analyzer/lib/src/dart/micro/library_analyzer.dart
+++ b/pkg/analyzer/lib/src/dart/micro/library_analyzer.dart
@@ -26,7 +26,6 @@
import 'package:analyzer/src/dart/resolver/resolution_visitor.dart';
import 'package:analyzer/src/error/best_practices_verifier.dart';
import 'package:analyzer/src/error/codes.dart';
-import 'package:analyzer/src/error/dart2js_verifier.dart';
import 'package:analyzer/src/error/dead_code_verifier.dart';
import 'package:analyzer/src/error/imports_verifier.dart';
import 'package:analyzer/src/error/inheritance_override.dart';
@@ -266,11 +265,6 @@
unit.accept(DeadCodeVerifier(errorReporter));
- // Dart2js analysis.
- if (_analysisOptions.dart2jsHint) {
- unit.accept(Dart2JSVerifier(errorReporter));
- }
-
var content = getFileContent(file);
unit.accept(
BestPracticesVerifier(
diff --git a/pkg/analyzer/lib/src/error/dart2js_verifier.dart b/pkg/analyzer/lib/src/error/dart2js_verifier.dart
deleted file mode 100644
index 78d8f86..0000000
--- a/pkg/analyzer/lib/src/error/dart2js_verifier.dart
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:analyzer/dart/ast/ast.dart';
-import 'package:analyzer/dart/ast/visitor.dart';
-import 'package:analyzer/dart/element/element.dart';
-import 'package:analyzer/dart/element/type.dart';
-import 'package:analyzer/error/listener.dart';
-import 'package:analyzer/src/error/codes.dart';
-
-/// Instances of the class `Dart2JSVerifier` traverse an AST structure looking
-/// for hints for code that will be compiled to JS, such as
-/// [HintCode.IS_DOUBLE].
-class Dart2JSVerifier extends RecursiveAstVisitor<void> {
- /// The name of the `double` type.
- static const String _DOUBLE_TYPE_NAME = "double";
-
- /// The error reporter by which errors will be reported.
- final ErrorReporter _errorReporter;
-
- /// Create a new instance of the [Dart2JSVerifier].
- ///
- /// @param errorReporter the error reporter
- Dart2JSVerifier(this._errorReporter);
-
- @override
- void visitIsExpression(IsExpression node) {
- _checkForIsDoubleHints(node);
- super.visitIsExpression(node);
- }
-
- /// Check for instances of `x is double`, `x is int`, `x is! double` and
- /// `x is! int`.
- ///
- /// @param node the is expression to check
- /// @return `true` if and only if a hint code is generated on the passed node
- /// See [HintCode.IS_DOUBLE],
- /// [HintCode.IS_INT],
- /// [HintCode.IS_NOT_DOUBLE], and
- /// [HintCode.IS_NOT_INT].
- bool _checkForIsDoubleHints(IsExpression node) {
- DartType type = node.type.type;
- Element element = type?.element;
- if (element != null) {
- String typeNameStr = element.name;
- LibraryElement libraryElement = element.library;
- // if (typeNameStr.equals(INT_TYPE_NAME) && libraryElement != null
- // && libraryElement.isDartCore()) {
- // if (node.getNotOperator() == null) {
- // errorReporter.reportError(HintCode.IS_INT, node);
- // } else {
- // errorReporter.reportError(HintCode.IS_NOT_INT, node);
- // }
- // return true;
- // } else
- if (typeNameStr == _DOUBLE_TYPE_NAME &&
- libraryElement != null &&
- libraryElement.isDartCore) {
- if (node.notOperator == null) {
- _errorReporter.reportErrorForNode(HintCode.IS_DOUBLE, node);
- } else {
- _errorReporter.reportErrorForNode(HintCode.IS_NOT_DOUBLE, node);
- }
- return true;
- }
- }
- return false;
- }
-}
diff --git a/pkg/analyzer/lib/src/generated/engine.dart b/pkg/analyzer/lib/src/generated/engine.dart
index 387f3d4..7907567 100644
--- a/pkg/analyzer/lib/src/generated/engine.dart
+++ b/pkg/analyzer/lib/src/generated/engine.dart
@@ -235,9 +235,6 @@
/// The set of features that are globally enabled for this context.
FeatureSet get contextFeatures;
- /// Return `true` if analysis is to generate dart2js related hint results.
- bool get dart2jsHint;
-
/// Return `true` if cache flushing should be disabled. Setting this option to
/// `true` can improve analysis speed at the expense of memory usage. It may
/// also be useful for working around bugs.
@@ -429,9 +426,6 @@
@deprecated
int cacheSize = 64;
- @override
- bool dart2jsHint = false;
-
ExperimentStatus _contextFeatures = ExperimentStatus();
/// The set of features to use for libraries that are not in a package.
@@ -535,7 +529,6 @@
AnalysisOptionsImpl.from(AnalysisOptions options) {
// ignore: deprecated_member_use_from_same_package
analyzeFunctionBodiesPredicate = options.analyzeFunctionBodiesPredicate;
- dart2jsHint = options.dart2jsHint;
contextFeatures = options.contextFeatures;
enabledPluginNames = options.enabledPluginNames;
// ignore: deprecated_member_use_from_same_package
@@ -832,7 +825,6 @@
@override
void resetToDefaults() {
contextFeatures = ExperimentStatus();
- dart2jsHint = false;
disableCacheFlushing = false;
enabledPluginNames = const <String>[];
enableLazyAssignmentOperators = false;
diff --git a/pkg/analyzer/test/src/context/builder_test.dart b/pkg/analyzer/test/src/context/builder_test.dart
index 214bf41..73e1ad7 100644
--- a/pkg/analyzer/test/src/context/builder_test.dart
+++ b/pkg/analyzer/test/src/context/builder_test.dart
@@ -214,7 +214,7 @@
// Invert a subset of the options to ensure that the default options are
// being returned.
AnalysisOptionsImpl defaultOptions = AnalysisOptionsImpl();
- defaultOptions.dart2jsHint = !defaultOptions.dart2jsHint;
+ defaultOptions.implicitCasts = !defaultOptions.implicitCasts;
builderOptions.defaultOptions = defaultOptions;
AnalysisOptions options = builder.createDefaultOptions();
_expectEqualOptions(options, defaultOptions);
@@ -759,7 +759,6 @@
void _expectEqualOptions(
AnalysisOptionsImpl actual, AnalysisOptionsImpl expected) {
// TODO(brianwilkerson) Consider moving this to AnalysisOptionsImpl.==.
- expect(actual.dart2jsHint, expected.dart2jsHint);
expect(actual.enableTiming, expected.enableTiming);
expect(actual.hint, expected.hint);
expect(actual.lint, expected.lint);
diff --git a/pkg/analyzer/test/src/dart/resolution/context_collection_resolution.dart b/pkg/analyzer/test/src/dart/resolution/context_collection_resolution.dart
index c5ac808..ea9f880 100644
--- a/pkg/analyzer/test/src/dart/resolution/context_collection_resolution.dart
+++ b/pkg/analyzer/test/src/dart/resolution/context_collection_resolution.dart
@@ -16,8 +16,14 @@
import 'package:analyzer/src/test_utilities/mock_sdk.dart';
import 'package:analyzer/src/test_utilities/package_mixin.dart';
import 'package:analyzer/src/test_utilities/resource_provider_mixin.dart';
+import 'package:analyzer/src/workspace/basic.dart';
+import 'package:analyzer/src/workspace/bazel.dart';
+import 'package:analyzer/src/workspace/gn.dart';
+import 'package:analyzer/src/workspace/package_build.dart';
+import 'package:analyzer/src/workspace/pub.dart';
import 'package:linter/src/rules.dart';
import 'package:meta/meta.dart';
+import 'package:test/test.dart';
import 'resolution.dart';
@@ -91,10 +97,21 @@
String get workspaceRootPath => '/workspace';
+ String get workspaceThirdPartyDartPath {
+ return '$workspaceRootPath/third_party/dart';
+ }
+
@override
void setUp() {
super.setUp();
newFile('$workspaceRootPath/WORKSPACE', content: '');
+ newFile('$myPackageRootPath/BUILD', content: '');
+ }
+
+ @override
+ void verifyCreatedCollection() {
+ super.verifyCreatedCollection();
+ assertBazelWorkspaceFor(testFilePath);
}
}
@@ -118,10 +135,33 @@
_declaredVariables = map;
}
+ void assertBasicWorkspaceFor(String path) {
+ var workspace = contextFor(path).workspace;
+ expect(workspace, TypeMatcher<BasicWorkspace>());
+ }
+
+ void assertBazelWorkspaceFor(String path) {
+ var workspace = contextFor(path).workspace;
+ expect(workspace, TypeMatcher<BazelWorkspace>());
+ }
+
+ void assertGnWorkspaceFor(String path) {
+ var workspace = contextFor(path).workspace;
+ expect(workspace, TypeMatcher<GnWorkspace>());
+ }
+
+ void assertPackageBuildWorkspaceFor(String path) {
+ var workspace = contextFor(path).workspace;
+ expect(workspace, TypeMatcher<PackageBuildWorkspace>());
+ }
+
+ void assertPubWorkspaceFor(String path) {
+ var workspace = contextFor(path).workspace;
+ expect(workspace, TypeMatcher<PubWorkspace>());
+ }
+
AnalysisContext contextFor(String path) {
- if (_analysisContextCollection == null) {
- _createAnalysisContexts();
- }
+ _createAnalysisContexts();
path = convertPath(path);
return _analysisContextCollection.contextFor(path);
@@ -163,8 +203,14 @@
);
}
+ void verifyCreatedCollection() {}
+
/// Create all analysis contexts in [collectionIncludedPaths].
void _createAnalysisContexts() {
+ if (_analysisContextCollection != null) {
+ return;
+ }
+
_analysisContextCollection = AnalysisContextCollectionImpl(
declaredVariables: _declaredVariables,
enableIndex: true,
@@ -172,6 +218,8 @@
resourceProvider: resourceProvider,
sdkPath: convertPath('/sdk'),
);
+
+ verifyCreatedCollection();
}
}
diff --git a/pkg/analyzer/test/src/diagnostics/deprecated_member_use_test.dart b/pkg/analyzer/test/src/diagnostics/deprecated_member_use_test.dart
index c273957..0e37307 100644
--- a/pkg/analyzer/test/src/diagnostics/deprecated_member_use_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/deprecated_member_use_test.dart
@@ -3,58 +3,354 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/src/error/codes.dart';
-import 'package:test/test.dart';
+import 'package:meta/meta.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
-import '../dart/resolution/driver_resolution.dart';
+import '../dart/resolution/context_collection_resolution.dart';
main() {
defineReflectiveSuite(() {
- defineReflectiveTests(DeprecatedMemberUseFromSamePackageTest);
- defineReflectiveTests(DeprecatedMemberUseTest);
+ defineReflectiveTests(DeprecatedMemberUse_BasicWorkspaceTest);
+ defineReflectiveTests(DeprecatedMemberUse_BazelWorkspaceTest);
+ defineReflectiveTests(DeprecatedMemberUse_GnWorkspaceTest);
+ defineReflectiveTests(DeprecatedMemberUse_PackageBuildWorkspaceTest);
+
+ defineReflectiveTests(
+ DeprecatedMemberUseFromSamePackage_BasicWorkspaceTest,
+ );
+ defineReflectiveTests(
+ DeprecatedMemberUseFromSamePackage_BazelWorkspaceTest,
+ );
+ defineReflectiveTests(
+ DeprecatedMemberUseFromSamePackage_PackageBuildWorkspaceTest,
+ );
});
}
@reflectiveTest
-class DeprecatedMemberUseFromSamePackageTest extends DriverResolutionTest {
- test_basicWorkspace() async {
- configureWorkspace(root: '/workspace');
+class DeprecatedMemberUse_BasicWorkspaceTest extends PubPackageResolutionTest {
+ @override
+ void setUp() {
+ super.setUp();
- newFile('/workspace/lib/deprecated_library.dart', content: r'''
+ writeTestPackageConfig({
+ 'aaa': '$workspaceRootPath/aaa',
+ });
+ }
+
+ test_export() async {
+ newFile('$workspaceRootPath/aaa/lib/a.dart', content: r'''
@deprecated
-library deprecated_library;
-class A {}
+library a;
''');
- await assertErrorsInFile('/workspace/lib/test.dart', r'''
-import 'deprecated_library.dart';
-f(A a) {}
+ assertBasicWorkspaceFor(testFilePath);
+
+ await assertErrorsInCode('''
+export 'package:aaa/a.dart';
''', [
- error(HintCode.DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE, 0, 33),
+ error(HintCode.DEPRECATED_MEMBER_USE, 0, 28),
]);
}
- test_bazelWorkspace() async {
- configureWorkspace(root: '/workspace');
-
- newFile('/workspace/WORKSPACE');
- newFile('/workspace/project/BUILD');
- newFolder('/workspace/bazel-genfiles');
-
- newFile('/workspace/project/lib/deprecated_library.dart', content: r'''
-@deprecated
-library deprecated_library;
-class A {}
+ test_fieldGet_implicitGetter() async {
+ newFile('$workspaceRootPath/aaa/lib/a.dart', content: r'''
+class A {
+ @deprecated
+ int foo = 0;
+}
''');
- await assertErrorsInFile('/workspace/project/lib/lib1.dart', r'''
-import 'deprecated_library.dart';
-f(A a) {}
+ assertBasicWorkspaceFor(testFilePath);
+
+ await assertErrorsInCode(r'''
+import 'package:aaa/a.dart';
+
+void f(A a) {
+ a.foo;
+}
''', [
- error(HintCode.DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE, 0, 33),
+ error(HintCode.DEPRECATED_MEMBER_USE, 48, 3),
]);
}
+ test_fieldSet_implicitSetter() async {
+ newFile('$workspaceRootPath/aaa/lib/a.dart', content: r'''
+class A {
+ @deprecated
+ int foo = 0;
+}
+''');
+
+ assertBasicWorkspaceFor(testFilePath);
+
+ await assertErrorsInCode(r'''
+import 'package:aaa/a.dart';
+
+void f(A a) {
+ a.foo = 0;
+}
+''', [
+ error(HintCode.DEPRECATED_MEMBER_USE, 48, 3),
+ ]);
+ }
+
+ test_import() async {
+ newFile('$workspaceRootPath/aaa/lib/a.dart', content: r'''
+@deprecated
+library a;
+''');
+
+ assertBasicWorkspaceFor(testFilePath);
+
+ await assertErrorsInCode(r'''
+// ignore:unused_import
+import 'package:aaa/a.dart';
+''', [
+ error(HintCode.DEPRECATED_MEMBER_USE, 24, 28,
+ messageContains: 'package:aaa/a.dart'),
+ ]);
+ }
+
+ test_methodInvocation() async {
+ newFile('$workspaceRootPath/aaa/lib/a.dart', content: r'''
+class A {
+ @deprecated
+ void foo() {}
+}
+''');
+
+ assertBasicWorkspaceFor(testFilePath);
+
+ await assertErrorsInCode(r'''
+import 'package:aaa/a.dart';
+
+void f(A a) {
+ a.foo();
+}
+''', [
+ error(HintCode.DEPRECATED_MEMBER_USE, 48, 3),
+ ]);
+ }
+
+ test_methodInvocation_withMessage() async {
+ newFile('$workspaceRootPath/aaa/lib/a.dart', content: r'''
+class A {
+ @Deprecated('0.9')
+ void foo() {}
+}
+''');
+
+ assertBasicWorkspaceFor(testFilePath);
+
+ await assertErrorsInCode(r'''
+import 'package:aaa/a.dart';
+
+void f(A a) {
+ a.foo();
+}
+''', [
+ error(HintCode.DEPRECATED_MEMBER_USE_WITH_MESSAGE, 48, 3),
+ ]);
+ }
+
+ test_setterInvocation() async {
+ newFile('$workspaceRootPath/aaa/lib/a.dart', content: r'''
+class A {
+ @deprecated
+ set foo(int _) {}
+}
+''');
+
+ assertBasicWorkspaceFor(testFilePath);
+
+ await assertErrorsInCode(r'''
+import 'package:aaa/a.dart';
+
+void f(A a) {
+ a.foo = 0;
+}
+''', [
+ error(HintCode.DEPRECATED_MEMBER_USE, 48, 3),
+ ]);
+ }
+}
+
+@reflectiveTest
+class DeprecatedMemberUse_BazelWorkspaceTest
+ extends BazelWorkspaceResolutionTest {
+ test_dart() async {
+ newFile('$workspaceRootPath/foo/bar/lib/a.dart', content: r'''
+@deprecated
+class A {}
+''');
+
+ await assertErrorsInCode(r'''
+import 'package:foo.bar/a.dart';
+
+void f(A a) {}
+''', [
+ error(HintCode.DEPRECATED_MEMBER_USE, 41, 1),
+ ]);
+ }
+
+ test_thirdPartyDart() async {
+ newFile('$workspaceThirdPartyDartPath/aaa/lib/a.dart', content: r'''
+@deprecated
+class A {}
+''');
+
+ assertBazelWorkspaceFor(testFilePath);
+
+ await assertErrorsInCode(r'''
+import 'package:aaa/a.dart';
+
+void f(A a) {}
+''', [
+ error(HintCode.DEPRECATED_MEMBER_USE, 37, 1),
+ ]);
+ }
+}
+
+@reflectiveTest
+class DeprecatedMemberUse_GnWorkspaceTest extends ContextResolutionTest {
+ @override
+ List<String> get collectionIncludedPaths => [workspaceRootPath];
+
+ String get myPackageLibPath => '$myPackageRootPath/lib';
+
+ String get myPackageRootPath => '$workspaceRootPath/my';
+
+ @override
+ String get testFilePath => '$myPackageLibPath/my.dart';
+
+ String get workspaceRootPath => '/workspace';
+
+ @override
+ void setUp() {
+ super.setUp();
+ newFolder('$workspaceRootPath/.jiri_root');
+ }
+
+ test_differentPackage() async {
+ newFile('$workspaceRootPath/my/pubspec.yaml');
+ newFile('$workspaceRootPath/my/BUILD.gn');
+
+ newFile('$workspaceRootPath/aaa/pubspec.yaml');
+ newFile('$workspaceRootPath/aaa/BUILD.gn');
+
+ _writeWorkspacePackagesFile({
+ 'aaa': '$workspaceRootPath/aaa/lib',
+ 'my': myPackageLibPath,
+ });
+
+ newFile('$workspaceRootPath/aaa/lib/a.dart', content: r'''
+@deprecated
+class A {}
+''');
+
+ await assertErrorsInCode(r'''
+import 'package:aaa/a.dart';
+
+void f(A a) {}
+''', [
+ error(HintCode.DEPRECATED_MEMBER_USE, 37, 1),
+ ]);
+ }
+
+ test_samePackage() async {
+ newFile('$workspaceRootPath/my/pubspec.yaml');
+ newFile('$workspaceRootPath/my/BUILD.gn');
+
+ _writeWorkspacePackagesFile({
+ 'my': myPackageLibPath,
+ });
+
+ newFile('$myPackageLibPath/a.dart', content: r'''
+@deprecated
+class A {}
+''');
+
+ await assertErrorsInCode(r'''
+import 'package:my/a.dart';
+
+void f(A a) {}
+''', [
+ error(HintCode.DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE, 36, 1),
+ ]);
+ }
+
+ @override
+ void verifyCreatedCollection() {
+ super.verifyCreatedCollection();
+ assertGnWorkspaceFor(testFilePath);
+ }
+
+ void _writeWorkspacePackagesFile(Map<String, String> nameToLibPath) {
+ var builder = StringBuffer();
+ for (var entry in nameToLibPath.entries) {
+ builder.writeln('${entry.key}:${toUriStr(entry.value)}');
+ }
+
+ var buildDir = 'out/debug-x87_128';
+ var genPath = '$workspaceRootPath/$buildDir/dartlang/gen';
+ newFile('$genPath/foo.packages', content: builder.toString());
+ }
+}
+
+@reflectiveTest
+class DeprecatedMemberUse_PackageBuildWorkspaceTest
+ extends _PackageBuildWorkspaceBase {
+ test_generated() async {
+ writeTestPackageConfig({
+ 'aaa': '$workspaceRootPath/aaa',
+ });
+
+ newFile('$testPackageRootPath/pubspec.yaml', content: 'name: test');
+ _newTestPackageGeneratedFile(
+ packageName: 'aaa',
+ pathInLib: 'a.dart',
+ content: r'''
+@deprecated
+class A {}
+''',
+ );
+
+ await assertErrorsInCode(r'''
+import 'package:aaa/a.dart';
+
+void f(A a) {}
+''', [
+ error(HintCode.DEPRECATED_MEMBER_USE, 37, 1),
+ ]);
+ }
+
+ test_lib() async {
+ writeTestPackageConfig({
+ 'aaa': '$workspaceRootPath/aaa',
+ });
+
+ newFile('$workspaceRootPath/aaa/lib/a.dart', content: r'''
+@deprecated
+class A {}
+''');
+
+ newFile('$testPackageRootPath/pubspec.yaml', content: 'name: test');
+ _createTestPackageBuildMarker();
+
+ await assertErrorsInCode(r'''
+import 'package:aaa/a.dart';
+
+void f(A a) {}
+''', [
+ error(HintCode.DEPRECATED_MEMBER_USE, 37, 1),
+ ]);
+ }
+}
+
+@reflectiveTest
+class DeprecatedMemberUseFromSamePackage_BasicWorkspaceTest
+ extends PubPackageResolutionTest {
test_call() async {
await assertErrorsInCode(r'''
class A {
@@ -70,6 +366,21 @@
]);
}
+ test_class() async {
+ newFile('$testPackageLibPath/a.dart', content: r'''
+@deprecated
+class A {}
+''');
+
+ await assertErrorsInCode(r'''
+import 'a.dart';
+
+void f(A a) {}
+''', [
+ error(HintCode.DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE, 25, 1),
+ ]);
+ }
+
test_compoundAssignment() async {
await assertErrorsInCode(r'''
class A {
@@ -86,7 +397,7 @@
}
test_export() async {
- newFile("/test/lib/deprecated_library.dart", content: r'''
+ newFile('$testPackageLibPath/deprecated_library.dart', content: r'''
@deprecated
library deprecated_library;
class A {}
@@ -126,35 +437,8 @@
]);
}
- test_gnWorkspace() async {
- configureWorkspace(root: '/workspace');
-
- newFolder('/workspace/.jiri_root');
- newFile('/workspace/project/pubspec.yaml');
- newFile('/workspace/project/BUILD.gn');
- String buildDir = convertPath('out/debug-x87_128');
- newFile('/workspace/.config', content: '''
-FOO=foo
-FUCHSIA_BUILD_DIR=$buildDir
-''');
- newFile('/workspace/out/debug-x87_128/dartlang/gen/project/foo.packages');
-
- newFile('/workspace/project/lib/deprecated_library.dart', content: r'''
-@deprecated
-library deprecated_library;
-class A {}
-''');
-
- await assertErrorsInFile('/workspace/project/lib/lib1.dart', r'''
-import 'deprecated_library.dart';
-f(A a) {}
-''', [
- error(HintCode.DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE, 0, 33),
- ]);
- }
-
test_import() async {
- newFile("/test/lib/deprecated_library.dart", content: r'''
+ newFile('$testPackageLibPath/deprecated_library.dart', content: r'''
@deprecated
library deprecated_library;
class A {}
@@ -358,27 +642,6 @@
]);
}
- test_packageBuildWorkspace() async {
- configureWorkspace(root: '/workspace');
-
- newFolder('/workspace/.dart_tool/build/generated/project/lib');
- newFile('/workspace/pubspec.yaml', content: 'name: project');
- newFile('/workspace/.packages', content: 'project:lib/');
-
- newFile('/workspace/lib/deprecated_library.dart', content: r'''
-@deprecated
-library deprecated_library;
-class A {}
-''');
-
- await assertErrorsInFile('/workspace/lib/lib1.dart', r'''
-import 'deprecated_library.dart';
-f(A a) {}
-''', [
- error(HintCode.DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE, 0, 33),
- ]);
- }
-
test_parameter_named() async {
await assertErrorsInCode(r'''
class A {
@@ -487,249 +750,95 @@
}
@reflectiveTest
-class DeprecatedMemberUseTest extends DriverResolutionTest {
- /// Write a pubspec file at [root], so that BestPracticesVerifier can see that
- /// [root] is the root of a PubWorkspace, and a PubWorkspacePackage.
- void newPubPackage(String root) {
- newFile('$root/pubspec.yaml');
- }
-
- void resetWithFooLibrary(String content) {
- newFile('/aaa/lib/a.dart', content: content);
- }
-
- test_basicWorkspace() async {
- resetWithFooLibrary(r'''
+class DeprecatedMemberUseFromSamePackage_BazelWorkspaceTest
+ extends BazelWorkspaceResolutionTest {
+ test_it() async {
+ newFile('$myPackageLibPath/a.dart', content: r'''
@deprecated
-library deprecated_library;
class A {}
''');
await assertErrorsInCode(r'''
-import 'package:aaa/a.dart';
-f(A a) {}
+import 'a.dart';
+
+void f(A a) {}
''', [
- error(HintCode.DEPRECATED_MEMBER_USE, 0, 28),
+ error(HintCode.DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE, 25, 1),
]);
}
-
- test_bazelWorkspace() async {
- resetWithFooLibrary(r'''
-@deprecated
-library deprecated_library;
-class A {}
-''');
-
- newFile('/workspace/WORKSPACE');
- newFile('/workspace/project/BUILD');
- newFolder('/workspace/bazel-genfiles');
-
- await assertErrorsInFile('/workspace/project/lib/lib1.dart', r'''
-import 'package:aaa/a.dart';
-f(A a) {}
-''', [
- error(HintCode.DEPRECATED_MEMBER_USE, 0, 28),
- ]);
- }
-
- test_bazelWorkspace_sameWorkspace() async {
- newFile('/workspace/WORKSPACE');
- newFile('/workspace/project_a/BUILD');
- newFile('/workspace/project_b/BUILD');
- newFolder('/workspace/bazel-genfiles');
-
- newFile('/workspace/project_a/lib/deprecated_library.dart', content: r'''
-@deprecated
-library deprecated_library;
-class A {}
-''');
-
- await assertErrorsInFile('/workspace/project_b/lib/lib1.dart', r'''
-import '../../project_a/lib/deprecated_library.dart';
-f(A a) {}
-''', [
- error(HintCode.DEPRECATED_MEMBER_USE, 0, 53),
- ]);
- }
-
- test_export() async {
- resetWithFooLibrary(r'''
-@deprecated
-library deprecated_library;
-class A {}
-''');
-
- newPubPackage('/pkg1');
- await assertErrorsInFile('/pkg1/lib/lib1.dart', '''
-export 'package:aaa/a.dart';
-''', [
- error(HintCode.DEPRECATED_MEMBER_USE, 0, 28),
- ]);
- }
-
- test_fieldGet_implicitGetter() async {
- resetWithFooLibrary(r'''
-class A {
- @Deprecated('0.9')
- bool bob = true;
}
-''');
- newPubPackage('/pkg1');
- await assertErrorsInFile('/pkg1/lib/lib1.dart', r'''
-import 'package:aaa/a.dart';
-void main() { A().bob; }
-''', [
- error(HintCode.DEPRECATED_MEMBER_USE_WITH_MESSAGE, 47, 3),
- ]);
- }
+@reflectiveTest
+class DeprecatedMemberUseFromSamePackage_PackageBuildWorkspaceTest
+ extends _PackageBuildWorkspaceBase {
+ test_generated() async {
+ newFile('$testPackageRootPath/pubspec.yaml', content: 'name: test');
- test_fieldSet_implicitSetter() async {
- resetWithFooLibrary(r'''
-class A {
- @Deprecated('0.9')
- bool bob = true;
-}
-''');
-
- newPubPackage('/pkg1');
- await assertErrorsInFile('/pkg1/lib/lib1.dart', r'''
-import 'package:aaa/a.dart';
-void main() { A().bob = false; }
-''', [
- error(HintCode.DEPRECATED_MEMBER_USE_WITH_MESSAGE, 47, 3),
- ]);
- }
-
- test_gnWorkspace() async {
- resetWithFooLibrary(r'''
+ _newTestPackageGeneratedFile(
+ packageName: 'test',
+ pathInLib: 'a.dart',
+ content: r'''
@deprecated
-library deprecated_library;
class A {}
-''');
+''',
+ );
- newFolder('/workspace/.jiri_root');
- newFile('/workspace/project/pubspec.yaml');
- String buildDir = convertPath('out/debug-x87_128');
- newFile('/workspace/.config', content: '''
-FOO=foo
-FUCHSIA_BUILD_DIR=$buildDir
-BAR=bar
-''');
- newFile('/workspace/out/debug-x87_128/dartlang/gen/project/foo.packages');
+ await assertErrorsInCode(r'''
+import 'a.dart';
- await assertErrorsInFile('/workspace/project/lib/lib1.dart', r'''
-import 'package:aaa/a.dart';
-f(A a) {}
+void f(A a) {}
''', [
- error(HintCode.DEPRECATED_MEMBER_USE, 0, 28),
+ error(HintCode.DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE, 25, 1),
]);
}
- test_gnWorkspace_sameWorkspace() async {
- newFolder('/workspace/.jiri_root');
- newFile('/workspace/project_a/pubspec.yaml');
- newFile('/workspace/project_b/pubspec.yaml');
- newFile('/workspace/project_a/BUILD.gn');
- newFile('/workspace/project_b/BUILD.gn');
- String buildDir = convertPath('out/debug-x87_128');
- newFile('/workspace/.config', content: '''
-FOO=foo
-FUCHSIA_BUILD_DIR=$buildDir
-''');
- newFile('/workspace/out/debug-x87_128/dartlang/gen/project_a/foo.packages');
+ test_lib() async {
+ newFile('$testPackageRootPath/pubspec.yaml', content: 'name: test');
+ _createTestPackageBuildMarker();
- newFile('/workspace/project_a/lib/deprecated_library.dart', content: r'''
+ newFile('$testPackageLibPath/a.dart', content: r'''
@deprecated
-library deprecated_library;
class A {}
''');
- await assertErrorsInFile('/workspace/project_b/lib/lib1.dart', r'''
-import '../../project_a/lib/deprecated_library.dart';
-f(A a) {}
-''', [
- error(HintCode.DEPRECATED_MEMBER_USE, 0, 53),
- ]);
- }
-
- test_import() async {
- resetWithFooLibrary(r'''
-@deprecated
-library deprecated_library;
-class A {}
-''');
-
- await resolveTestCode(r'''
-import 'package:aaa/a.dart';
-f(A a) {}
-''');
- expect(result.errors[0].message, contains('package:aaa/a.dart'));
- }
-
- test_methodInvocation_constant() async {
- resetWithFooLibrary(r'''
-class A {
- @deprecated
- m() {}
-}
-''');
-
await assertErrorsInCode(r'''
-import 'package:aaa/a.dart';
-void main() => A().m();
+import 'a.dart';
+
+void f(A a) {}
''', [
- error(HintCode.DEPRECATED_MEMBER_USE, 48, 1),
+ error(HintCode.DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE, 25, 1),
]);
}
-
- test_methodInvocation_constructor() async {
- resetWithFooLibrary(r'''
-class A {
- @Deprecated('0.9')
- m() {}
}
-''');
- await assertErrorsInCode(r'''
-import 'package:aaa/a.dart';
-void main() => A().m();
-''', [
- error(HintCode.DEPRECATED_MEMBER_USE_WITH_MESSAGE, 48, 1),
- ]);
+class _PackageBuildWorkspaceBase extends PubPackageResolutionTest {
+ String get testPackageGeneratedPath {
+ return '$testPackageRootPath/.dart_tool/build/generated';
}
- test_packageBuildWorkspace() async {
- resetWithFooLibrary(r'''
-@deprecated
-library deprecated_library;
-class A {}
-''');
-
- newFolder('/workspace/.dart_tool/build/generated/project/lib');
- newFile('/workspace/pubspec.yaml', content: 'name: project');
-
- await assertErrorsInFile('/workspace/package/lib/lib1.dart', r'''
-import 'package:aaa/a.dart';
-f(A a) {}
-''', [
- error(HintCode.DEPRECATED_MEMBER_USE, 0, 28),
- ]);
+ @override
+ void setUp() {
+ super.setUp();
}
- test_setterInvocation_constructor() async {
- resetWithFooLibrary(r'''
-class A {
- @Deprecated('0.9')
- set bob(bool b) { }
-}
-''');
+ @override
+ void verifyCreatedCollection() {
+ super.verifyCreatedCollection();
+ assertPackageBuildWorkspaceFor(testFilePath);
+ }
- await assertErrorsInCode(r'''
-import 'package:aaa/a.dart';
-void main() { A().bob = false; }
-''', [
- error(HintCode.DEPRECATED_MEMBER_USE_WITH_MESSAGE, 47, 3),
- ]);
+ void _createTestPackageBuildMarker() {
+ newFolder(testPackageGeneratedPath);
+ }
+
+ void _newTestPackageGeneratedFile({
+ @required String packageName,
+ @required String pathInLib,
+ @required String content,
+ }) {
+ newFile(
+ '$testPackageGeneratedPath/$packageName/lib/$pathInLib',
+ content: content,
+ );
}
}
diff --git a/pkg/analyzer/test/src/diagnostics/is_double_test.dart b/pkg/analyzer/test/src/diagnostics/is_double_test.dart
deleted file mode 100644
index 5192cab..0000000
--- a/pkg/analyzer/test/src/diagnostics/is_double_test.dart
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:analyzer/src/dart/error/hint_codes.dart';
-import 'package:analyzer/src/generated/engine.dart';
-import 'package:test_reflective_loader/test_reflective_loader.dart';
-
-import '../dart/resolution/driver_resolution.dart';
-
-main() {
- defineReflectiveSuite(() {
- defineReflectiveTests(IsDoubleTest);
- });
-}
-
-@reflectiveTest
-class IsDoubleTest extends DriverResolutionTest {
- @override
- AnalysisOptionsImpl get analysisOptions =>
- AnalysisOptionsImpl()..dart2jsHint = true;
-
- test_use() async {
- await assertErrorsInCode('''
-var v = 1 is double;
-''', [
- error(HintCode.IS_DOUBLE, 8, 11),
- ]);
- }
-}
diff --git a/pkg/analyzer/test/src/diagnostics/is_int_test.dart b/pkg/analyzer/test/src/diagnostics/is_int_test.dart
deleted file mode 100644
index c9d5083..0000000
--- a/pkg/analyzer/test/src/diagnostics/is_int_test.dart
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:analyzer/src/dart/error/hint_codes.dart';
-import 'package:analyzer/src/generated/engine.dart';
-import 'package:test_reflective_loader/test_reflective_loader.dart';
-
-import '../dart/resolution/driver_resolution.dart';
-
-main() {
- defineReflectiveSuite(() {
- defineReflectiveTests(IsIntTest);
- });
-}
-
-@reflectiveTest
-class IsIntTest extends DriverResolutionTest {
- @override
- AnalysisOptionsImpl get analysisOptions =>
- AnalysisOptionsImpl()..dart2jsHint = true;
-
- @failingTest
- test_use() async {
- await assertErrorsInCode('''
-var v = 1 is int;
-''', [
- error(HintCode.IS_INT, 8, 8),
- ]);
- }
-}
diff --git a/pkg/analyzer/test/src/diagnostics/is_not_double_test.dart b/pkg/analyzer/test/src/diagnostics/is_not_double_test.dart
deleted file mode 100644
index 0a100593..0000000
--- a/pkg/analyzer/test/src/diagnostics/is_not_double_test.dart
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:analyzer/src/dart/error/hint_codes.dart';
-import 'package:analyzer/src/generated/engine.dart';
-import 'package:test_reflective_loader/test_reflective_loader.dart';
-
-import '../dart/resolution/driver_resolution.dart';
-
-main() {
- defineReflectiveSuite(() {
- defineReflectiveTests(IsNotDoubleTest);
- });
-}
-
-@reflectiveTest
-class IsNotDoubleTest extends DriverResolutionTest {
- @override
- AnalysisOptionsImpl get analysisOptions =>
- AnalysisOptionsImpl()..dart2jsHint = true;
-
- test_use() async {
- await assertErrorsInCode('''
-var v = 1 is! double;
-''', [
- error(HintCode.IS_NOT_DOUBLE, 8, 12),
- ]);
- }
-}
diff --git a/pkg/analyzer/test/src/diagnostics/is_not_int_test.dart b/pkg/analyzer/test/src/diagnostics/is_not_int_test.dart
deleted file mode 100644
index 31f6d6f..0000000
--- a/pkg/analyzer/test/src/diagnostics/is_not_int_test.dart
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:analyzer/src/dart/error/hint_codes.dart';
-import 'package:analyzer/src/generated/engine.dart';
-import 'package:test_reflective_loader/test_reflective_loader.dart';
-
-import '../dart/resolution/driver_resolution.dart';
-
-main() {
- defineReflectiveSuite(() {
- defineReflectiveTests(IsNotIntTest);
- });
-}
-
-@reflectiveTest
-class IsNotIntTest extends DriverResolutionTest {
- @override
- AnalysisOptionsImpl get analysisOptions =>
- AnalysisOptionsImpl()..dart2jsHint = true;
-
- @failingTest
- test_use() async {
- await assertErrorsInCode('''
-var v = 1 is! int;
-''', [
- error(HintCode.IS_NOT_INT, 8, 9),
- ]);
- }
-}
diff --git a/pkg/analyzer/test/src/diagnostics/mixin_on_sealed_class_test.dart b/pkg/analyzer/test/src/diagnostics/mixin_on_sealed_class_test.dart
index 74a169e..f140857 100644
--- a/pkg/analyzer/test/src/diagnostics/mixin_on_sealed_class_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/mixin_on_sealed_class_test.dart
@@ -2,13 +2,10 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/src/error/codes.dart';
-import 'package:analyzer/src/test_utilities/package_mixin.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
-import '../../generated/test_support.dart';
-import '../dart/resolution/driver_resolution.dart';
+import '../dart/resolution/context_collection_resolution.dart';
main() {
defineReflectiveSuite(() {
@@ -17,107 +14,91 @@
}
@reflectiveTest
-class MixinOnSealedClassTest extends DriverResolutionTest with PackageMixin {
+class MixinOnSealedClassTest extends PubPackageResolutionTest {
+ @override
+ void setUp() {
+ super.setUp();
+ writeTestPackageConfigWithMeta();
+ }
+
test_mixinOnSealedClass() async {
- addMetaPackage();
- _addPackage('foo', r'''
+ writeTestPackageConfigWith({
+ 'foo': '$workspaceRootPath/foo',
+ }, meta: true);
+
+ newFile('$workspaceRootPath/foo/lib/foo.dart', content: r'''
import 'package:meta/meta.dart';
@sealed class Foo {}
''');
- _newPubPackageRoot('/pkg1');
- newFile('/pkg1/lib/lib1.dart', content: r'''
+ await assertErrorsInCode(r'''
import 'package:foo/foo.dart';
mixin Bar on Foo {}
-''');
- await _resolveFile('/pkg1/lib/lib1.dart', [
+''', [
error(HintCode.MIXIN_ON_SEALED_CLASS, 31, 19),
]);
}
test_withinLibrary_OK() async {
- addMetaPackage();
-
- _newPubPackageRoot('/pkg1');
- newFile('/pkg1/lib/lib1.dart', content: r'''
+ await assertNoErrorsInCode(r'''
import 'package:meta/meta.dart';
@sealed class Foo {}
-
mixin Bar on Foo {}
''');
- await _resolveFile('/pkg1/lib/lib1.dart');
}
test_withinPackageLibDirectory_OK() async {
- addMetaPackage();
-
- _newPubPackageRoot('/pkg1');
- newFile('/pkg1/lib/lib1.dart', content: r'''
+ newFile('$testPackageLibPath/lib1.dart', content: r'''
import 'package:meta/meta.dart';
@sealed class Foo {}
''');
- newFile('/pkg1/lib/src/lib2.dart', content: r'''
+
+ newFile('$testPackageLibPath/src/lib2.dart', content: r'''
import '../lib1.dart';
mixin Bar on Foo {}
''');
- await _resolveFile('/pkg1/lib/lib1.dart');
- await _resolveFile('/pkg1/lib/src/lib2.dart');
+
+ await resolveFile2('$testPackageLibPath/lib1.dart');
+ assertNoErrorsInResult();
+
+ await resolveFile2('$testPackageLibPath/src/lib2.dart');
+ assertNoErrorsInResult();
}
test_withinPackageTestDirectory_OK() async {
- addMetaPackage();
-
- _newPubPackageRoot('/pkg1');
- newFile('/pkg1/lib/lib1.dart', content: r'''
+ newFile('$testPackageLibPath/lib1.dart', content: r'''
import 'package:meta/meta.dart';
@sealed class Foo {}
''');
- newFile('/pkg1/test/test.dart', content: r'''
-import '../lib/lib1.dart';
+
+ newFile('$testPackageRootPath/test/lib2.dart', content: r'''
+import 'package:test/lib1.dart';
mixin Bar on Foo {}
''');
- await _resolveFile('/pkg1/lib/lib1.dart');
- await _resolveFile('/pkg1/test/test.dart');
+
+ await resolveFile2('$testPackageLibPath/lib1.dart');
+ assertNoErrorsInResult();
+
+ await resolveFile2('$testPackageRootPath/test/lib2.dart');
+ assertNoErrorsInResult();
}
test_withinPart_OK() async {
- addMetaPackage();
-
- _newPubPackageRoot('/pkg1');
- newFile('/pkg1/lib/lib1.dart', content: r'''
+ newFile('$testPackageLibPath/lib1.dart', content: r'''
import 'package:meta/meta.dart';
part 'part1.dart';
@sealed class Foo {}
''');
- newFile('/pkg1/lib/part1.dart', content: r'''
+
+ newFile('$testPackageLibPath/part1.dart', content: r'''
part of 'lib1.dart';
mixin Bar on Foo {}
''');
- await _resolveFile('/pkg1/lib/lib1.dart');
- }
- /// Add a package named [name], and one library file, with content
- /// [libraryContent].
- void _addPackage(String name, String libraryContent) {
- Folder lib = addPubPackage(name);
- newFile(join(lib.path, '$name.dart'), content: libraryContent);
- }
+ await resolveFile2('$testPackageLibPath/lib1.dart');
+ assertNoErrorsInResult();
- /// Write a pubspec file at [root], so that BestPracticesVerifier can see
- /// that [root] is the root of a PubWorkspace, and a PubWorkspacePackage.
- void _newPubPackageRoot(String root) {
- newFile('$root/pubspec.yaml');
- configureWorkspace(root: root);
- }
-
- /// Resolve the file with the given [path].
- ///
- /// Similar to ResolutionTest.resolveTestFile, but a custom path is supported.
- Future<void> _resolveFile(
- String path, [
- List<ExpectedError> expectedErrors = const [],
- ]) async {
- result = await resolveFile(convertPath(path));
- assertErrorsInResolvedUnit(result, expectedErrors);
+ await resolveFile2('$testPackageLibPath/part1.dart');
+ assertNoErrorsInResult();
}
}
diff --git a/pkg/analyzer/test/src/diagnostics/test_all.dart b/pkg/analyzer/test/src/diagnostics/test_all.dart
index c166314..1f0b6d6 100644
--- a/pkg/analyzer/test/src/diagnostics/test_all.dart
+++ b/pkg/analyzer/test/src/diagnostics/test_all.dart
@@ -324,10 +324,6 @@
as invocation_of_extension_without_call;
import 'invocation_of_non_function_expression_test.dart'
as invocation_of_non_function_expression;
-import 'is_double_test.dart' as is_double;
-import 'is_int_test.dart' as is_int;
-import 'is_not_double_test.dart' as is_not_double;
-import 'is_not_int_test.dart' as is_not_int;
import 'label_in_outer_scope_test.dart' as label_in_outer_scope;
import 'label_undefined_test.dart' as label_undefined;
import 'late_final_field_with_const_constructor_test.dart'
@@ -844,10 +840,6 @@
invalid_visibility_annotation.main();
invocation_of_extension_without_call.main();
invocation_of_non_function_expression.main();
- is_double.main();
- is_int.main();
- is_not_double.main();
- is_not_int.main();
label_in_outer_scope.main();
label_undefined.main();
late_final_field_with_const_constructor.main();
diff --git a/runtime/bin/BUILD.gn b/runtime/bin/BUILD.gn
index 1b44cd3..2341506 100644
--- a/runtime/bin/BUILD.gn
+++ b/runtime/bin/BUILD.gn
@@ -1122,7 +1122,7 @@
sources = [
# This file must be compiled in for dynamic linking.
- "../include/dart_api_dl.cc",
+ "../include/dart_api_dl.c",
# The two files here do not depend on each other.
# flutter/flutter integration tests will only use `ffi_test_functions.cc` -
diff --git a/runtime/include/dart_api_dl.cc b/runtime/include/dart_api_dl.c
similarity index 78%
rename from runtime/include/dart_api_dl.cc
rename to runtime/include/dart_api_dl.c
index 5ab685d..7709a02 100644
--- a/runtime/include/dart_api_dl.cc
+++ b/runtime/include/dart_api_dl.c
@@ -10,25 +10,25 @@
#include <string.h>
-#define DART_API_DL_DEFINITIONS(name) \
- using name##Type = decltype(&name); \
- name##Type name##_DL = nullptr;
+#define DART_API_DL_DEFINITIONS(name, R, A) name##_Type name##_DL = NULL;
+
DART_API_ALL_DL_SYMBOLS(DART_API_DL_DEFINITIONS)
+
#undef DART_API_DL_DEFINITIONS
typedef void (*DartApiEntry_function)();
DartApiEntry_function FindFunctionPointer(const DartApiEntry* entries,
const char* name) {
- while (entries->name != nullptr) {
+ while (entries->name != NULL) {
if (strcmp(entries->name, name) == 0) return entries->function;
entries++;
}
- return nullptr;
+ return NULL;
}
intptr_t Dart_InitializeApiDL(void* data) {
- DartApi* dart_api_data = reinterpret_cast<DartApi*>(data);
+ DartApi* dart_api_data = (DartApi*)data;
if (dart_api_data->major != DART_API_DL_MAJOR_VERSION) {
// If the DartVM we're running on does not have the same version as this
@@ -49,9 +49,9 @@
const DartApiEntry* dart_api_function_pointers = dart_api_data->functions;
-#define DART_API_DL_INIT(name) \
- name##_DL = reinterpret_cast<name##Type>( \
- FindFunctionPointer(dart_api_function_pointers, #name));
+#define DART_API_DL_INIT(name, R, A) \
+ name##_DL = \
+ (name##_Type)(FindFunctionPointer(dart_api_function_pointers, #name));
DART_API_ALL_DL_SYMBOLS(DART_API_DL_INIT)
#undef DART_API_DL_INIT
diff --git a/runtime/include/dart_api_dl.h b/runtime/include/dart_api_dl.h
index 19fd0f3..85460c8 100644
--- a/runtime/include/dart_api_dl.h
+++ b/runtime/include/dart_api_dl.h
@@ -18,128 +18,110 @@
* All symbols are postfixed with _DL to indicate that they are dynamically
* linked and to prevent conflicts with the original symbol.
*
- * Link `dart_api_dl.cc` file into your library and invoke
+ * Link `dart_api_dl.c` file into your library and invoke
* `Dart_InitializeApiDL` with `NativeApi.initializeApiDLData`.
*/
-intptr_t Dart_InitializeApiDL(void* data);
+#ifdef __cplusplus
+#define DART_EXTERN extern "C"
+#else
+#define DART_EXTERN extern
+#endif
+DART_EXTERN intptr_t Dart_InitializeApiDL(void* data);
+
+// ============================================================================
// IMPORTANT! Never update these signatures without properly updating
// DART_API_DL_MAJOR_VERSION and DART_API_DL_MINOR_VERSION.
//
-// Verbatim copy of `dart_native_api.h` and `dart_api.h` symbols to trigger
-// compile-time errors if the sybols in those files are updated without
-// updating these.
+// Verbatim copy of `dart_native_api.h` and `dart_api.h` symbol names and types
+// to trigger compile-time errors if the sybols in those files are updated
+// without updating these.
//
-// Function signatures and typedefs are carbon copied. Structs are typechecked
-// nominally in C/C++, so they are not copied, instead a comment is added to
-// their definition.
+// Function return and argument types, and typedefs are carbon copied. Structs
+// are typechecked nominally in C/C++, so they are not copied, instead a
+// comment is added to their definition.
typedef int64_t Dart_Port_DL;
typedef void (*Dart_NativeMessageHandler_DL)(Dart_Port_DL dest_port_id,
Dart_CObject* message);
-DART_EXTERN_C bool (*Dart_PostCObject_DL)(Dart_Port_DL port_id,
- Dart_CObject* message);
+// dart_native_api.h symbols can be called on any thread.
+#define DART_NATIVE_API_DL_SYMBOLS(F) \
+ /***** dart_native_api.h *****/ \
+ /* Dart_Port */ \
+ F(Dart_PostCObject, bool, (Dart_Port_DL port_id, Dart_CObject * message)) \
+ F(Dart_PostInteger, bool, (Dart_Port_DL port_id, int64_t message)) \
+ F(Dart_NewNativePort, Dart_Port_DL, \
+ (const char* name, Dart_NativeMessageHandler_DL handler, \
+ bool handle_concurrently)) \
+ F(Dart_CloseNativePort, bool, (Dart_Port_DL native_port_id))
-DART_EXTERN_C bool (*Dart_PostInteger_DL)(Dart_Port_DL port_id,
- int64_t message);
+// dart_api.h symbols can only be called on Dart threads.
+#define DART_API_DL_SYMBOLS(F) \
+ /***** dart_api.h *****/ \
+ /* Errors */ \
+ F(Dart_IsError, bool, (Dart_Handle handle)) \
+ F(Dart_IsApiError, bool, (Dart_Handle handle)) \
+ F(Dart_IsUnhandledExceptionError, bool, (Dart_Handle handle)) \
+ F(Dart_IsCompilationError, bool, (Dart_Handle handle)) \
+ F(Dart_IsFatalError, bool, (Dart_Handle handle)) \
+ F(Dart_GetError, const char*, (Dart_Handle handle)) \
+ F(Dart_ErrorHasException, bool, (Dart_Handle handle)) \
+ F(Dart_ErrorGetException, Dart_Handle, (Dart_Handle handle)) \
+ F(Dart_ErrorGetStackTrace, Dart_Handle, (Dart_Handle handle)) \
+ F(Dart_NewApiError, Dart_Handle, (const char* error)) \
+ F(Dart_NewCompilationError, Dart_Handle, (const char* error)) \
+ F(Dart_NewUnhandledExceptionError, Dart_Handle, (Dart_Handle exception)) \
+ F(Dart_PropagateError, void, (Dart_Handle handle)) \
+ /* Dart_Handle, Dart_PersistentHandle, Dart_WeakPersistentHandle */ \
+ F(Dart_HandleFromPersistent, Dart_Handle, (Dart_PersistentHandle object)) \
+ F(Dart_HandleFromWeakPersistent, Dart_Handle, \
+ (Dart_WeakPersistentHandle object)) \
+ F(Dart_NewPersistentHandle, Dart_PersistentHandle, (Dart_Handle object)) \
+ F(Dart_SetPersistentHandle, void, \
+ (Dart_PersistentHandle obj1, Dart_Handle obj2)) \
+ F(Dart_DeletePersistentHandle, void, (Dart_PersistentHandle object)) \
+ F(Dart_NewWeakPersistentHandle, Dart_WeakPersistentHandle, \
+ (Dart_Handle object, void* peer, intptr_t external_allocation_size, \
+ Dart_WeakPersistentHandleFinalizer callback)) \
+ F(Dart_DeleteWeakPersistentHandle, void, (Dart_WeakPersistentHandle object)) \
+ F(Dart_UpdateExternalSize, void, \
+ (Dart_WeakPersistentHandle object, intptr_t external_allocation_size)) \
+ F(Dart_NewFinalizableHandle, Dart_FinalizableHandle, \
+ (Dart_Handle object, void* peer, intptr_t external_allocation_size, \
+ Dart_HandleFinalizer callback)) \
+ F(Dart_DeleteFinalizableHandle, void, \
+ (Dart_FinalizableHandle object, Dart_Handle strong_ref_to_object)) \
+ F(Dart_UpdateFinalizableExternalSize, void, \
+ (Dart_FinalizableHandle object, Dart_Handle strong_ref_to_object, \
+ intptr_t external_allocation_size)) \
+ /* Dart_Port */ \
+ F(Dart_Post, bool, (Dart_Port_DL port_id, Dart_Handle object)) \
+ F(Dart_NewSendPort, Dart_Handle, (Dart_Port_DL port_id)) \
+ F(Dart_SendPortGetId, Dart_Handle, \
+ (Dart_Handle port, Dart_Port_DL * port_id)) \
+ /* Scopes */ \
+ F(Dart_EnterScope, void, ()) \
+ F(Dart_ExitScope, void, ())
-DART_EXTERN_C Dart_Port_DL (*Dart_NewNativePort_DL)(
- const char* name,
- Dart_NativeMessageHandler_DL handler,
- bool handle_concurrently);
-
-DART_EXTERN_C bool (*Dart_CloseNativePort_DL)(Dart_Port_DL native_port_id);
-
-DART_EXTERN_C bool (*Dart_IsError_DL)(Dart_Handle handle);
-
-DART_EXTERN_C bool (*Dart_IsApiError_DL)(Dart_Handle handle);
-
-DART_EXTERN_C bool (*Dart_IsUnhandledExceptionError_DL)(Dart_Handle handle);
-
-DART_EXTERN_C bool (*Dart_IsCompilationError_DL)(Dart_Handle handle);
-
-DART_EXTERN_C bool (*Dart_IsFatalError_DL)(Dart_Handle handle);
-
-DART_EXTERN_C const char* (*Dart_GetError_DL)(Dart_Handle handle);
-
-DART_EXTERN_C bool (*Dart_ErrorHasException_DL)(Dart_Handle handle);
-
-DART_EXTERN_C Dart_Handle (*Dart_ErrorGetException_DL)(Dart_Handle handle);
-
-DART_EXTERN_C Dart_Handle (*Dart_ErrorGetStackTrace_DL)(Dart_Handle handle);
-
-DART_EXTERN_C Dart_Handle (*Dart_NewApiError_DL)(const char* error);
-
-DART_EXTERN_C Dart_Handle (*Dart_NewCompilationError_DL)(const char* error);
-
-DART_EXTERN_C Dart_Handle (*Dart_NewUnhandledExceptionError_DL)(
- Dart_Handle exception);
-
-DART_EXTERN_C void (*Dart_PropagateError_DL)(Dart_Handle handle);
-
-DART_EXTERN_C Dart_Handle (*Dart_ToString_DL)(Dart_Handle object);
-
-DART_EXTERN_C bool (*Dart_IdentityEquals_DL)(Dart_Handle obj1,
- Dart_Handle obj2);
-
-DART_EXTERN_C Dart_Handle (*Dart_HandleFromPersistent_DL)(
- Dart_PersistentHandle object);
-
-DART_EXTERN_C Dart_Handle (*Dart_HandleFromWeakPersistent_DL)(
- Dart_WeakPersistentHandle object);
-
-DART_EXTERN_C Dart_PersistentHandle (*Dart_NewPersistentHandle_DL)(
- Dart_Handle object);
-
-DART_EXTERN_C void (*Dart_SetPersistentHandle_DL)(Dart_PersistentHandle obj1,
- Dart_Handle obj2);
-
-DART_EXTERN_C void (*Dart_DeletePersistentHandle_DL)(
- Dart_PersistentHandle object);
-
-DART_EXTERN_C Dart_WeakPersistentHandle (*Dart_NewWeakPersistentHandle_DL)(
- Dart_Handle object,
- void* peer,
- intptr_t external_allocation_size,
- Dart_WeakPersistentHandleFinalizer callback);
-
-DART_EXTERN_C void (*Dart_DeleteWeakPersistentHandle_DL)(
- Dart_WeakPersistentHandle object);
-
-DART_EXTERN_C void (*Dart_UpdateExternalSize_DL)(
- Dart_WeakPersistentHandle object,
- intptr_t external_allocation_size);
-
-DART_EXTERN_C Dart_FinalizableHandle (*Dart_NewFinalizableHandle_DL)(
- Dart_Handle object,
- void* peer,
- intptr_t external_allocation_size,
- Dart_HandleFinalizer callback);
-
-DART_EXTERN_C void (*Dart_DeleteFinalizableHandle_DL)(
- Dart_FinalizableHandle object,
- Dart_Handle strong_ref_to_object);
-
-DART_EXTERN_C void (*Dart_UpdateFinalizableExternalSize_DL)(
- Dart_FinalizableHandle object,
- Dart_Handle strong_ref_to_object,
- intptr_t external_allocation_size);
-
-DART_EXTERN_C bool (*Dart_Post_DL)(Dart_Port_DL port_id, Dart_Handle object);
-
-DART_EXTERN_C Dart_Handle (*Dart_NewSendPort_DL)(Dart_Port_DL port_id);
-
-DART_EXTERN_C Dart_Handle (*Dart_SendPortGetId_DL)(Dart_Handle port,
- Dart_Port_DL* port_id);
-
-DART_EXTERN_C void (*Dart_EnterScope_DL)();
-
-DART_EXTERN_C void (*Dart_ExitScope_DL)();
+#define DART_API_ALL_DL_SYMBOLS(F) \
+ DART_NATIVE_API_DL_SYMBOLS(F) \
+ DART_API_DL_SYMBOLS(F)
// IMPORTANT! Never update these signatures without properly updating
// DART_API_DL_MAJOR_VERSION and DART_API_DL_MINOR_VERSION.
//
// End of verbatim copy.
+// ============================================================================
+
+#define DART_API_DL_DECLARATIONS(name, R, A) \
+ typedef R(*name##_Type) A; \
+ DART_EXTERN name##_Type name##_DL;
+
+DART_API_ALL_DL_SYMBOLS(DART_API_DL_DECLARATIONS)
+
+#undef DART_API_DL_DEFINITIONS
+
+#undef DART_EXTERN
#endif /* RUNTIME_INCLUDE_DART_API_DL_H_ */ /* NOLINT */
diff --git a/runtime/include/internal/dart_api_dl_impl.h b/runtime/include/internal/dart_api_dl_impl.h
index a306e2d..ad13a4b 100644
--- a/runtime/include/internal/dart_api_dl_impl.h
+++ b/runtime/include/internal/dart_api_dl_impl.h
@@ -7,65 +7,15 @@
#ifndef RUNTIME_INCLUDE_INTERNAL_DART_API_DL_IMPL_H_
#define RUNTIME_INCLUDE_INTERNAL_DART_API_DL_IMPL_H_
-// dart_native_api.h symbols can be called on any thread.
-#define DART_NATIVE_API_DL_SYMBOLS(F) \
- /***** dart_native_api.h *****/ \
- /* Dart_Port */ \
- F(Dart_PostCObject) \
- F(Dart_PostInteger) \
- F(Dart_NewNativePort) \
- F(Dart_CloseNativePort)
-
-// dart_api.h symbols can only be called on Dart threads.
-#define DART_API_DL_SYMBOLS(F) \
- /***** dart_api.h *****/ \
- /* Errors */ \
- F(Dart_IsError) \
- F(Dart_IsApiError) \
- F(Dart_IsUnhandledExceptionError) \
- F(Dart_IsCompilationError) \
- F(Dart_IsFatalError) \
- F(Dart_GetError) \
- F(Dart_ErrorHasException) \
- F(Dart_ErrorGetException) \
- F(Dart_ErrorGetStackTrace) \
- F(Dart_NewApiError) \
- F(Dart_NewCompilationError) \
- F(Dart_NewUnhandledExceptionError) \
- F(Dart_PropagateError) \
- /* Dart_Handle, Dart_PersistentHandle, Dart_WeakPersistentHandle */ \
- F(Dart_NewPersistentHandle) \
- F(Dart_SetPersistentHandle) \
- F(Dart_HandleFromPersistent) \
- F(Dart_DeletePersistentHandle) \
- F(Dart_NewWeakPersistentHandle) \
- F(Dart_HandleFromWeakPersistent) \
- F(Dart_DeleteWeakPersistentHandle) \
- F(Dart_UpdateExternalSize) \
- F(Dart_NewFinalizableHandle) \
- F(Dart_DeleteFinalizableHandle) \
- F(Dart_UpdateFinalizableExternalSize) \
- /* Dart_Port */ \
- F(Dart_Post) \
- F(Dart_NewSendPort) \
- F(Dart_SendPortGetId) \
- /* Scopes */ \
- F(Dart_EnterScope) \
- F(Dart_ExitScope)
-
-#define DART_API_ALL_DL_SYMBOLS(F) \
- DART_NATIVE_API_DL_SYMBOLS(F) \
- DART_API_DL_SYMBOLS(F)
-
-struct DartApiEntry {
+typedef struct {
const char* name;
void (*function)();
-};
+} DartApiEntry;
-struct DartApi {
+typedef struct {
const int major;
const int minor;
const DartApiEntry* const functions;
-};
+} DartApi;
#endif /* RUNTIME_INCLUDE_INTERNAL_DART_API_DL_IMPL_H_ */ /* NOLINT */
diff --git a/runtime/lib/ffi.cc b/runtime/lib/ffi.cc
index 1a8bc20..3c4a07c 100644
--- a/runtime/lib/ffi.cc
+++ b/runtime/lib/ffi.cc
@@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
#include "include/dart_api.h"
+#include "include/dart_api_dl.h"
#include "include/dart_native_api.h"
#include "include/dart_version.h"
#include "include/internal/dart_api_dl_impl.h"
@@ -501,7 +502,7 @@
GET_NON_NULL_NATIVE_ARGUMENT(String, name_dart, arguments->NativeArgAt(0));
const char* name = name_dart.ToCString();
-#define RETURN_FUNCTION_ADDRESS(function_name) \
+#define RETURN_FUNCTION_ADDRESS(function_name, R, A) \
if (strcmp(name, #function_name) == 0) { \
return Integer::New(reinterpret_cast<intptr_t>(function_name)); \
}
@@ -522,7 +523,8 @@
}
static const DartApiEntry dart_api_entries[] = {
-#define ENTRY(name) DartApiEntry{#name, reinterpret_cast<void (*)()>(name)},
+#define ENTRY(name, R, A) \
+ DartApiEntry{#name, reinterpret_cast<void (*)()>(name)},
DART_API_ALL_DL_SYMBOLS(ENTRY)
#undef ENTRY
DartApiEntry{nullptr, nullptr}};
diff --git a/tools/VERSION b/tools/VERSION
index 0ce42a7..ab87528 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -1,31 +1 @@
-# This file is used by tools/utils.py to generate version strings.
-# The numbers are changed as follows:
-#
-# * New release cycle has begun (i.e. stable release was just made):
-# - increase MINOR by 1
-# - set "PATCH 0"
-# - set "PRERELEASE 0"
-# - set "PRERELEASE_PATCH 0"
-#
-# * Doing a push-to-trunk from bleeding_edge:
-# (The first push-to-trunk in the release cycle will set PRERELEASE to 0)
-# - increase PRERELEASE by 1
-# - set "PRERELEASE_PATCH 0"
-#
-# * Doing a cherry-pick to trunk:
-# - increase PRERELEASE_PATCH by 1
-#
-# * Making a stable release (i.e. new stable branch):
-# - set "PRERELEASE 0"
-# - set "PRERELEASE_PATCH 0"
-# The new stable release version will sort higher than the prereleases.
-#
-# * Making cherry-picks to stable channel
-# - increase PATCH by 1
-#
-CHANNEL dev
-MAJOR 2
-MINOR 10
-PATCH 0
-PRERELEASE 7
-PRERELEASE_PATCH 0
+PRERELEASE_PATCH 0
\ No newline at end of file