OLD | NEW |
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.resolver_test; | 5 library analyzer.test.generated.resolver_test; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 | 8 |
9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
10 import 'package:analyzer/dart/ast/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
(...skipping 3534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3545 abstract class B implements A { | 3545 abstract class B implements A { |
3546 b(int i) { | 3546 b(int i) { |
3547 a = i; | 3547 a = i; |
3548 } | 3548 } |
3549 }'''); | 3549 }'''); |
3550 computeLibrarySourceErrors(source); | 3550 computeLibrarySourceErrors(source); |
3551 assertErrors(source, [HintCode.INVALID_USE_OF_PROTECTED_MEMBER]); | 3551 assertErrors(source, [HintCode.INVALID_USE_OF_PROTECTED_MEMBER]); |
3552 verify([source]); | 3552 verify([source]); |
3553 } | 3553 } |
3554 | 3554 |
| 3555 void test_invalidUseOfProtectedMember_topLevelVariable() { |
| 3556 Source source = addSource(r''' |
| 3557 import 'package:meta/meta.dart'; |
| 3558 @protected |
| 3559 int x = 0; |
| 3560 main() { |
| 3561 print(x); |
| 3562 }'''); |
| 3563 computeLibrarySourceErrors(source); |
| 3564 // TODO(brianwilkerson) This should produce a hint because the annotation is |
| 3565 // being applied to the wrong kind of declaration. |
| 3566 assertNoErrors(source); |
| 3567 verify([source]); |
| 3568 } |
| 3569 |
3555 void test_isDouble() { | 3570 void test_isDouble() { |
3556 AnalysisOptionsImpl options = new AnalysisOptionsImpl(); | 3571 AnalysisOptionsImpl options = new AnalysisOptionsImpl(); |
3557 options.dart2jsHint = true; | 3572 options.dart2jsHint = true; |
3558 resetWithOptions(options); | 3573 resetWithOptions(options); |
3559 Source source = addSource("var v = 1 is double;"); | 3574 Source source = addSource("var v = 1 is double;"); |
3560 computeLibrarySourceErrors(source); | 3575 computeLibrarySourceErrors(source); |
3561 assertErrors(source, [HintCode.IS_DOUBLE]); | 3576 assertErrors(source, [HintCode.IS_DOUBLE]); |
3562 verify([source]); | 3577 verify([source]); |
3563 } | 3578 } |
3564 | 3579 |
(...skipping 13745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17310 | 17325 |
17311 void _resolveTestUnit(String code) { | 17326 void _resolveTestUnit(String code) { |
17312 testCode = code; | 17327 testCode = code; |
17313 testSource = addSource(testCode); | 17328 testSource = addSource(testCode); |
17314 LibraryElement library = resolve2(testSource); | 17329 LibraryElement library = resolve2(testSource); |
17315 assertNoErrors(testSource); | 17330 assertNoErrors(testSource); |
17316 verify([testSource]); | 17331 verify([testSource]); |
17317 testUnit = resolveCompilationUnit(testSource, library); | 17332 testUnit = resolveCompilationUnit(testSource, library); |
17318 } | 17333 } |
17319 } | 17334 } |
OLD | NEW |