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

Unified Diff: pkg/analyzer/test/src/task/dart_test.dart

Issue 1052413003: Make two getters public (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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
« no previous file with comments | « pkg/analyzer/lib/src/generated/resolver.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/src/task/dart_test.dart
diff --git a/pkg/analyzer/test/src/task/dart_test.dart b/pkg/analyzer/test/src/task/dart_test.dart
index dd257394935c60a5957f0c7e8eee11c14cfc9fdf..f19e80da75255fc68f589d4cb36d180a5c72c551 100644
--- a/pkg/analyzer/test/src/task/dart_test.dart
+++ b/pkg/analyzer/test/src/task/dart_test.dart
@@ -1566,6 +1566,16 @@ NoSuchClass f() => null;
@reflectiveTest
class ResolveVariableReferencesTaskTest extends _AbstractDartTaskTest {
+ /**
+ * Verify that the mutated states of the given [variable] correspond to the
+ * [mutatedInClosure] and [mutatedInScope] matchers.
+ */
+ void expectMutated(VariableElement variable, Matcher mutatedInClosure,
+ Matcher mutatedInScope) {
+ expect(variable.isPotentiallyMutatedInClosure, mutatedInClosure);
+ expect(variable.isPotentiallyMutatedInScope, mutatedInScope);
+ }
+
test_perform_local() {
Source source = _newSource('/test.dart', '''
main() {
@@ -1587,26 +1597,10 @@ main() {
// validate
CompilationUnit unit = outputs[RESOLVED_UNIT5];
FunctionElement main = unit.element.functions[0];
- {
- var v1 = main.localVariables[0] as VariableElementImpl;
- expect(v1.isPotentiallyMutatedInClosure, isFalse);
- expect(v1.isPotentiallyMutatedInScope, isFalse);
- }
- {
- var v2 = main.localVariables[1] as VariableElementImpl;
- expect(v2.isPotentiallyMutatedInClosure, isFalse);
- expect(v2.isPotentiallyMutatedInScope, isTrue);
- }
- {
- var v3 = main.localVariables[2] as VariableElementImpl;
- expect(v3.isPotentiallyMutatedInClosure, isTrue);
- expect(v3.isPotentiallyMutatedInScope, isTrue);
- }
- {
- var v4 = main.localVariables[3] as VariableElementImpl;
- expect(v4.isPotentiallyMutatedInClosure, isTrue);
- expect(v4.isPotentiallyMutatedInScope, isTrue);
- }
+ expectMutated(main.localVariables[0], isFalse, isFalse);
+ expectMutated(main.localVariables[1], isFalse, isTrue);
+ expectMutated(main.localVariables[2], isTrue, isTrue);
+ expectMutated(main.localVariables[3], isTrue, isTrue);
}
test_perform_parameter() {
@@ -1626,26 +1620,10 @@ main(p1, p2, p3, p4) {
// validate
CompilationUnit unit = outputs[RESOLVED_UNIT5];
FunctionElement main = unit.element.functions[0];
- {
- var p1 = main.parameters[0] as VariableElementImpl;
- expect(p1.isPotentiallyMutatedInClosure, isFalse);
- expect(p1.isPotentiallyMutatedInScope, isFalse);
- }
- {
- var p2 = main.parameters[1] as VariableElementImpl;
- expect(p2.isPotentiallyMutatedInClosure, isFalse);
- expect(p2.isPotentiallyMutatedInScope, isTrue);
- }
- {
- var p3 = main.parameters[2] as VariableElementImpl;
- expect(p3.isPotentiallyMutatedInClosure, isTrue);
- expect(p3.isPotentiallyMutatedInScope, isTrue);
- }
- {
- var p4 = main.parameters[3] as VariableElementImpl;
- expect(p4.isPotentiallyMutatedInClosure, isTrue);
- expect(p4.isPotentiallyMutatedInScope, isTrue);
- }
+ expectMutated(main.parameters[0], isFalse, isFalse);
+ expectMutated(main.parameters[1], isFalse, isTrue);
+ expectMutated(main.parameters[2], isTrue, isTrue);
+ expectMutated(main.parameters[3], isTrue, isTrue);
}
}
« no previous file with comments | « pkg/analyzer/lib/src/generated/resolver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698