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

Side by Side Diff: pkg/analyzer/test/generated/non_error_resolver_test.dart

Issue 2435013003: Teach analyzer parser to handle native const factories/const constructors. (Closed)
Patch Set: add a test Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « pkg/analyzer/lib/src/generated/parser.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library analyzer.test.generated.non_error_resolver_test; 5 library analyzer.test.generated.non_error_resolver_test;
6 6
7 import 'package:analyzer/dart/ast/ast.dart'; 7 import 'package:analyzer/dart/ast/ast.dart';
8 import 'package:analyzer/dart/element/element.dart'; 8 import 'package:analyzer/dart/element/element.dart';
9 import 'package:analyzer/error/error.dart'; 9 import 'package:analyzer/error/error.dart';
10 import 'package:analyzer/src/error/codes.dart'; 10 import 'package:analyzer/src/error/codes.dart';
(...skipping 3709 matching lines...) Expand 10 before | Expand all | Expand 10 after
3720 3720
3721 void test_nativeFunctionBodyInNonSDKCode_function() { 3721 void test_nativeFunctionBodyInNonSDKCode_function() {
3722 Source source = addSource(r''' 3722 Source source = addSource(r'''
3723 import 'dart-ext:x'; 3723 import 'dart-ext:x';
3724 int m(a) native 'string';'''); 3724 int m(a) native 'string';''');
3725 computeLibrarySourceErrors(source); 3725 computeLibrarySourceErrors(source);
3726 assertNoErrors(source); 3726 assertNoErrors(source);
3727 // Cannot verify the AST because the import's URI cannot be resolved. 3727 // Cannot verify the AST because the import's URI cannot be resolved.
3728 } 3728 }
3729 3729
3730 void test_nativeConstConstructor() {
3731 Source source = addSource(r'''
3732 import 'dart-ext:x';
3733 class Foo {
3734 const Foo() native 'Foo_Foo';
3735 const factory Foo.foo() native 'Foo_Foo_foo';
3736 }''');
3737 computeLibrarySourceErrors(source);
3738 assertNoErrors(source);
3739 // Cannot verify the AST because the import's URI cannot be resolved.
3740 }
3741
3730 void test_newWithAbstractClass_factory() { 3742 void test_newWithAbstractClass_factory() {
3731 Source source = addSource(r''' 3743 Source source = addSource(r'''
3732 abstract class A { 3744 abstract class A {
3733 factory A() { return new B(); } 3745 factory A() { return new B(); }
3734 } 3746 }
3735 class B implements A { 3747 class B implements A {
3736 B() {} 3748 B() {}
3737 } 3749 }
3738 A f() { 3750 A f() {
3739 return new A(); 3751 return new A();
(...skipping 2487 matching lines...) Expand 10 before | Expand all | Expand 10 after
6227 reset(); 6239 reset();
6228 } 6240 }
6229 6241
6230 void _check_wrongNumberOfParametersForOperator1(String name) { 6242 void _check_wrongNumberOfParametersForOperator1(String name) {
6231 _check_wrongNumberOfParametersForOperator(name, "a"); 6243 _check_wrongNumberOfParametersForOperator(name, "a");
6232 } 6244 }
6233 6245
6234 CompilationUnit _getResolvedLibraryUnit(Source source) => 6246 CompilationUnit _getResolvedLibraryUnit(Source source) =>
6235 analysisContext.getResolvedCompilationUnit2(source, source); 6247 analysisContext.getResolvedCompilationUnit2(source, source);
6236 } 6248 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/parser.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698