| 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 engine.incremental_resolver_test; | 5 library engine.incremental_resolver_test; |
| 6 | 6 |
| 7 import 'package:analyzer/src/generated/ast.dart'; | 7 import 'package:analyzer/src/generated/ast.dart'; |
| 8 import 'package:analyzer/src/generated/element.dart'; | 8 import 'package:analyzer/src/generated/element.dart'; |
| 9 import 'package:analyzer/src/generated/engine.dart'; | 9 import 'package:analyzer/src/generated/engine.dart'; |
| 10 import 'package:analyzer/src/generated/error.dart'; | 10 import 'package:analyzer/src/generated/error.dart'; |
| (...skipping 1921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1932 _resolveUnit(r''' | 1932 _resolveUnit(r''' |
| 1933 class A { | 1933 class A { |
| 1934 int f; | 1934 int f; |
| 1935 A(int a, int b) { | 1935 A(int a, int b) { |
| 1936 f = a + b; | 1936 f = a + b; |
| 1937 } | 1937 } |
| 1938 }'''); | 1938 }'''); |
| 1939 _resolve(_editString('+', '*'), _isFunctionBody); | 1939 _resolve(_editString('+', '*'), _isFunctionBody); |
| 1940 } | 1940 } |
| 1941 | 1941 |
| 1942 void test_constructor_fieldFormalParameter() { |
| 1943 _resolveUnit(r''' |
| 1944 class A { |
| 1945 int xy; |
| 1946 A(this.x); |
| 1947 }'''); |
| 1948 _resolve(_editString('this.x', 'this.xy'), _isDeclaration); |
| 1949 } |
| 1950 |
| 1942 void test_constructor_fieldInitializer_add() { | 1951 void test_constructor_fieldInitializer_add() { |
| 1943 _resolveUnit(r''' | 1952 _resolveUnit(r''' |
| 1944 class A { | 1953 class A { |
| 1945 int f; | 1954 int f; |
| 1946 A(int a, int b); | 1955 A(int a, int b); |
| 1947 }'''); | 1956 }'''); |
| 1948 _resolve(_editString(');', ') : f = a + b;'), _isClassMember); | 1957 _resolve(_editString(');', ') : f = a + b;'), _isClassMember); |
| 1949 } | 1958 } |
| 1950 | 1959 |
| 1951 void test_constructor_fieldInitializer_edit() { | 1960 void test_constructor_fieldInitializer_edit() { |
| (...skipping 2085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4037 } | 4046 } |
| 4038 | 4047 |
| 4039 @override | 4048 @override |
| 4040 visitYieldStatement(YieldStatement node) { | 4049 visitYieldStatement(YieldStatement node) { |
| 4041 YieldStatement other = this.other; | 4050 YieldStatement other = this.other; |
| 4042 _visitNode(node.expression, other.expression); | 4051 _visitNode(node.expression, other.expression); |
| 4043 } | 4052 } |
| 4044 | 4053 |
| 4045 void _verifyElement(Element a, Element b) { | 4054 void _verifyElement(Element a, Element b) { |
| 4046 if (a != b) { | 4055 if (a != b) { |
| 4056 print(a.location); |
| 4057 print(b.location); |
| 4047 fail('Expected: $b\n Actual: $a'); | 4058 fail('Expected: $b\n Actual: $a'); |
| 4048 } | 4059 } |
| 4049 if (a == null && b == null) { | 4060 if (a == null && b == null) { |
| 4050 return; | 4061 return; |
| 4051 } | 4062 } |
| 4052 if (a.nameOffset != b.nameOffset) { | 4063 if (a.nameOffset != b.nameOffset) { |
| 4053 fail('Expected: ${b.nameOffset}\n Actual: ${a.nameOffset}'); | 4064 fail('Expected: ${b.nameOffset}\n Actual: ${a.nameOffset}'); |
| 4054 } | 4065 } |
| 4055 } | 4066 } |
| 4056 | 4067 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4108 _visitList(node.metadata, other.metadata); | 4119 _visitList(node.metadata, other.metadata); |
| 4109 _visitNode(node.identifier, other.identifier); | 4120 _visitNode(node.identifier, other.identifier); |
| 4110 } | 4121 } |
| 4111 | 4122 |
| 4112 static void assertSameResolution(CompilationUnit actual, | 4123 static void assertSameResolution(CompilationUnit actual, |
| 4113 CompilationUnit expected) { | 4124 CompilationUnit expected) { |
| 4114 _SameResolutionValidator validator = new _SameResolutionValidator(expected); | 4125 _SameResolutionValidator validator = new _SameResolutionValidator(expected); |
| 4115 actual.accept(validator); | 4126 actual.accept(validator); |
| 4116 } | 4127 } |
| 4117 } | 4128 } |
| OLD | NEW |