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(); |
+ } |
} |
/** |