Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1504)

Unified Diff: pkg/analyzer/test/generated/parser_fasta_test.dart

Issue 3003263002: add support for native methods in class
Patch Set: update listeners Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/test/generated/parser_fasta_test.dart
diff --git a/pkg/analyzer/test/generated/parser_fasta_test.dart b/pkg/analyzer/test/generated/parser_fasta_test.dart
index 3a04e869745bf61184842b431775bc95ae02a1ef..543b736c540d04c31fcd3f8852e150d085048c9d 100644
--- a/pkg/analyzer/test/generated/parser_fasta_test.dart
+++ b/pkg/analyzer/test/generated/parser_fasta_test.dart
@@ -62,6 +62,43 @@ class ClassMemberParserTest_Fasta extends FastaParserTestCase
// TODO(paulberry): Fasta doesn't support asserts in initializers
super.test_parseConstructor_assert();
}
+
+ void test_parseClassMember_method_native_allowed() {
+ allowNativeClause = true;
+ test_parseClassMember_method_native();
+ }
+
+ void test_parseClassMember_method_native_not_allowed() {
+ allowNativeClause = false;
+ test_parseClassMember_method_native();
+ }
+
+ void test_parseClassMember_method_native_missing_literal() {
+ createParser('m() native;');
+ var method = parser.parseClassMember('C') as MethodDeclaration;
+ if (!allowNativeClause) {
+ assertErrorsWithCodes([
+ ParserErrorCode.NATIVE_CLAUSE_SHOULD_BE_ANNOTATION,
+ ]);
+ } else {
+ assertNoErrors();
+ }
+
+ var body = method.body as NativeFunctionBody;
+ expect(body.nativeKeyword, isNotNull);
+ expect(body.stringLiteral, isNull);
+ expect(body.semicolon, isNotNull);
+ }
+
+ void test_parseClassMember_method_native_missing_literal_allowed() {
+ allowNativeClause = true;
+ test_parseClassMember_method_native_missing_literal();
+ }
+
+ void test_parseClassMember_method_native_missing_literal_not_allowed() {
+ allowNativeClause = false;
+ test_parseClassMember_method_native_missing_literal();
+ }
}
/**

Powered by Google App Engine
This is Rietveld 408576698