| OLD | NEW |
| 1 // This code was auto-generated, is not intended to be edited, and is subject to | 1 // This code was auto-generated, is not intended to be edited, and is subject to |
| 2 // significant change. Please see the README file for more information. | 2 // significant change. Please see the README file for more information. |
| 3 | 3 |
| 4 library engine.resolver_test; | 4 library engine.resolver_test; |
| 5 | 5 |
| 6 import 'dart:collection'; | 6 import 'dart:collection'; |
| 7 import 'package:analyzer_experimental/src/generated/java_core.dart'; | 7 import 'package:analyzer_experimental/src/generated/java_core.dart'; |
| 8 import 'package:analyzer_experimental/src/generated/java_engine.dart'; | 8 import 'package:analyzer_experimental/src/generated/java_engine.dart'; |
| 9 import 'package:analyzer_experimental/src/generated/java_junit.dart'; | 9 import 'package:analyzer_experimental/src/generated/java_junit.dart'; |
| 10 import 'package:analyzer_experimental/src/generated/source_io.dart'; | 10 import 'package:analyzer_experimental/src/generated/source_io.dart'; |
| 11 import 'package:analyzer_experimental/src/generated/error.dart'; | 11 import 'package:analyzer_experimental/src/generated/error.dart'; |
| 12 import 'package:analyzer_experimental/src/generated/scanner.dart'; | 12 import 'package:analyzer_experimental/src/generated/scanner.dart'; |
| 13 import 'package:analyzer_experimental/src/generated/ast.dart' hide Annotation; |
| 14 import 'package:analyzer_experimental/src/generated/parser.dart' show ParserErro
rCode; |
| 13 import 'package:analyzer_experimental/src/generated/element.dart'; | 15 import 'package:analyzer_experimental/src/generated/element.dart'; |
| 14 import 'package:analyzer_experimental/src/generated/resolver.dart'; | 16 import 'package:analyzer_experimental/src/generated/resolver.dart'; |
| 15 import 'package:analyzer_experimental/src/generated/engine.dart'; | 17 import 'package:analyzer_experimental/src/generated/engine.dart'; |
| 16 import 'package:analyzer_experimental/src/generated/java_engine_io.dart'; | 18 import 'package:analyzer_experimental/src/generated/java_engine_io.dart'; |
| 17 import 'package:analyzer_experimental/src/generated/ast.dart' hide Annotation; | |
| 18 import 'package:analyzer_experimental/src/generated/sdk.dart' show DartSdk; | 19 import 'package:analyzer_experimental/src/generated/sdk.dart' show DartSdk; |
| 20 import 'package:analyzer_experimental/src/generated/sdk_io.dart' show DirectoryB
asedDartSdk; |
| 19 import 'package:unittest/unittest.dart' as _ut; | 21 import 'package:unittest/unittest.dart' as _ut; |
| 20 import 'test_support.dart'; | 22 import 'test_support.dart'; |
| 21 import 'ast_test.dart' show ASTFactory; | 23 import 'ast_test.dart' show ASTFactory; |
| 22 import 'element_test.dart' show ElementFactory; | 24 import 'element_test.dart' show ElementFactory; |
| 23 | 25 |
| 26 class TypePropagationTest extends ResolverTestCase { |
| 27 void test_as() { |
| 28 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " bool get g => true;", "}", "A f(var p) {", " if ((p as A).g) {", "
return p;", " } else {", " return null;", " }", "}"])); |
| 29 LibraryElement library = resolve(source, []); |
| 30 assertNoErrors(); |
| 31 verify([source]); |
| 32 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 33 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; |
| 34 InterfaceType typeA = classA.element.type; |
| 35 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; |
| 36 BlockFunctionBody body6 = function.functionExpression.body as BlockFunctionB
ody; |
| 37 IfStatement ifStatement = body6.block.statements[0] as IfStatement; |
| 38 ReturnStatement statement = ((ifStatement.thenStatement as Block)).statement
s[0] as ReturnStatement; |
| 39 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; |
| 40 JUnitTestCase.assertSame(typeA, variableName.staticType); |
| 41 } |
| 42 void test_assert() { |
| 43 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "A f(var p) {", " assert (p is A);", " return p;", "}"])); |
| 44 LibraryElement library = resolve(source, []); |
| 45 assertNoErrors(); |
| 46 verify([source]); |
| 47 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 48 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; |
| 49 InterfaceType typeA = classA.element.type; |
| 50 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; |
| 51 BlockFunctionBody body7 = function.functionExpression.body as BlockFunctionB
ody; |
| 52 ReturnStatement statement = body7.block.statements[1] as ReturnStatement; |
| 53 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; |
| 54 JUnitTestCase.assertSame(typeA, variableName.staticType); |
| 55 } |
| 56 void test_assignment() { |
| 57 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " var v;", " v = 0;", " return v;", "}"])); |
| 58 LibraryElement library = resolve(source, []); |
| 59 assertNoErrors(); |
| 60 verify([source]); |
| 61 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 62 FunctionDeclaration function = unit.declarations[0] as FunctionDeclaration; |
| 63 BlockFunctionBody body8 = function.functionExpression.body as BlockFunctionB
ody; |
| 64 ReturnStatement statement = body8.block.statements[2] as ReturnStatement; |
| 65 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; |
| 66 JUnitTestCase.assertSame(typeProvider.intType, variableName.staticType); |
| 67 } |
| 68 void test_assignment_afterInitializer() { |
| 69 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " var v = 0;", " v = 1.0;", " return v;", "}"])); |
| 70 LibraryElement library = resolve(source, []); |
| 71 assertNoErrors(); |
| 72 verify([source]); |
| 73 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 74 FunctionDeclaration function = unit.declarations[0] as FunctionDeclaration; |
| 75 BlockFunctionBody body9 = function.functionExpression.body as BlockFunctionB
ody; |
| 76 ReturnStatement statement = body9.block.statements[2] as ReturnStatement; |
| 77 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; |
| 78 JUnitTestCase.assertSame(typeProvider.doubleType, variableName.staticType); |
| 79 } |
| 80 void test_initializer() { |
| 81 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " var v = 0;", " return v;", "}"])); |
| 82 LibraryElement library = resolve(source, []); |
| 83 assertNoErrors(); |
| 84 verify([source]); |
| 85 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 86 FunctionDeclaration function = unit.declarations[0] as FunctionDeclaration; |
| 87 BlockFunctionBody body10 = function.functionExpression.body as BlockFunction
Body; |
| 88 ReturnStatement statement = body10.block.statements[1] as ReturnStatement; |
| 89 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; |
| 90 JUnitTestCase.assertSame(typeProvider.intType, variableName.staticType); |
| 91 } |
| 92 void test_is_conditional() { |
| 93 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "A f(var p) {", " return (p is A) ? p : null;", "}"])); |
| 94 LibraryElement library = resolve(source, []); |
| 95 assertNoErrors(); |
| 96 verify([source]); |
| 97 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 98 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; |
| 99 InterfaceType typeA = classA.element.type; |
| 100 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; |
| 101 BlockFunctionBody body11 = function.functionExpression.body as BlockFunction
Body; |
| 102 ReturnStatement statement = body11.block.statements[0] as ReturnStatement; |
| 103 ConditionalExpression conditional = statement.expression as ConditionalExpre
ssion; |
| 104 SimpleIdentifier variableName = conditional.thenExpression as SimpleIdentifi
er; |
| 105 JUnitTestCase.assertSame(typeA, variableName.staticType); |
| 106 } |
| 107 void test_is_if() { |
| 108 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "A f(var p) {", " if (p is A) {", " return p;", " } else {", " re
turn null;", " }", "}"])); |
| 109 LibraryElement library = resolve(source, []); |
| 110 assertNoErrors(); |
| 111 verify([source]); |
| 112 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 113 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; |
| 114 InterfaceType typeA = classA.element.type; |
| 115 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; |
| 116 BlockFunctionBody body12 = function.functionExpression.body as BlockFunction
Body; |
| 117 IfStatement ifStatement = body12.block.statements[0] as IfStatement; |
| 118 ReturnStatement statement = ((ifStatement.thenStatement as Block)).statement
s[0] as ReturnStatement; |
| 119 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; |
| 120 JUnitTestCase.assertSame(typeA, variableName.staticType); |
| 121 } |
| 122 void test_is_if_logicalAnd() { |
| 123 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "A f(var p) {", " if (p is A && p != null) {", " return p;", " } els
e {", " return null;", " }", "}"])); |
| 124 LibraryElement library = resolve(source, []); |
| 125 assertNoErrors(); |
| 126 verify([source]); |
| 127 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 128 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; |
| 129 InterfaceType typeA = classA.element.type; |
| 130 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; |
| 131 BlockFunctionBody body13 = function.functionExpression.body as BlockFunction
Body; |
| 132 IfStatement ifStatement = body13.block.statements[0] as IfStatement; |
| 133 ReturnStatement statement = ((ifStatement.thenStatement as Block)).statement
s[0] as ReturnStatement; |
| 134 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; |
| 135 JUnitTestCase.assertSame(typeA, variableName.staticType); |
| 136 } |
| 137 void test_is_postConditional() { |
| 138 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "A f(var p) {", " A a = (p is A) ? p : throw null;", " return p;", "}"]
)); |
| 139 LibraryElement library = resolve(source, []); |
| 140 assertNoErrors(); |
| 141 verify([source]); |
| 142 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 143 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; |
| 144 InterfaceType typeA = classA.element.type; |
| 145 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; |
| 146 BlockFunctionBody body14 = function.functionExpression.body as BlockFunction
Body; |
| 147 ReturnStatement statement = body14.block.statements[1] as ReturnStatement; |
| 148 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; |
| 149 JUnitTestCase.assertSame(typeA, variableName.staticType); |
| 150 } |
| 151 void test_is_postIf() { |
| 152 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "A f(var p) {", " if (p is A) {", " A a = p;", " } else {", " ret
urn null;", " }", " return p;", "}"])); |
| 153 LibraryElement library = resolve(source, []); |
| 154 assertNoErrors(); |
| 155 verify([source]); |
| 156 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 157 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; |
| 158 InterfaceType typeA = classA.element.type; |
| 159 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; |
| 160 BlockFunctionBody body15 = function.functionExpression.body as BlockFunction
Body; |
| 161 ReturnStatement statement = body15.block.statements[1] as ReturnStatement; |
| 162 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; |
| 163 JUnitTestCase.assertSame(typeA, variableName.staticType); |
| 164 } |
| 165 void test_is_subclass() { |
| 166 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "class B extends A {", " B m() => this;", "}", "A f(A p) {", " if (p is
B) {", " return p.m();", " }", "}"])); |
| 167 LibraryElement library = resolve(source, []); |
| 168 assertNoErrors(); |
| 169 verify([source]); |
| 170 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 171 FunctionDeclaration function = unit.declarations[2] as FunctionDeclaration; |
| 172 BlockFunctionBody body16 = function.functionExpression.body as BlockFunction
Body; |
| 173 IfStatement ifStatement = body16.block.statements[0] as IfStatement; |
| 174 ReturnStatement statement = ((ifStatement.thenStatement as Block)).statement
s[0] as ReturnStatement; |
| 175 MethodInvocation invocation = statement.expression as MethodInvocation; |
| 176 JUnitTestCase.assertNotNull(invocation.methodName.element); |
| 177 } |
| 178 void test_isNot_conditional() { |
| 179 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "A f(var p) {", " return (p is! A) ? null : p;", "}"])); |
| 180 LibraryElement library = resolve(source, []); |
| 181 assertNoErrors(); |
| 182 verify([source]); |
| 183 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 184 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; |
| 185 InterfaceType typeA = classA.element.type; |
| 186 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; |
| 187 BlockFunctionBody body17 = function.functionExpression.body as BlockFunction
Body; |
| 188 ReturnStatement statement = body17.block.statements[0] as ReturnStatement; |
| 189 ConditionalExpression conditional = statement.expression as ConditionalExpre
ssion; |
| 190 SimpleIdentifier variableName = conditional.elseExpression as SimpleIdentifi
er; |
| 191 JUnitTestCase.assertSame(typeA, variableName.staticType); |
| 192 } |
| 193 void test_isNot_if() { |
| 194 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "A f(var p) {", " if (p is! A) {", " return null;", " } else {", "
return p;", " }", "}"])); |
| 195 LibraryElement library = resolve(source, []); |
| 196 assertNoErrors(); |
| 197 verify([source]); |
| 198 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 199 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; |
| 200 InterfaceType typeA = classA.element.type; |
| 201 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; |
| 202 BlockFunctionBody body18 = function.functionExpression.body as BlockFunction
Body; |
| 203 IfStatement ifStatement = body18.block.statements[0] as IfStatement; |
| 204 ReturnStatement statement = ((ifStatement.elseStatement as Block)).statement
s[0] as ReturnStatement; |
| 205 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; |
| 206 JUnitTestCase.assertSame(typeA, variableName.staticType); |
| 207 } |
| 208 void test_isNot_if_logicalOr() { |
| 209 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "A f(var p) {", " if (p is! A || null == p) {", " return null;", " }
else {", " return p;", " }", "}"])); |
| 210 LibraryElement library = resolve(source, []); |
| 211 assertNoErrors(); |
| 212 verify([source]); |
| 213 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 214 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; |
| 215 InterfaceType typeA = classA.element.type; |
| 216 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; |
| 217 BlockFunctionBody body19 = function.functionExpression.body as BlockFunction
Body; |
| 218 IfStatement ifStatement = body19.block.statements[0] as IfStatement; |
| 219 ReturnStatement statement = ((ifStatement.elseStatement as Block)).statement
s[0] as ReturnStatement; |
| 220 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; |
| 221 JUnitTestCase.assertSame(typeA, variableName.staticType); |
| 222 } |
| 223 void test_isNot_postConditional() { |
| 224 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "A f(var p) {", " A a = (p is! A) ? throw null : p;", " return p;", "}"
])); |
| 225 LibraryElement library = resolve(source, []); |
| 226 assertNoErrors(); |
| 227 verify([source]); |
| 228 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 229 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; |
| 230 InterfaceType typeA = classA.element.type; |
| 231 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; |
| 232 BlockFunctionBody body20 = function.functionExpression.body as BlockFunction
Body; |
| 233 ReturnStatement statement = body20.block.statements[1] as ReturnStatement; |
| 234 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; |
| 235 JUnitTestCase.assertSame(typeA, variableName.staticType); |
| 236 } |
| 237 void test_isNot_postIf() { |
| 238 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "A f(var p) {", " if (p is! A) {", " return null;", " }", " return
p;", "}"])); |
| 239 LibraryElement library = resolve(source, []); |
| 240 assertNoErrors(); |
| 241 verify([source]); |
| 242 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 243 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; |
| 244 InterfaceType typeA = classA.element.type; |
| 245 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; |
| 246 BlockFunctionBody body21 = function.functionExpression.body as BlockFunction
Body; |
| 247 ReturnStatement statement = body21.block.statements[1] as ReturnStatement; |
| 248 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; |
| 249 JUnitTestCase.assertSame(typeA, variableName.staticType); |
| 250 } |
| 251 static dartSuite() { |
| 252 _ut.group('TypePropagationTest', () { |
| 253 _ut.test('test_as', () { |
| 254 final __test = new TypePropagationTest(); |
| 255 runJUnitTest(__test, __test.test_as); |
| 256 }); |
| 257 _ut.test('test_assert', () { |
| 258 final __test = new TypePropagationTest(); |
| 259 runJUnitTest(__test, __test.test_assert); |
| 260 }); |
| 261 _ut.test('test_assignment', () { |
| 262 final __test = new TypePropagationTest(); |
| 263 runJUnitTest(__test, __test.test_assignment); |
| 264 }); |
| 265 _ut.test('test_assignment_afterInitializer', () { |
| 266 final __test = new TypePropagationTest(); |
| 267 runJUnitTest(__test, __test.test_assignment_afterInitializer); |
| 268 }); |
| 269 _ut.test('test_initializer', () { |
| 270 final __test = new TypePropagationTest(); |
| 271 runJUnitTest(__test, __test.test_initializer); |
| 272 }); |
| 273 _ut.test('test_isNot_conditional', () { |
| 274 final __test = new TypePropagationTest(); |
| 275 runJUnitTest(__test, __test.test_isNot_conditional); |
| 276 }); |
| 277 _ut.test('test_isNot_if', () { |
| 278 final __test = new TypePropagationTest(); |
| 279 runJUnitTest(__test, __test.test_isNot_if); |
| 280 }); |
| 281 _ut.test('test_isNot_if_logicalOr', () { |
| 282 final __test = new TypePropagationTest(); |
| 283 runJUnitTest(__test, __test.test_isNot_if_logicalOr); |
| 284 }); |
| 285 _ut.test('test_isNot_postConditional', () { |
| 286 final __test = new TypePropagationTest(); |
| 287 runJUnitTest(__test, __test.test_isNot_postConditional); |
| 288 }); |
| 289 _ut.test('test_isNot_postIf', () { |
| 290 final __test = new TypePropagationTest(); |
| 291 runJUnitTest(__test, __test.test_isNot_postIf); |
| 292 }); |
| 293 _ut.test('test_is_conditional', () { |
| 294 final __test = new TypePropagationTest(); |
| 295 runJUnitTest(__test, __test.test_is_conditional); |
| 296 }); |
| 297 _ut.test('test_is_if', () { |
| 298 final __test = new TypePropagationTest(); |
| 299 runJUnitTest(__test, __test.test_is_if); |
| 300 }); |
| 301 _ut.test('test_is_if_logicalAnd', () { |
| 302 final __test = new TypePropagationTest(); |
| 303 runJUnitTest(__test, __test.test_is_if_logicalAnd); |
| 304 }); |
| 305 _ut.test('test_is_postConditional', () { |
| 306 final __test = new TypePropagationTest(); |
| 307 runJUnitTest(__test, __test.test_is_postConditional); |
| 308 }); |
| 309 _ut.test('test_is_postIf', () { |
| 310 final __test = new TypePropagationTest(); |
| 311 runJUnitTest(__test, __test.test_is_postIf); |
| 312 }); |
| 313 _ut.test('test_is_subclass', () { |
| 314 final __test = new TypePropagationTest(); |
| 315 runJUnitTest(__test, __test.test_is_subclass); |
| 316 }); |
| 317 }); |
| 318 } |
| 319 } |
| 24 class NonErrorResolverTest extends ResolverTestCase { | 320 class NonErrorResolverTest extends ResolverTestCase { |
| 25 void test_argumentDefinitionTestNonParameter_formalParameter() { | 321 void test_argumentDefinitionTestNonParameter_formalParameter() { |
| 26 Source source = addSource("/test.dart", EngineTestCase.createSource(["f(var
v) {", " return ?v;", "}"])); | 322 Source source = addSource("/test.dart", EngineTestCase.createSource(["f(var
v) {", " return ?v;", "}"])); |
| 27 resolve(source, []); | 323 resolve(source, []); |
| 28 assertNoErrors(); | 324 assertNoErrors(); |
| 29 verify([source]); | 325 verify([source]); |
| 30 } | 326 } |
| 31 void test_argumentDefinitionTestNonParameter_namedParameter() { | 327 void test_argumentDefinitionTestNonParameter_namedParameter() { |
| 32 Source source = addSource("/test.dart", EngineTestCase.createSource(["f({var
v : 0}) {", " return ?v;", "}"])); | 328 Source source = addSource("/test.dart", EngineTestCase.createSource(["f({var
v : 0}) {", " return ?v;", "}"])); |
| 33 resolve(source, []); | 329 resolve(source, []); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 63 resolve(source, []); | 359 resolve(source, []); |
| 64 assertNoErrors(); | 360 assertNoErrors(); |
| 65 verify([source]); | 361 verify([source]); |
| 66 } | 362 } |
| 67 void test_caseExpressionTypeImplementsEquals_String() { | 363 void test_caseExpressionTypeImplementsEquals_String() { |
| 68 Source source = addSource("/test.dart", EngineTestCase.createSource(["f(Stri
ng s) {", " switch(s) {", " case('1') : return 1;", " default: return 0;"
, " }", "}"])); | 364 Source source = addSource("/test.dart", EngineTestCase.createSource(["f(Stri
ng s) {", " switch(s) {", " case('1') : return 1;", " default: return 0;"
, " }", "}"])); |
| 69 resolve(source, []); | 365 resolve(source, []); |
| 70 assertNoErrors(); | 366 assertNoErrors(); |
| 71 verify([source]); | 367 verify([source]); |
| 72 } | 368 } |
| 73 void test_constConstructorWithNonFinalField_const() { | 369 void test_constConstructorWithNonFinalField_constInstanceVar() { |
| 74 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " const int x;", " const A() {}", "}"])); | 370 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " const int x = 0;", " const A() {}", "}"])); |
| 75 resolve(source, []); | 371 resolve(source, []); |
| 76 assertNoErrors(); | 372 assertNoErrors(); |
| 77 verify([source]); | 373 verify([source]); |
| 78 } | 374 } |
| 79 void test_constConstructorWithNonFinalField_final() { | 375 void test_constConstructorWithNonFinalField_finalInstanceVar() { |
| 80 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " final int x;", " const A() {}", "}"])); | 376 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " final int x = 0;", " const A() {}", "}"])); |
| 81 resolve(source, []); | 377 resolve(source, []); |
| 82 assertNoErrors(); | 378 assertNoErrors(); |
| 83 verify([source]); | 379 verify([source]); |
| 380 } |
| 381 void test_constConstructorWithNonFinalField_static() { |
| 382 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " static int x;", " const A() {}", "}"])); |
| 383 resolve(source, []); |
| 384 assertNoErrors(); |
| 385 verify([source]); |
| 84 } | 386 } |
| 85 void test_constConstructorWithNonFinalField_syntheticField() { | 387 void test_constConstructorWithNonFinalField_syntheticField() { |
| 86 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " const A();", " set x(value) {}", " get x {return 0;}", "}"])); | 388 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " const A();", " set x(value) {}", " get x {return 0;}", "}"])); |
| 87 resolve(source, []); | 389 resolve(source, []); |
| 88 assertNoErrors(); | 390 assertNoErrors(); |
| 89 verify([source]); | 391 verify([source]); |
| 90 } | 392 } |
| 91 void test_defaultValueInFunctionTypeAlias() { | 393 void test_defaultValueInFunctionTypeAlias() { |
| 92 Source source = addSource("/test.dart", EngineTestCase.createSource(["typede
f F([x]);"])); | 394 Source source = addSource("/test.dart", EngineTestCase.createSource(["typede
f F([x]);"])); |
| 93 resolve(source, []); | 395 resolve(source, []); |
| 94 assertErrors([]); | 396 assertErrors([]); |
| 95 verify([source]); | 397 verify([source]); |
| 96 } | 398 } |
| 399 void test_duplicateDefinition_emptyName() { |
| 400 Source source = addSource("/test.dart", EngineTestCase.createSource(["Map _g
lobalMap = {", " 'a' : () {},", " 'b' : () {}", "}"])); |
| 401 resolve(source, []); |
| 402 assertNoErrors(); |
| 403 verify([source]); |
| 404 } |
| 97 void test_duplicateDefinition_getter() { | 405 void test_duplicateDefinition_getter() { |
| 98 Source source = addSource("/test.dart", EngineTestCase.createSource(["bool g
et a => true;"])); | 406 Source source = addSource("/test.dart", EngineTestCase.createSource(["bool g
et a => true;"])); |
| 99 resolve(source, []); | 407 resolve(source, []); |
| 100 assertNoErrors(); | 408 assertNoErrors(); |
| 101 verify([source]); | 409 verify([source]); |
| 102 } | 410 } |
| 411 void test_exportOfNonLibrary_libraryDeclared() { |
| 412 Source source = addSource("/test.dart", EngineTestCase.createSource(["librar
y L;", "export 'lib1.dart';"])); |
| 413 addSource("/lib1.dart", EngineTestCase.createSource(["library lib1;"])); |
| 414 resolve(source, []); |
| 415 assertNoErrors(); |
| 416 verify([source]); |
| 417 } |
| 418 void test_exportOfNonLibrary_libraryNotDeclared() { |
| 419 Source source = addSource("/test.dart", EngineTestCase.createSource(["librar
y L;", "export 'lib1.dart';"])); |
| 420 addSource("/lib1.dart", EngineTestCase.createSource([""])); |
| 421 resolve(source, []); |
| 422 assertNoErrors(); |
| 423 verify([source]); |
| 424 } |
| 425 void test_fieldInitializedByMultipleInitializers() { |
| 426 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int x;", " int y;", " A() : x = 0, y = 0 {}", "}"])); |
| 427 resolve(source, []); |
| 428 assertNoErrors(); |
| 429 verify([source]); |
| 430 } |
| 103 void test_fieldInitializedInInitializerAndDeclaration_fieldNotFinal() { | 431 void test_fieldInitializedInInitializerAndDeclaration_fieldNotFinal() { |
| 104 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int x = 0;", " A() : x = 1 {}", "}"])); | 432 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int x = 0;", " A() : x = 1 {}", "}"])); |
| 105 resolve(source, []); | 433 resolve(source, []); |
| 106 assertNoErrors(); | 434 assertNoErrors(); |
| 107 verify([source]); | 435 verify([source]); |
| 108 } | 436 } |
| 109 void test_fieldInitializedInInitializerAndDeclaration_finalFieldNotSet() { | 437 void test_fieldInitializedInInitializerAndDeclaration_finalFieldNotSet() { |
| 110 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " final int x;", " A() : x = 1 {}", "}"])); | 438 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " final int x;", " A() : x = 1 {}", "}"])); |
| 111 resolve(source, []); | 439 resolve(source, []); |
| 112 assertNoErrors(); | 440 assertNoErrors(); |
| 113 verify([source]); | 441 verify([source]); |
| 114 } | 442 } |
| 115 void test_fieldInitializerOutsideConstructor() { | 443 void test_fieldInitializerOutsideConstructor() { |
| 116 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int x;", " A(this.x) {}", "}"])); | 444 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int x;", " A(this.x) {}", "}"])); |
| 117 resolve(source, []); | 445 resolve(source, []); |
| 118 assertNoErrors(); | 446 assertNoErrors(); |
| 119 verify([source]); | 447 verify([source]); |
| 120 } | 448 } |
| 121 void test_fieldInitializerOutsideConstructor_defaultParameters() { | 449 void test_fieldInitializerOutsideConstructor_defaultParameters() { |
| 122 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int x;", " A([this.x]) {}", "}"])); | 450 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int x;", " A([this.x]) {}", "}"])); |
| 123 resolve(source, []); | 451 resolve(source, []); |
| 124 assertNoErrors(); | 452 assertNoErrors(); |
| 125 verify([source]); | 453 verify([source]); |
| 126 } | 454 } |
| 455 void test_finalInitializedInDeclarationAndConstructor_initializer() { |
| 456 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " final x;", " A() : x = 1 {}", "}"])); |
| 457 resolve(source, []); |
| 458 assertNoErrors(); |
| 459 verify([source]); |
| 460 } |
| 461 void test_finalInitializedInDeclarationAndConstructor_initializingFormal() { |
| 462 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " final x;", " A(this.x) {}", "}"])); |
| 463 resolve(source, []); |
| 464 assertNoErrors(); |
| 465 verify([source]); |
| 466 } |
| 467 void test_finalNotInitialized_atDeclaration() { |
| 468 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " final int x = 0;", " A() {}", "}"])); |
| 469 resolve(source, []); |
| 470 assertNoErrors(); |
| 471 verify([source]); |
| 472 } |
| 473 void test_finalNotInitialized_fieldFormal() { |
| 474 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " final int x = 0;", " A() {}", "}"])); |
| 475 resolve(source, []); |
| 476 assertNoErrors(); |
| 477 verify([source]); |
| 478 } |
| 479 void test_finalNotInitialized_initializer() { |
| 480 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " final int x;", " A() : x = 0 {}", "}"])); |
| 481 resolve(source, []); |
| 482 assertNoErrors(); |
| 483 verify([source]); |
| 484 } |
| 485 void test_importOfNonLibrary_libraryDeclared() { |
| 486 Source source = addSource("/test.dart", EngineTestCase.createSource(["librar
y lib;", "import 'part.dart';"])); |
| 487 addSource("/part.dart", EngineTestCase.createSource(["library lib1;"])); |
| 488 resolve(source, []); |
| 489 assertNoErrors(); |
| 490 verify([source]); |
| 491 } |
| 492 void test_importOfNonLibrary_libraryNotDeclared() { |
| 493 Source source = addSource("/test.dart", EngineTestCase.createSource(["librar
y lib;", "import 'part.dart';"])); |
| 494 addSource("/part.dart", EngineTestCase.createSource([""])); |
| 495 resolve(source, []); |
| 496 assertNoErrors(); |
| 497 verify([source]); |
| 498 } |
| 499 void test_initializingFormalForNonExistantField() { |
| 500 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int x;", " A(this.x) {}", "}"])); |
| 501 resolve(source, []); |
| 502 assertNoErrors(); |
| 503 verify([source]); |
| 504 } |
| 127 void test_invalidAssignment() { | 505 void test_invalidAssignment() { |
| 128 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " var x;", " var y;", " x = y;", "}"])); | 506 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " var x;", " var y;", " x = y;", "}"])); |
| 129 resolve(source, []); | 507 resolve(source, []); |
| 130 assertNoErrors(); | 508 assertNoErrors(); |
| 131 verify([source]); | 509 verify([source]); |
| 132 } | 510 } |
| 133 void test_invalidAssignment_toDynamic() { | 511 void test_invalidAssignment_toDynamic() { |
| 134 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " var g;", " g = () => 0;", "}"])); | 512 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " var g;", " g = () => 0;", "}"])); |
| 135 resolve(source, []); | 513 resolve(source, []); |
| 136 assertNoErrors(); | 514 assertNoErrors(); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 assertNoErrors(); | 550 assertNoErrors(); |
| 173 verify([source]); | 551 verify([source]); |
| 174 } | 552 } |
| 175 void test_rethrowOutsideCatch() { | 553 void test_rethrowOutsideCatch() { |
| 176 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " void m() {", " try {} catch (e) {rethrow;}", " }", "}"])); | 554 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " void m() {", " try {} catch (e) {rethrow;}", " }", "}"])); |
| 177 resolve(source, []); | 555 resolve(source, []); |
| 178 assertNoErrors(); | 556 assertNoErrors(); |
| 179 verify([source]); | 557 verify([source]); |
| 180 } | 558 } |
| 181 void test_returnOfInvalidType_dynamic() { | 559 void test_returnOfInvalidType_dynamic() { |
| 182 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " static void testLogicalOp() {", " testOr(a, b, onTypeError) {", "
try {", " return a || b;", " } on TypeError catch (t) {", "
return onTypeError;", " }", " }", " }", "}"])); | 560 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
TypeError {}", "class A {", " static void testLogicalOp() {", " testOr(a, b,
onTypeError) {", " try {", " return a || b;", " } on TypeError
catch (t) {", " return onTypeError;", " }", " }", " }", "}"])); |
| 183 resolve(source, []); | 561 resolve(source, []); |
| 184 assertNoErrors(); | 562 assertNoErrors(); |
| 185 verify([source]); | 563 verify([source]); |
| 186 } | 564 } |
| 187 void test_returnOfInvalidType_subtype() { | 565 void test_returnOfInvalidType_subtype() { |
| 188 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "class B extends A {}", "A f(B b) { return b; }"])); | 566 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "class B extends A {}", "A f(B b) { return b; }"])); |
| 189 resolve(source, []); | 567 resolve(source, []); |
| 190 assertNoErrors(); | 568 assertNoErrors(); |
| 191 verify([source]); | 569 verify([source]); |
| 192 } | 570 } |
| 193 void test_returnOfInvalidType_supertype() { | 571 void test_returnOfInvalidType_supertype() { |
| 194 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "class B extends A {}", "B f(A a) { return a; }"])); | 572 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "class B extends A {}", "B f(A a) { return a; }"])); |
| 195 resolve(source, []); | 573 resolve(source, []); |
| 196 assertNoErrors(); | 574 assertNoErrors(); |
| 197 verify([source]); | 575 verify([source]); |
| 198 } | 576 } |
| 199 void test_typeArgumentNotMatchingBounds_const() { | 577 void test_typeArgumentNotMatchingBounds_const() { |
| 200 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "class B extends A {}", "class G<E extends A> {", " const G() {}", "}",
"f() { return const G<B>(); }"])); | 578 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "class B extends A {}", "class G<E extends A> {", " const G() {}", "}",
"f() { return const G<B>(); }"])); |
| 201 resolve(source, []); | 579 resolve(source, []); |
| 202 assertNoErrors(); | 580 assertNoErrors(); |
| 203 verify([source]); | 581 verify([source]); |
| 204 } | 582 } |
| 205 void test_typeArgumentNotMatchingBounds_new() { | 583 void test_typeArgumentNotMatchingBounds_new() { |
| 206 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "class B extends A {}", "class G<E extends A> {}", "f() { return new G<B>
(); }"])); | 584 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "class B extends A {}", "class G<E extends A> {}", "f() { return new G<B>
(); }"])); |
| 207 resolve(source, []); | 585 resolve(source, []); |
| 208 assertNoErrors(); | 586 assertNoErrors(); |
| 209 verify([source]); | 587 verify([source]); |
| 210 } | 588 } |
| 589 void test_undefinedGetter_typeSubstitution() { |
| 590 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A<E> {", " E element;", "}", "class B extends A<List> {", " m() {", " eleme
nt.last;", " }", "}"])); |
| 591 resolve(source, []); |
| 592 assertNoErrors(); |
| 593 verify([source]); |
| 594 } |
| 595 void test_undefinedIdentifier_hide() { |
| 596 Source source = addSource("/test.dart", EngineTestCase.createSource(["librar
y L;", "export 'lib1.dart' hide a;"])); |
| 597 addSource("/lib1.dart", EngineTestCase.createSource(["library lib1;"])); |
| 598 resolve(source, []); |
| 599 assertNoErrors(); |
| 600 verify([source]); |
| 601 } |
| 602 void test_undefinedIdentifier_show() { |
| 603 Source source = addSource("/test.dart", EngineTestCase.createSource(["librar
y L;", "export 'lib1.dart' show a;"])); |
| 604 addSource("/lib1.dart", EngineTestCase.createSource(["library lib1;"])); |
| 605 resolve(source, []); |
| 606 assertNoErrors(); |
| 607 verify([source]); |
| 608 } |
| 609 void test_undefinedOperator_tilde() { |
| 610 Source source = addSource("/test.dart", EngineTestCase.createSource(["const
A = 3;", "const B = ~((1 << A) - 1);"])); |
| 611 resolve(source, []); |
| 612 assertNoErrors(); |
| 613 verify([source]); |
| 614 } |
| 211 static dartSuite() { | 615 static dartSuite() { |
| 212 _ut.group('NonErrorResolverTest', () { | 616 _ut.group('NonErrorResolverTest', () { |
| 213 _ut.test('test_argumentDefinitionTestNonParameter_formalParameter', () { | 617 _ut.test('test_argumentDefinitionTestNonParameter_formalParameter', () { |
| 214 final __test = new NonErrorResolverTest(); | 618 final __test = new NonErrorResolverTest(); |
| 215 runJUnitTest(__test, __test.test_argumentDefinitionTestNonParameter_form
alParameter); | 619 runJUnitTest(__test, __test.test_argumentDefinitionTestNonParameter_form
alParameter); |
| 216 }); | 620 }); |
| 217 _ut.test('test_argumentDefinitionTestNonParameter_namedParameter', () { | 621 _ut.test('test_argumentDefinitionTestNonParameter_namedParameter', () { |
| 218 final __test = new NonErrorResolverTest(); | 622 final __test = new NonErrorResolverTest(); |
| 219 runJUnitTest(__test, __test.test_argumentDefinitionTestNonParameter_name
dParameter); | 623 runJUnitTest(__test, __test.test_argumentDefinitionTestNonParameter_name
dParameter); |
| 220 }); | 624 }); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 235 runJUnitTest(__test, __test.test_caseExpressionTypeImplementsEquals_Obje
ct); | 639 runJUnitTest(__test, __test.test_caseExpressionTypeImplementsEquals_Obje
ct); |
| 236 }); | 640 }); |
| 237 _ut.test('test_caseExpressionTypeImplementsEquals_String', () { | 641 _ut.test('test_caseExpressionTypeImplementsEquals_String', () { |
| 238 final __test = new NonErrorResolverTest(); | 642 final __test = new NonErrorResolverTest(); |
| 239 runJUnitTest(__test, __test.test_caseExpressionTypeImplementsEquals_Stri
ng); | 643 runJUnitTest(__test, __test.test_caseExpressionTypeImplementsEquals_Stri
ng); |
| 240 }); | 644 }); |
| 241 _ut.test('test_caseExpressionTypeImplementsEquals_int', () { | 645 _ut.test('test_caseExpressionTypeImplementsEquals_int', () { |
| 242 final __test = new NonErrorResolverTest(); | 646 final __test = new NonErrorResolverTest(); |
| 243 runJUnitTest(__test, __test.test_caseExpressionTypeImplementsEquals_int)
; | 647 runJUnitTest(__test, __test.test_caseExpressionTypeImplementsEquals_int)
; |
| 244 }); | 648 }); |
| 245 _ut.test('test_constConstructorWithNonFinalField_const', () { | 649 _ut.test('test_constConstructorWithNonFinalField_constInstanceVar', () { |
| 246 final __test = new NonErrorResolverTest(); | 650 final __test = new NonErrorResolverTest(); |
| 247 runJUnitTest(__test, __test.test_constConstructorWithNonFinalField_const
); | 651 runJUnitTest(__test, __test.test_constConstructorWithNonFinalField_const
InstanceVar); |
| 248 }); | 652 }); |
| 249 _ut.test('test_constConstructorWithNonFinalField_final', () { | 653 _ut.test('test_constConstructorWithNonFinalField_finalInstanceVar', () { |
| 250 final __test = new NonErrorResolverTest(); | 654 final __test = new NonErrorResolverTest(); |
| 251 runJUnitTest(__test, __test.test_constConstructorWithNonFinalField_final
); | 655 runJUnitTest(__test, __test.test_constConstructorWithNonFinalField_final
InstanceVar); |
| 656 }); |
| 657 _ut.test('test_constConstructorWithNonFinalField_static', () { |
| 658 final __test = new NonErrorResolverTest(); |
| 659 runJUnitTest(__test, __test.test_constConstructorWithNonFinalField_stati
c); |
| 252 }); | 660 }); |
| 253 _ut.test('test_constConstructorWithNonFinalField_syntheticField', () { | 661 _ut.test('test_constConstructorWithNonFinalField_syntheticField', () { |
| 254 final __test = new NonErrorResolverTest(); | 662 final __test = new NonErrorResolverTest(); |
| 255 runJUnitTest(__test, __test.test_constConstructorWithNonFinalField_synth
eticField); | 663 runJUnitTest(__test, __test.test_constConstructorWithNonFinalField_synth
eticField); |
| 256 }); | 664 }); |
| 257 _ut.test('test_defaultValueInFunctionTypeAlias', () { | 665 _ut.test('test_defaultValueInFunctionTypeAlias', () { |
| 258 final __test = new NonErrorResolverTest(); | 666 final __test = new NonErrorResolverTest(); |
| 259 runJUnitTest(__test, __test.test_defaultValueInFunctionTypeAlias); | 667 runJUnitTest(__test, __test.test_defaultValueInFunctionTypeAlias); |
| 260 }); | 668 }); |
| 669 _ut.test('test_duplicateDefinition_emptyName', () { |
| 670 final __test = new NonErrorResolverTest(); |
| 671 runJUnitTest(__test, __test.test_duplicateDefinition_emptyName); |
| 672 }); |
| 261 _ut.test('test_duplicateDefinition_getter', () { | 673 _ut.test('test_duplicateDefinition_getter', () { |
| 262 final __test = new NonErrorResolverTest(); | 674 final __test = new NonErrorResolverTest(); |
| 263 runJUnitTest(__test, __test.test_duplicateDefinition_getter); | 675 runJUnitTest(__test, __test.test_duplicateDefinition_getter); |
| 264 }); | 676 }); |
| 677 _ut.test('test_exportOfNonLibrary_libraryDeclared', () { |
| 678 final __test = new NonErrorResolverTest(); |
| 679 runJUnitTest(__test, __test.test_exportOfNonLibrary_libraryDeclared); |
| 680 }); |
| 681 _ut.test('test_exportOfNonLibrary_libraryNotDeclared', () { |
| 682 final __test = new NonErrorResolverTest(); |
| 683 runJUnitTest(__test, __test.test_exportOfNonLibrary_libraryNotDeclared); |
| 684 }); |
| 685 _ut.test('test_fieldInitializedByMultipleInitializers', () { |
| 686 final __test = new NonErrorResolverTest(); |
| 687 runJUnitTest(__test, __test.test_fieldInitializedByMultipleInitializers)
; |
| 688 }); |
| 265 _ut.test('test_fieldInitializedInInitializerAndDeclaration_fieldNotFinal',
() { | 689 _ut.test('test_fieldInitializedInInitializerAndDeclaration_fieldNotFinal',
() { |
| 266 final __test = new NonErrorResolverTest(); | 690 final __test = new NonErrorResolverTest(); |
| 267 runJUnitTest(__test, __test.test_fieldInitializedInInitializerAndDeclara
tion_fieldNotFinal); | 691 runJUnitTest(__test, __test.test_fieldInitializedInInitializerAndDeclara
tion_fieldNotFinal); |
| 268 }); | 692 }); |
| 269 _ut.test('test_fieldInitializedInInitializerAndDeclaration_finalFieldNotSe
t', () { | 693 _ut.test('test_fieldInitializedInInitializerAndDeclaration_finalFieldNotSe
t', () { |
| 270 final __test = new NonErrorResolverTest(); | 694 final __test = new NonErrorResolverTest(); |
| 271 runJUnitTest(__test, __test.test_fieldInitializedInInitializerAndDeclara
tion_finalFieldNotSet); | 695 runJUnitTest(__test, __test.test_fieldInitializedInInitializerAndDeclara
tion_finalFieldNotSet); |
| 272 }); | 696 }); |
| 273 _ut.test('test_fieldInitializerOutsideConstructor', () { | 697 _ut.test('test_fieldInitializerOutsideConstructor', () { |
| 274 final __test = new NonErrorResolverTest(); | 698 final __test = new NonErrorResolverTest(); |
| 275 runJUnitTest(__test, __test.test_fieldInitializerOutsideConstructor); | 699 runJUnitTest(__test, __test.test_fieldInitializerOutsideConstructor); |
| 276 }); | 700 }); |
| 277 _ut.test('test_fieldInitializerOutsideConstructor_defaultParameters', () { | 701 _ut.test('test_fieldInitializerOutsideConstructor_defaultParameters', () { |
| 278 final __test = new NonErrorResolverTest(); | 702 final __test = new NonErrorResolverTest(); |
| 279 runJUnitTest(__test, __test.test_fieldInitializerOutsideConstructor_defa
ultParameters); | 703 runJUnitTest(__test, __test.test_fieldInitializerOutsideConstructor_defa
ultParameters); |
| 280 }); | 704 }); |
| 705 _ut.test('test_finalInitializedInDeclarationAndConstructor_initializer', (
) { |
| 706 final __test = new NonErrorResolverTest(); |
| 707 runJUnitTest(__test, __test.test_finalInitializedInDeclarationAndConstru
ctor_initializer); |
| 708 }); |
| 709 _ut.test('test_finalInitializedInDeclarationAndConstructor_initializingFor
mal', () { |
| 710 final __test = new NonErrorResolverTest(); |
| 711 runJUnitTest(__test, __test.test_finalInitializedInDeclarationAndConstru
ctor_initializingFormal); |
| 712 }); |
| 713 _ut.test('test_finalNotInitialized_atDeclaration', () { |
| 714 final __test = new NonErrorResolverTest(); |
| 715 runJUnitTest(__test, __test.test_finalNotInitialized_atDeclaration); |
| 716 }); |
| 717 _ut.test('test_finalNotInitialized_fieldFormal', () { |
| 718 final __test = new NonErrorResolverTest(); |
| 719 runJUnitTest(__test, __test.test_finalNotInitialized_fieldFormal); |
| 720 }); |
| 721 _ut.test('test_finalNotInitialized_initializer', () { |
| 722 final __test = new NonErrorResolverTest(); |
| 723 runJUnitTest(__test, __test.test_finalNotInitialized_initializer); |
| 724 }); |
| 725 _ut.test('test_importOfNonLibrary_libraryDeclared', () { |
| 726 final __test = new NonErrorResolverTest(); |
| 727 runJUnitTest(__test, __test.test_importOfNonLibrary_libraryDeclared); |
| 728 }); |
| 729 _ut.test('test_importOfNonLibrary_libraryNotDeclared', () { |
| 730 final __test = new NonErrorResolverTest(); |
| 731 runJUnitTest(__test, __test.test_importOfNonLibrary_libraryNotDeclared); |
| 732 }); |
| 733 _ut.test('test_initializingFormalForNonExistantField', () { |
| 734 final __test = new NonErrorResolverTest(); |
| 735 runJUnitTest(__test, __test.test_initializingFormalForNonExistantField); |
| 736 }); |
| 281 _ut.test('test_invalidAssignment', () { | 737 _ut.test('test_invalidAssignment', () { |
| 282 final __test = new NonErrorResolverTest(); | 738 final __test = new NonErrorResolverTest(); |
| 283 runJUnitTest(__test, __test.test_invalidAssignment); | 739 runJUnitTest(__test, __test.test_invalidAssignment); |
| 284 }); | 740 }); |
| 285 _ut.test('test_invalidAssignment_toDynamic', () { | 741 _ut.test('test_invalidAssignment_toDynamic', () { |
| 286 final __test = new NonErrorResolverTest(); | 742 final __test = new NonErrorResolverTest(); |
| 287 runJUnitTest(__test, __test.test_invalidAssignment_toDynamic); | 743 runJUnitTest(__test, __test.test_invalidAssignment_toDynamic); |
| 288 }); | 744 }); |
| 289 _ut.test('test_invocationOfNonFunction_dynamic', () { | 745 _ut.test('test_invocationOfNonFunction_dynamic', () { |
| 290 final __test = new NonErrorResolverTest(); | 746 final __test = new NonErrorResolverTest(); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 runJUnitTest(__test, __test.test_returnOfInvalidType_supertype); | 783 runJUnitTest(__test, __test.test_returnOfInvalidType_supertype); |
| 328 }); | 784 }); |
| 329 _ut.test('test_typeArgumentNotMatchingBounds_const', () { | 785 _ut.test('test_typeArgumentNotMatchingBounds_const', () { |
| 330 final __test = new NonErrorResolverTest(); | 786 final __test = new NonErrorResolverTest(); |
| 331 runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_const); | 787 runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_const); |
| 332 }); | 788 }); |
| 333 _ut.test('test_typeArgumentNotMatchingBounds_new', () { | 789 _ut.test('test_typeArgumentNotMatchingBounds_new', () { |
| 334 final __test = new NonErrorResolverTest(); | 790 final __test = new NonErrorResolverTest(); |
| 335 runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_new); | 791 runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_new); |
| 336 }); | 792 }); |
| 793 _ut.test('test_undefinedGetter_typeSubstitution', () { |
| 794 final __test = new NonErrorResolverTest(); |
| 795 runJUnitTest(__test, __test.test_undefinedGetter_typeSubstitution); |
| 796 }); |
| 797 _ut.test('test_undefinedIdentifier_hide', () { |
| 798 final __test = new NonErrorResolverTest(); |
| 799 runJUnitTest(__test, __test.test_undefinedIdentifier_hide); |
| 800 }); |
| 801 _ut.test('test_undefinedIdentifier_show', () { |
| 802 final __test = new NonErrorResolverTest(); |
| 803 runJUnitTest(__test, __test.test_undefinedIdentifier_show); |
| 804 }); |
| 805 _ut.test('test_undefinedOperator_tilde', () { |
| 806 final __test = new NonErrorResolverTest(); |
| 807 runJUnitTest(__test, __test.test_undefinedOperator_tilde); |
| 808 }); |
| 337 }); | 809 }); |
| 338 } | 810 } |
| 339 } | 811 } |
| 340 class LibraryTest extends EngineTestCase { | 812 class LibraryTest extends EngineTestCase { |
| 341 /** | 813 /** |
| 342 * The error listener to which all errors will be reported. | 814 * The error listener to which all errors will be reported. |
| 343 */ | 815 */ |
| 344 GatheringErrorListener _errorListener; | 816 GatheringErrorListener _errorListener; |
| 345 /** | 817 /** |
| 346 * The source factory used to create libraries. | 818 * The source factory used to create libraries. |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 void test_setExplicitlyImportsCore() { | 894 void test_setExplicitlyImportsCore() { |
| 423 _library5.explicitlyImportsCore = true; | 895 _library5.explicitlyImportsCore = true; |
| 424 JUnitTestCase.assertTrue(_library5.explicitlyImportsCore); | 896 JUnitTestCase.assertTrue(_library5.explicitlyImportsCore); |
| 425 _errorListener.assertNoErrors(); | 897 _errorListener.assertNoErrors(); |
| 426 } | 898 } |
| 427 void test_setLibraryElement() { | 899 void test_setLibraryElement() { |
| 428 LibraryElementImpl element = new LibraryElementImpl(_analysisContext, ASTFac
tory.libraryIdentifier2(["lib"])); | 900 LibraryElementImpl element = new LibraryElementImpl(_analysisContext, ASTFac
tory.libraryIdentifier2(["lib"])); |
| 429 _library5.libraryElement = element; | 901 _library5.libraryElement = element; |
| 430 JUnitTestCase.assertSame(element, _library5.libraryElement); | 902 JUnitTestCase.assertSame(element, _library5.libraryElement); |
| 431 } | 903 } |
| 432 Library library(String definingCompilationUnitPath) => new Library(_analysisCo
ntext, _errorListener, new FileBasedSource.con1(_sourceFactory, FileUtilities2.c
reateFile(definingCompilationUnitPath))); | 904 Library library(String definingCompilationUnitPath) => new Library(_analysisCo
ntext, _errorListener, new FileBasedSource.con1(_sourceFactory.contentCache, Fil
eUtilities2.createFile(definingCompilationUnitPath))); |
| 433 static dartSuite() { | 905 static dartSuite() { |
| 434 _ut.group('LibraryTest', () { | 906 _ut.group('LibraryTest', () { |
| 435 _ut.test('test_addExport', () { | 907 _ut.test('test_addExport', () { |
| 436 final __test = new LibraryTest(); | 908 final __test = new LibraryTest(); |
| 437 runJUnitTest(__test, __test.test_addExport); | 909 runJUnitTest(__test, __test.test_addExport); |
| 438 }); | 910 }); |
| 439 _ut.test('test_addImport', () { | 911 _ut.test('test_addImport', () { |
| 440 final __test = new LibraryTest(); | 912 final __test = new LibraryTest(); |
| 441 runJUnitTest(__test, __test.test_addImport); | 913 runJUnitTest(__test, __test.test_addImport); |
| 442 }); | 914 }); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 assertErrors([StaticTypeWarningCode.REDIRECT_WITH_INVALID_TYPE_PARAMETERS]); | 980 assertErrors([StaticTypeWarningCode.REDIRECT_WITH_INVALID_TYPE_PARAMETERS]); |
| 509 verify([source]); | 981 verify([source]); |
| 510 } | 982 } |
| 511 void fail_typeArgumentViolatesBounds() { | 983 void fail_typeArgumentViolatesBounds() { |
| 512 Source source = addSource("/test.dart", EngineTestCase.createSource([])); | 984 Source source = addSource("/test.dart", EngineTestCase.createSource([])); |
| 513 resolve(source, []); | 985 resolve(source, []); |
| 514 assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_VIOLATES_BOUNDS]); | 986 assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_VIOLATES_BOUNDS]); |
| 515 verify([source]); | 987 verify([source]); |
| 516 } | 988 } |
| 517 void test_invalidAssignment_instanceVariable() { | 989 void test_invalidAssignment_instanceVariable() { |
| 518 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int x;", "}", "f() {", " A a;", " a.x = '0';", "}"])); | 990 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int x;", "}", "f() {", " A a;", " a.x = '0';", "}"])); |
| 519 resolve(source, []); | 991 resolve(source, []); |
| 520 assertErrors([StaticTypeWarningCode.INVALID_ASSIGNMENT]); | 992 assertErrors([StaticTypeWarningCode.INVALID_ASSIGNMENT]); |
| 521 verify([source]); | 993 verify([source]); |
| 522 } | 994 } |
| 523 void test_invalidAssignment_localVariable() { | 995 void test_invalidAssignment_localVariable() { |
| 524 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " int x;", " x = '0';", "}"])); | 996 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " int x;", " x = '0';", "}"])); |
| 525 resolve(source, []); | 997 resolve(source, []); |
| 526 assertErrors([StaticTypeWarningCode.INVALID_ASSIGNMENT]); | 998 assertErrors([StaticTypeWarningCode.INVALID_ASSIGNMENT]); |
| 527 verify([source]); | 999 verify([source]); |
| 528 } | 1000 } |
| 529 void test_invalidAssignment_staticVariable() { | 1001 void test_invalidAssignment_staticVariable() { |
| 530 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " static int x;", "}", "f() {", " A.x = '0';", "}"])); | 1002 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " static int x;", "}", "f() {", " A.x = '0';", "}"])); |
| 531 resolve(source, []); | 1003 resolve(source, []); |
| 532 assertErrors([StaticTypeWarningCode.INVALID_ASSIGNMENT]); | 1004 assertErrors([StaticTypeWarningCode.INVALID_ASSIGNMENT]); |
| 533 verify([source]); | 1005 verify([source]); |
| 534 } | 1006 } |
| 535 void test_invocationOfNonFunction_class() { | 1007 void test_invocationOfNonFunction_class() { |
| 536 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " void m() {", " A();", " }", "}"])); | 1008 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " void m() {", " A();", " }", "}"])); |
| 537 resolve(source, []); | 1009 resolve(source, []); |
| 538 assertErrors([StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION]); | 1010 assertErrors([StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION]); |
| 539 verify([source]); | |
| 540 } | 1011 } |
| 541 void test_invocationOfNonFunction_localVariable() { | 1012 void test_invocationOfNonFunction_localVariable() { |
| 542 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " int x;", " return x();", "}"])); | 1013 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " int x;", " return x();", "}"])); |
| 543 resolve(source, []); | 1014 resolve(source, []); |
| 544 assertErrors([StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION]); | 1015 assertErrors([StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION]); |
| 545 verify([source]); | 1016 verify([source]); |
| 546 } | 1017 } |
| 547 void test_invocationOfNonFunction_ordinaryInvocation() { | 1018 void test_invocationOfNonFunction_ordinaryInvocation() { |
| 548 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int x;", "}", "class B {", " m() {", " A.x();", " }", "}"])); | 1019 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int x;", "}", "class B {", " m() {", " A.x();", " }", "}"])); |
| 549 resolve(source, []); | 1020 resolve(source, []); |
| 550 assertErrors([StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION]); | 1021 assertErrors([StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION]); |
| 551 } | 1022 } |
| 552 void test_invocationOfNonFunction_staticInvocation() { | 1023 void test_invocationOfNonFunction_staticInvocation() { |
| 553 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " static int get g => 0;", " f() {", " A.g();", " }", "}"])); | 1024 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " static int get g => 0;", " f() {", " A.g();", " }", "}"])); |
| 554 resolve(source, []); | 1025 resolve(source, []); |
| 555 assertErrors([StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION]); | 1026 assertErrors([StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION]); |
| 556 } | 1027 } |
| 557 void test_nonBoolCondition_conditional() { | 1028 void test_nonBoolCondition_conditional() { |
| 558 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {
return 3 ? 2 : 1; }"])); | 1029 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {
return 3 ? 2 : 1; }"])); |
| 559 resolve(source, []); | 1030 resolve(source, []); |
| 560 assertErrors([StaticTypeWarningCode.NON_BOOL_CONDITION]); | 1031 assertErrors([StaticTypeWarningCode.NON_BOOL_CONDITION]); |
| 561 verify([source]); | 1032 verify([source]); |
| 562 } | 1033 } |
| 563 void test_nonBoolCondition_do() { | 1034 void test_nonBoolCondition_do() { |
| 564 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " do {} while (3);", "}"])); | 1035 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " do {} while (3);", "}"])); |
| 565 resolve(source, []); | 1036 resolve(source, []); |
| 566 assertErrors([StaticTypeWarningCode.NON_BOOL_CONDITION]); | 1037 assertErrors([StaticTypeWarningCode.NON_BOOL_CONDITION]); |
| 567 verify([source]); | 1038 verify([source]); |
| 568 } | 1039 } |
| 569 void test_nonBoolCondition_if() { | 1040 void test_nonBoolCondition_if() { |
| 570 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " if (3) return 2; else return 1;", "}"])); | 1041 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " if (3) return 2; else return 1;", "}"])); |
| 571 resolve(source, []); | 1042 resolve(source, []); |
| 572 assertErrors([StaticTypeWarningCode.NON_BOOL_CONDITION]); | 1043 assertErrors([StaticTypeWarningCode.NON_BOOL_CONDITION]); |
| 573 verify([source]); | 1044 verify([source]); |
| 574 } | 1045 } |
| 575 void test_nonBoolCondition_while() { | 1046 void test_nonBoolCondition_while() { |
| 576 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " while (3) {}", "}"])); | 1047 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " while (3) {}", "}"])); |
| 577 resolve(source, []); | 1048 resolve(source, []); |
| 578 assertErrors([StaticTypeWarningCode.NON_BOOL_CONDITION]); | 1049 assertErrors([StaticTypeWarningCode.NON_BOOL_CONDITION]); |
| 579 verify([source]); | 1050 verify([source]); |
| 580 } | 1051 } |
| 581 void test_nonBoolExpression() { | 1052 void test_nonBoolExpression() { |
| 582 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " assert(0);", "}"])); | 1053 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " assert(0);", "}"])); |
| 583 resolve(source, []); | 1054 resolve(source, []); |
| 584 assertErrors([StaticTypeWarningCode.NON_BOOL_EXPRESSION]); | 1055 assertErrors([StaticTypeWarningCode.NON_BOOL_EXPRESSION]); |
| 585 verify([source]); | 1056 verify([source]); |
| 586 } | 1057 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 607 resolve(source, []); | 1078 resolve(source, []); |
| 608 assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); | 1079 assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); |
| 609 verify([source]); | 1080 verify([source]); |
| 610 } | 1081 } |
| 611 void test_typeArgumentNotMatchingBounds_new() { | 1082 void test_typeArgumentNotMatchingBounds_new() { |
| 612 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "class B {}", "class G<E extends A> {}", "f() { return new G<B>(); }"])); | 1083 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "class B {}", "class G<E extends A> {}", "f() { return new G<B>(); }"])); |
| 613 resolve(source, []); | 1084 resolve(source, []); |
| 614 assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); | 1085 assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); |
| 615 verify([source]); | 1086 verify([source]); |
| 616 } | 1087 } |
| 1088 void test_undefinedFunction() { |
| 1089 Source source = addSource("/test.dart", EngineTestCase.createSource(["void f
() {", " g();", "}"])); |
| 1090 resolve(source, []); |
| 1091 assertErrors([StaticTypeWarningCode.UNDEFINED_FUNCTION]); |
| 1092 } |
| 617 void test_undefinedGetter() { | 1093 void test_undefinedGetter() { |
| 618 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
T {}", "f(T e) { return e.m; }"])); | 1094 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
T {}", "f(T e) { return e.m; }"])); |
| 619 resolve(source, []); | 1095 resolve(source, []); |
| 620 assertErrors([StaticTypeWarningCode.UNDEFINED_GETTER]); | 1096 assertErrors([StaticTypeWarningCode.UNDEFINED_GETTER]); |
| 621 } | 1097 } |
| 622 void test_undefinedGetter_static() { | 1098 void test_undefinedGetter_static() { |
| 623 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "var a = A.B;"])); | 1099 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "var a = A.B;"])); |
| 624 resolve(source, []); | 1100 resolve(source, []); |
| 625 assertErrors([StaticTypeWarningCode.UNDEFINED_GETTER]); | 1101 assertErrors([StaticTypeWarningCode.UNDEFINED_GETTER]); |
| 626 } | 1102 } |
| 1103 void test_undefinedMethod() { |
| 1104 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " void m() {", " n();", " }", "}"])); |
| 1105 resolve(source, []); |
| 1106 assertErrors([StaticTypeWarningCode.UNDEFINED_METHOD]); |
| 1107 } |
| 627 void test_undefinedSetter() { | 1108 void test_undefinedSetter() { |
| 628 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
T {}", "f(T e1) { e1.m = 0; }"])); | 1109 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
T {}", "f(T e1) { e1.m = 0; }"])); |
| 629 resolve(source, []); | 1110 resolve(source, []); |
| 630 assertErrors([StaticTypeWarningCode.UNDEFINED_SETTER]); | 1111 assertErrors([StaticTypeWarningCode.UNDEFINED_SETTER]); |
| 631 } | 1112 } |
| 632 void test_undefinedSetter_static() { | 1113 void test_undefinedSetter_static() { |
| 633 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "f() { A.B = 0;}"])); | 1114 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "f() { A.B = 0;}"])); |
| 634 resolve(source, []); | 1115 resolve(source, []); |
| 635 assertErrors([StaticTypeWarningCode.UNDEFINED_SETTER]); | 1116 assertErrors([StaticTypeWarningCode.UNDEFINED_SETTER]); |
| 636 } | 1117 } |
| 637 void test_undefinedSuperMethod() { | 1118 void test_undefinedSuperMethod() { |
| 638 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "class B extends A {", " m() { return super.m(); }", "}"])); | 1119 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "class B extends A {", " m() { return super.m(); }", "}"])); |
| 639 resolve(source, []); | 1120 resolve(source, []); |
| 640 assertErrors([StaticTypeWarningCode.UNDEFINED_SUPER_METHOD]); | 1121 assertErrors([StaticTypeWarningCode.UNDEFINED_SUPER_METHOD]); |
| 641 verify([source]); | |
| 642 } | 1122 } |
| 643 void test_wrongNumberOfTypeArguments_tooFew() { | 1123 void test_wrongNumberOfTypeArguments_tooFew() { |
| 644 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A<E, F> {}", "A<A> a = null;"])); | 1124 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A<E, F> {}", "A<A> a = null;"])); |
| 645 resolve(source, []); | 1125 resolve(source, []); |
| 646 assertErrors([StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]); | 1126 assertErrors([StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]); |
| 647 verify([source]); | 1127 verify([source]); |
| 648 } | 1128 } |
| 649 void test_wrongNumberOfTypeArguments_tooMany() { | 1129 void test_wrongNumberOfTypeArguments_tooMany() { |
| 650 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A<E> {}", "A<A, A> a = null;"])); | 1130 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A<E> {}", "A<A, A> a = null;"])); |
| 651 resolve(source, []); | 1131 resolve(source, []); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 runJUnitTest(__test, __test.test_returnOfInvalidType_method); | 1195 runJUnitTest(__test, __test.test_returnOfInvalidType_method); |
| 716 }); | 1196 }); |
| 717 _ut.test('test_typeArgumentNotMatchingBounds_const', () { | 1197 _ut.test('test_typeArgumentNotMatchingBounds_const', () { |
| 718 final __test = new StaticTypeWarningCodeTest(); | 1198 final __test = new StaticTypeWarningCodeTest(); |
| 719 runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_const); | 1199 runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_const); |
| 720 }); | 1200 }); |
| 721 _ut.test('test_typeArgumentNotMatchingBounds_new', () { | 1201 _ut.test('test_typeArgumentNotMatchingBounds_new', () { |
| 722 final __test = new StaticTypeWarningCodeTest(); | 1202 final __test = new StaticTypeWarningCodeTest(); |
| 723 runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_new); | 1203 runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_new); |
| 724 }); | 1204 }); |
| 1205 _ut.test('test_undefinedFunction', () { |
| 1206 final __test = new StaticTypeWarningCodeTest(); |
| 1207 runJUnitTest(__test, __test.test_undefinedFunction); |
| 1208 }); |
| 725 _ut.test('test_undefinedGetter', () { | 1209 _ut.test('test_undefinedGetter', () { |
| 726 final __test = new StaticTypeWarningCodeTest(); | 1210 final __test = new StaticTypeWarningCodeTest(); |
| 727 runJUnitTest(__test, __test.test_undefinedGetter); | 1211 runJUnitTest(__test, __test.test_undefinedGetter); |
| 728 }); | 1212 }); |
| 729 _ut.test('test_undefinedGetter_static', () { | 1213 _ut.test('test_undefinedGetter_static', () { |
| 730 final __test = new StaticTypeWarningCodeTest(); | 1214 final __test = new StaticTypeWarningCodeTest(); |
| 731 runJUnitTest(__test, __test.test_undefinedGetter_static); | 1215 runJUnitTest(__test, __test.test_undefinedGetter_static); |
| 732 }); | 1216 }); |
| 1217 _ut.test('test_undefinedMethod', () { |
| 1218 final __test = new StaticTypeWarningCodeTest(); |
| 1219 runJUnitTest(__test, __test.test_undefinedMethod); |
| 1220 }); |
| 733 _ut.test('test_undefinedSetter', () { | 1221 _ut.test('test_undefinedSetter', () { |
| 734 final __test = new StaticTypeWarningCodeTest(); | 1222 final __test = new StaticTypeWarningCodeTest(); |
| 735 runJUnitTest(__test, __test.test_undefinedSetter); | 1223 runJUnitTest(__test, __test.test_undefinedSetter); |
| 736 }); | 1224 }); |
| 737 _ut.test('test_undefinedSetter_static', () { | 1225 _ut.test('test_undefinedSetter_static', () { |
| 738 final __test = new StaticTypeWarningCodeTest(); | 1226 final __test = new StaticTypeWarningCodeTest(); |
| 739 runJUnitTest(__test, __test.test_undefinedSetter_static); | 1227 runJUnitTest(__test, __test.test_undefinedSetter_static); |
| 740 }); | 1228 }); |
| 741 _ut.test('test_undefinedSuperMethod', () { | 1229 _ut.test('test_undefinedSuperMethod', () { |
| 742 final __test = new StaticTypeWarningCodeTest(); | 1230 final __test = new StaticTypeWarningCodeTest(); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 774 void fail_visitConstructorDeclaration() { | 1262 void fail_visitConstructorDeclaration() { |
| 775 JUnitTestCase.fail("Not yet tested"); | 1263 JUnitTestCase.fail("Not yet tested"); |
| 776 _listener.assertNoErrors(); | 1264 _listener.assertNoErrors(); |
| 777 } | 1265 } |
| 778 void fail_visitFieldFormalParameter_noType() { | 1266 void fail_visitFieldFormalParameter_noType() { |
| 779 FormalParameter node = ASTFactory.fieldFormalParameter(Keyword.VAR, null, "p
"); | 1267 FormalParameter node = ASTFactory.fieldFormalParameter(Keyword.VAR, null, "p
"); |
| 780 JUnitTestCase.assertSame(_typeProvider.dynamicType, resolve5(node, [])); | 1268 JUnitTestCase.assertSame(_typeProvider.dynamicType, resolve5(node, [])); |
| 781 _listener.assertNoErrors(); | 1269 _listener.assertNoErrors(); |
| 782 } | 1270 } |
| 783 void fail_visitFieldFormalParameter_type() { | 1271 void fail_visitFieldFormalParameter_type() { |
| 784 FormalParameter node = ASTFactory.fieldFormalParameter(null, ASTFactory.type
Name3("int", []), "p"); | 1272 FormalParameter node = ASTFactory.fieldFormalParameter(null, ASTFactory.type
Name4("int", []), "p"); |
| 785 JUnitTestCase.assertSame(_typeProvider.intType, resolve5(node, [])); | 1273 JUnitTestCase.assertSame(_typeProvider.intType, resolve5(node, [])); |
| 786 _listener.assertNoErrors(); | 1274 _listener.assertNoErrors(); |
| 787 } | 1275 } |
| 788 void fail_visitFunctionDeclaration() { | 1276 void fail_visitFunctionDeclaration() { |
| 789 JUnitTestCase.fail("Not yet tested"); | 1277 JUnitTestCase.fail("Not yet tested"); |
| 790 _listener.assertNoErrors(); | 1278 _listener.assertNoErrors(); |
| 791 } | 1279 } |
| 792 void fail_visitFunctionTypeAlias() { | 1280 void fail_visitFunctionTypeAlias() { |
| 793 JUnitTestCase.fail("Not yet tested"); | 1281 JUnitTestCase.fail("Not yet tested"); |
| 794 _listener.assertNoErrors(); | 1282 _listener.assertNoErrors(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 807 VariableDeclaration node = ASTFactory.variableDeclaration("a"); | 1295 VariableDeclaration node = ASTFactory.variableDeclaration("a"); |
| 808 ASTFactory.variableDeclarationList(null, ASTFactory.typeName(type, []), [nod
e]); | 1296 ASTFactory.variableDeclarationList(null, ASTFactory.typeName(type, []), [nod
e]); |
| 809 JUnitTestCase.assertSame(type.type, node.name.staticType); | 1297 JUnitTestCase.assertSame(type.type, node.name.staticType); |
| 810 _listener.assertNoErrors(); | 1298 _listener.assertNoErrors(); |
| 811 } | 1299 } |
| 812 void setUp() { | 1300 void setUp() { |
| 813 _listener = new GatheringErrorListener(); | 1301 _listener = new GatheringErrorListener(); |
| 814 SourceFactory factory = new SourceFactory.con2([new FileUriResolver()]); | 1302 SourceFactory factory = new SourceFactory.con2([new FileUriResolver()]); |
| 815 AnalysisContextImpl context = new AnalysisContextImpl(); | 1303 AnalysisContextImpl context = new AnalysisContextImpl(); |
| 816 context.sourceFactory = factory; | 1304 context.sourceFactory = factory; |
| 817 Source librarySource = new FileBasedSource.con1(factory, FileUtilities2.crea
teFile("/lib.dart")); | 1305 Source librarySource = new FileBasedSource.con1(factory.contentCache, FileUt
ilities2.createFile("/lib.dart")); |
| 818 _library = new Library(context, _listener, librarySource); | 1306 _library = new Library(context, _listener, librarySource); |
| 819 LibraryElementImpl element = new LibraryElementImpl(context, ASTFactory.libr
aryIdentifier2(["lib"])); | 1307 LibraryElementImpl element = new LibraryElementImpl(context, ASTFactory.libr
aryIdentifier2(["lib"])); |
| 820 element.definingCompilationUnit = new CompilationUnitElementImpl("lib.dart")
; | 1308 element.definingCompilationUnit = new CompilationUnitElementImpl("lib.dart")
; |
| 821 _library.libraryElement = element; | 1309 _library.libraryElement = element; |
| 822 _typeProvider = new TestTypeProvider(); | 1310 _typeProvider = new TestTypeProvider(); |
| 823 _visitor = new TypeResolverVisitor(_library, librarySource, _typeProvider); | 1311 _visitor = new TypeResolverVisitor.con1(_library, librarySource, _typeProvid
er); |
| 824 } | 1312 } |
| 825 void test_visitCatchClause_exception() { | 1313 void test_visitCatchClause_exception() { |
| 826 CatchClause clause = ASTFactory.catchClause("e", []); | 1314 CatchClause clause = ASTFactory.catchClause("e", []); |
| 1315 SimpleIdentifier exceptionParameter4 = clause.exceptionParameter; |
| 1316 exceptionParameter4.element = new LocalVariableElementImpl(exceptionParamete
r4); |
| 827 resolve(clause, _typeProvider.objectType, null, []); | 1317 resolve(clause, _typeProvider.objectType, null, []); |
| 828 _listener.assertNoErrors(); | 1318 _listener.assertNoErrors(); |
| 829 } | 1319 } |
| 830 void test_visitCatchClause_exception_stackTrace() { | 1320 void test_visitCatchClause_exception_stackTrace() { |
| 831 CatchClause clause = ASTFactory.catchClause2("e", "s", []); | 1321 CatchClause clause = ASTFactory.catchClause2("e", "s", []); |
| 1322 SimpleIdentifier exceptionParameter5 = clause.exceptionParameter; |
| 1323 exceptionParameter5.element = new LocalVariableElementImpl(exceptionParamete
r5); |
| 1324 SimpleIdentifier stackTraceParameter4 = clause.stackTraceParameter; |
| 1325 stackTraceParameter4.element = new LocalVariableElementImpl(stackTraceParame
ter4); |
| 832 resolve(clause, _typeProvider.objectType, _typeProvider.stackTraceType, []); | 1326 resolve(clause, _typeProvider.objectType, _typeProvider.stackTraceType, []); |
| 833 _listener.assertNoErrors(); | 1327 _listener.assertNoErrors(); |
| 834 } | 1328 } |
| 835 void test_visitCatchClause_on_exception() { | 1329 void test_visitCatchClause_on_exception() { |
| 836 ClassElement exceptionElement = ElementFactory.classElement2("E", []); | 1330 ClassElement exceptionElement = ElementFactory.classElement2("E", []); |
| 837 TypeName exceptionType = ASTFactory.typeName(exceptionElement, []); | 1331 TypeName exceptionType = ASTFactory.typeName(exceptionElement, []); |
| 838 CatchClause clause = ASTFactory.catchClause4(exceptionType, "e", []); | 1332 CatchClause clause = ASTFactory.catchClause4(exceptionType, "e", []); |
| 1333 SimpleIdentifier exceptionParameter6 = clause.exceptionParameter; |
| 1334 exceptionParameter6.element = new LocalVariableElementImpl(exceptionParamete
r6); |
| 839 resolve(clause, exceptionElement.type, null, [exceptionElement]); | 1335 resolve(clause, exceptionElement.type, null, [exceptionElement]); |
| 840 _listener.assertNoErrors(); | 1336 _listener.assertNoErrors(); |
| 841 } | 1337 } |
| 842 void test_visitCatchClause_on_exception_stackTrace() { | 1338 void test_visitCatchClause_on_exception_stackTrace() { |
| 843 ClassElement exceptionElement = ElementFactory.classElement2("E", []); | 1339 ClassElement exceptionElement = ElementFactory.classElement2("E", []); |
| 844 TypeName exceptionType = ASTFactory.typeName(exceptionElement, []); | 1340 TypeName exceptionType = ASTFactory.typeName(exceptionElement, []); |
| 845 ((exceptionType.name as SimpleIdentifier)).element = exceptionElement; | 1341 ((exceptionType.name as SimpleIdentifier)).element = exceptionElement; |
| 846 CatchClause clause = ASTFactory.catchClause5(exceptionType, "e", "s", []); | 1342 CatchClause clause = ASTFactory.catchClause5(exceptionType, "e", "s", []); |
| 1343 SimpleIdentifier exceptionParameter7 = clause.exceptionParameter; |
| 1344 exceptionParameter7.element = new LocalVariableElementImpl(exceptionParamete
r7); |
| 1345 SimpleIdentifier stackTraceParameter5 = clause.stackTraceParameter; |
| 1346 stackTraceParameter5.element = new LocalVariableElementImpl(stackTraceParame
ter5); |
| 847 resolve(clause, exceptionElement.type, _typeProvider.stackTraceType, [except
ionElement]); | 1347 resolve(clause, exceptionElement.type, _typeProvider.stackTraceType, [except
ionElement]); |
| 848 _listener.assertNoErrors(); | 1348 _listener.assertNoErrors(); |
| 849 } | 1349 } |
| 850 void test_visitClassDeclaration() { | 1350 void test_visitClassDeclaration() { |
| 851 ClassElement elementA = ElementFactory.classElement2("A", []); | 1351 ClassElement elementA = ElementFactory.classElement2("A", []); |
| 852 ClassElement elementB = ElementFactory.classElement2("B", []); | 1352 ClassElement elementB = ElementFactory.classElement2("B", []); |
| 853 ClassElement elementC = ElementFactory.classElement2("C", []); | 1353 ClassElement elementC = ElementFactory.classElement2("C", []); |
| 854 ClassElement elementD = ElementFactory.classElement2("D", []); | 1354 ClassElement elementD = ElementFactory.classElement2("D", []); |
| 855 ExtendsClause extendsClause2 = ASTFactory.extendsClause(ASTFactory.typeName(
elementB, [])); | 1355 ExtendsClause extendsClause2 = ASTFactory.extendsClause(ASTFactory.typeName(
elementB, [])); |
| 856 WithClause withClause2 = ASTFactory.withClause([ASTFactory.typeName(elementC
, [])]); | 1356 WithClause withClause2 = ASTFactory.withClause([ASTFactory.typeName(elementC
, [])]); |
| 857 ImplementsClause implementsClause2 = ASTFactory.implementsClause([ASTFactory
.typeName(elementD, [])]); | 1357 ImplementsClause implementsClause2 = ASTFactory.implementsClause([ASTFactory
.typeName(elementD, [])]); |
| 858 ClassDeclaration declaration = ASTFactory.classDeclaration(null, "A", null,
extendsClause2, withClause2, implementsClause2, []); | 1358 ClassDeclaration declaration = ASTFactory.classDeclaration(null, "A", null,
extendsClause2, withClause2, implementsClause2, []); |
| 859 declaration.name.element = elementA; | 1359 declaration.name.element = elementA; |
| 860 resolveNode(declaration, [elementA, elementB, elementC, elementD]); | 1360 resolveNode(declaration, [elementA, elementB, elementC, elementD]); |
| 861 JUnitTestCase.assertSame(elementB.type, elementA.supertype); | 1361 JUnitTestCase.assertSame(elementB.type, elementA.supertype); |
| 862 List<InterfaceType> mixins3 = elementA.mixins; | 1362 List<InterfaceType> mixins4 = elementA.mixins; |
| 863 EngineTestCase.assertLength(1, mixins3); | 1363 EngineTestCase.assertLength(1, mixins4); |
| 864 JUnitTestCase.assertSame(elementC.type, mixins3[0]); | 1364 JUnitTestCase.assertSame(elementC.type, mixins4[0]); |
| 865 List<InterfaceType> interfaces3 = elementA.interfaces; | 1365 List<InterfaceType> interfaces5 = elementA.interfaces; |
| 866 EngineTestCase.assertLength(1, interfaces3); | 1366 EngineTestCase.assertLength(1, interfaces5); |
| 867 JUnitTestCase.assertSame(elementD.type, interfaces3[0]); | 1367 JUnitTestCase.assertSame(elementD.type, interfaces5[0]); |
| 868 _listener.assertNoErrors(); | 1368 _listener.assertNoErrors(); |
| 869 } | 1369 } |
| 870 void test_visitClassTypeAlias() { | 1370 void test_visitClassTypeAlias() { |
| 871 ClassElement elementA = ElementFactory.classElement2("A", []); | 1371 ClassElement elementA = ElementFactory.classElement2("A", []); |
| 872 ClassElement elementB = ElementFactory.classElement2("B", []); | 1372 ClassElement elementB = ElementFactory.classElement2("B", []); |
| 873 ClassElement elementC = ElementFactory.classElement2("C", []); | 1373 ClassElement elementC = ElementFactory.classElement2("C", []); |
| 874 ClassElement elementD = ElementFactory.classElement2("D", []); | 1374 ClassElement elementD = ElementFactory.classElement2("D", []); |
| 875 WithClause withClause3 = ASTFactory.withClause([ASTFactory.typeName(elementC
, [])]); | 1375 WithClause withClause3 = ASTFactory.withClause([ASTFactory.typeName(elementC
, [])]); |
| 876 ImplementsClause implementsClause3 = ASTFactory.implementsClause([ASTFactory
.typeName(elementD, [])]); | 1376 ImplementsClause implementsClause3 = ASTFactory.implementsClause([ASTFactory
.typeName(elementD, [])]); |
| 877 ClassTypeAlias alias = ASTFactory.classTypeAlias("A", null, null, ASTFactory
.typeName(elementB, []), withClause3, implementsClause3); | 1377 ClassTypeAlias alias = ASTFactory.classTypeAlias("A", null, null, ASTFactory
.typeName(elementB, []), withClause3, implementsClause3); |
| 878 alias.name.element = elementA; | 1378 alias.name.element = elementA; |
| 879 resolveNode(alias, [elementA, elementB, elementC, elementD]); | 1379 resolveNode(alias, [elementA, elementB, elementC, elementD]); |
| 880 JUnitTestCase.assertSame(elementB.type, elementA.supertype); | 1380 JUnitTestCase.assertSame(elementB.type, elementA.supertype); |
| 881 List<InterfaceType> mixins4 = elementA.mixins; | 1381 List<InterfaceType> mixins5 = elementA.mixins; |
| 882 EngineTestCase.assertLength(1, mixins4); | 1382 EngineTestCase.assertLength(1, mixins5); |
| 883 JUnitTestCase.assertSame(elementC.type, mixins4[0]); | 1383 JUnitTestCase.assertSame(elementC.type, mixins5[0]); |
| 884 List<InterfaceType> interfaces4 = elementA.interfaces; | 1384 List<InterfaceType> interfaces6 = elementA.interfaces; |
| 885 EngineTestCase.assertLength(1, interfaces4); | 1385 EngineTestCase.assertLength(1, interfaces6); |
| 886 JUnitTestCase.assertSame(elementD.type, interfaces4[0]); | 1386 JUnitTestCase.assertSame(elementD.type, interfaces6[0]); |
| 887 _listener.assertNoErrors(); | 1387 _listener.assertNoErrors(); |
| 888 } | 1388 } |
| 889 void test_visitSimpleFormalParameter_noType() { | 1389 void test_visitSimpleFormalParameter_noType() { |
| 890 FormalParameter node = ASTFactory.simpleFormalParameter3("p"); | 1390 FormalParameter node = ASTFactory.simpleFormalParameter3("p"); |
| 891 node.identifier.element = new ParameterElementImpl(ASTFactory.identifier2("p
")); | 1391 node.identifier.element = new ParameterElementImpl(ASTFactory.identifier3("p
")); |
| 892 JUnitTestCase.assertSame(_typeProvider.dynamicType, resolve5(node, [])); | 1392 JUnitTestCase.assertSame(_typeProvider.dynamicType, resolve5(node, [])); |
| 893 _listener.assertNoErrors(); | 1393 _listener.assertNoErrors(); |
| 894 } | 1394 } |
| 895 void test_visitSimpleFormalParameter_type() { | 1395 void test_visitSimpleFormalParameter_type() { |
| 896 InterfaceType intType9 = _typeProvider.intType; | 1396 InterfaceType intType10 = _typeProvider.intType; |
| 897 ClassElement intElement = intType9.element; | 1397 ClassElement intElement = intType10.element; |
| 898 FormalParameter node = ASTFactory.simpleFormalParameter4(ASTFactory.typeName
(intElement, []), "p"); | 1398 FormalParameter node = ASTFactory.simpleFormalParameter4(ASTFactory.typeName
(intElement, []), "p"); |
| 899 SimpleIdentifier identifier18 = node.identifier; | 1399 SimpleIdentifier identifier20 = node.identifier; |
| 900 ParameterElementImpl element = new ParameterElementImpl(identifier18); | 1400 ParameterElementImpl element = new ParameterElementImpl(identifier20); |
| 901 identifier18.element = element; | 1401 identifier20.element = element; |
| 902 JUnitTestCase.assertSame(intType9, resolve5(node, [intElement])); | 1402 JUnitTestCase.assertSame(intType10, resolve5(node, [intElement])); |
| 903 _listener.assertNoErrors(); | 1403 _listener.assertNoErrors(); |
| 904 } | 1404 } |
| 905 void test_visitTypeName_noParameters_noArguments() { | 1405 void test_visitTypeName_noParameters_noArguments() { |
| 906 ClassElement classA = ElementFactory.classElement2("A", []); | 1406 ClassElement classA = ElementFactory.classElement2("A", []); |
| 907 TypeName typeName5 = ASTFactory.typeName(classA, []); | 1407 TypeName typeName6 = ASTFactory.typeName(classA, []); |
| 908 typeName5.type = null; | 1408 typeName6.type = null; |
| 909 resolveNode(typeName5, [classA]); | 1409 resolveNode(typeName6, [classA]); |
| 910 JUnitTestCase.assertSame(classA.type, typeName5.type); | 1410 JUnitTestCase.assertSame(classA.type, typeName6.type); |
| 911 _listener.assertNoErrors(); | 1411 _listener.assertNoErrors(); |
| 912 } | 1412 } |
| 913 void test_visitTypeName_parameters_arguments() { | 1413 void test_visitTypeName_parameters_arguments() { |
| 914 ClassElement classA = ElementFactory.classElement2("A", ["E"]); | 1414 ClassElement classA = ElementFactory.classElement2("A", ["E"]); |
| 915 ClassElement classB = ElementFactory.classElement2("B", []); | 1415 ClassElement classB = ElementFactory.classElement2("B", []); |
| 916 TypeName typeName6 = ASTFactory.typeName(classA, [ASTFactory.typeName(classB
, [])]); | 1416 TypeName typeName7 = ASTFactory.typeName(classA, [ASTFactory.typeName(classB
, [])]); |
| 917 typeName6.type = null; | 1417 typeName7.type = null; |
| 918 resolveNode(typeName6, [classA, classB]); | 1418 resolveNode(typeName7, [classA, classB]); |
| 919 InterfaceType resultType = typeName6.type as InterfaceType; | 1419 InterfaceType resultType = typeName7.type as InterfaceType; |
| 920 JUnitTestCase.assertSame(classA, resultType.element); | 1420 JUnitTestCase.assertSame(classA, resultType.element); |
| 921 List<Type2> resultArguments = resultType.typeArguments; | 1421 List<Type2> resultArguments = resultType.typeArguments; |
| 922 EngineTestCase.assertLength(1, resultArguments); | 1422 EngineTestCase.assertLength(1, resultArguments); |
| 923 JUnitTestCase.assertSame(classB.type, resultArguments[0]); | 1423 JUnitTestCase.assertSame(classB.type, resultArguments[0]); |
| 924 _listener.assertNoErrors(); | 1424 _listener.assertNoErrors(); |
| 925 } | 1425 } |
| 926 void test_visitTypeName_parameters_noArguments() { | 1426 void test_visitTypeName_parameters_noArguments() { |
| 927 ClassElement classA = ElementFactory.classElement2("A", ["E"]); | 1427 ClassElement classA = ElementFactory.classElement2("A", ["E"]); |
| 928 TypeName typeName7 = ASTFactory.typeName(classA, []); | 1428 TypeName typeName8 = ASTFactory.typeName(classA, []); |
| 929 typeName7.type = null; | 1429 typeName8.type = null; |
| 930 resolveNode(typeName7, [classA]); | 1430 resolveNode(typeName8, [classA]); |
| 931 InterfaceType resultType = typeName7.type as InterfaceType; | 1431 InterfaceType resultType = typeName8.type as InterfaceType; |
| 932 JUnitTestCase.assertSame(classA, resultType.element); | 1432 JUnitTestCase.assertSame(classA, resultType.element); |
| 933 List<Type2> resultArguments = resultType.typeArguments; | 1433 List<Type2> resultArguments = resultType.typeArguments; |
| 934 EngineTestCase.assertLength(1, resultArguments); | 1434 EngineTestCase.assertLength(1, resultArguments); |
| 935 JUnitTestCase.assertSame(DynamicTypeImpl.instance, resultArguments[0]); | 1435 JUnitTestCase.assertSame(DynamicTypeImpl.instance, resultArguments[0]); |
| 936 _listener.assertNoErrors(); | 1436 _listener.assertNoErrors(); |
| 937 } | 1437 } |
| 1438 void test_visitTypeName_void() { |
| 1439 ClassElement classA = ElementFactory.classElement2("A", []); |
| 1440 TypeName typeName = ASTFactory.typeName4("void", []); |
| 1441 resolveNode(typeName, [classA]); |
| 1442 JUnitTestCase.assertSame(VoidTypeImpl.instance, typeName.type); |
| 1443 _listener.assertNoErrors(); |
| 1444 } |
| 938 /** | 1445 /** |
| 939 * Analyze the given catch clause and assert that the types of the parameters
have been set to the | 1446 * Analyze the given catch clause and assert that the types of the parameters
have been set to the |
| 940 * given types. The types can be null if the catch clause does not have the co
rresponding | 1447 * given types. The types can be null if the catch clause does not have the co
rresponding |
| 941 * parameter. | 1448 * parameter. |
| 942 * @param node the catch clause to be analyzed | 1449 * @param node the catch clause to be analyzed |
| 943 * @param exceptionType the expected type of the exception parameter | 1450 * @param exceptionType the expected type of the exception parameter |
| 944 * @param stackTraceType the expected type of the stack trace parameter | 1451 * @param stackTraceType the expected type of the stack trace parameter |
| 945 * @param definedElements the elements that are to be defined in the scope in
which the element is | 1452 * @param definedElements the elements that are to be defined in the scope in
which the element is |
| 946 * being resolved | 1453 * being resolved |
| 947 */ | 1454 */ |
| 948 void resolve(CatchClause node, InterfaceType exceptionType, InterfaceType stac
kTraceType, List<Element> definedElements) { | 1455 void resolve(CatchClause node, InterfaceType exceptionType, InterfaceType stac
kTraceType, List<Element> definedElements) { |
| 949 resolveNode(node, definedElements); | 1456 resolveNode(node, definedElements); |
| 950 SimpleIdentifier exceptionParameter3 = node.exceptionParameter; | 1457 SimpleIdentifier exceptionParameter8 = node.exceptionParameter; |
| 951 if (exceptionParameter3 != null) { | 1458 if (exceptionParameter8 != null) { |
| 952 JUnitTestCase.assertSame(exceptionType, exceptionParameter3.staticType); | 1459 JUnitTestCase.assertSame(exceptionType, exceptionParameter8.staticType); |
| 953 } | 1460 } |
| 954 SimpleIdentifier stackTraceParameter3 = node.stackTraceParameter; | 1461 SimpleIdentifier stackTraceParameter6 = node.stackTraceParameter; |
| 955 if (stackTraceParameter3 != null) { | 1462 if (stackTraceParameter6 != null) { |
| 956 JUnitTestCase.assertSame(stackTraceType, stackTraceParameter3.staticType); | 1463 JUnitTestCase.assertSame(stackTraceType, stackTraceParameter6.staticType); |
| 957 } | 1464 } |
| 958 } | 1465 } |
| 959 /** | 1466 /** |
| 960 * Return the type associated with the given parameter after the static type a
nalyzer has computed | 1467 * Return the type associated with the given parameter after the static type a
nalyzer has computed |
| 961 * a type for it. | 1468 * a type for it. |
| 962 * @param node the parameter with which the type is associated | 1469 * @param node the parameter with which the type is associated |
| 963 * @param definedElements the elements that are to be defined in the scope in
which the element is | 1470 * @param definedElements the elements that are to be defined in the scope in
which the element is |
| 964 * being resolved | 1471 * being resolved |
| 965 * @return the type associated with the parameter | 1472 * @return the type associated with the parameter |
| 966 */ | 1473 */ |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1021 runJUnitTest(__test, __test.test_visitTypeName_noParameters_noArguments)
; | 1528 runJUnitTest(__test, __test.test_visitTypeName_noParameters_noArguments)
; |
| 1022 }); | 1529 }); |
| 1023 _ut.test('test_visitTypeName_parameters_arguments', () { | 1530 _ut.test('test_visitTypeName_parameters_arguments', () { |
| 1024 final __test = new TypeResolverVisitorTest(); | 1531 final __test = new TypeResolverVisitorTest(); |
| 1025 runJUnitTest(__test, __test.test_visitTypeName_parameters_arguments); | 1532 runJUnitTest(__test, __test.test_visitTypeName_parameters_arguments); |
| 1026 }); | 1533 }); |
| 1027 _ut.test('test_visitTypeName_parameters_noArguments', () { | 1534 _ut.test('test_visitTypeName_parameters_noArguments', () { |
| 1028 final __test = new TypeResolverVisitorTest(); | 1535 final __test = new TypeResolverVisitorTest(); |
| 1029 runJUnitTest(__test, __test.test_visitTypeName_parameters_noArguments); | 1536 runJUnitTest(__test, __test.test_visitTypeName_parameters_noArguments); |
| 1030 }); | 1537 }); |
| 1538 _ut.test('test_visitTypeName_void', () { |
| 1539 final __test = new TypeResolverVisitorTest(); |
| 1540 runJUnitTest(__test, __test.test_visitTypeName_void); |
| 1541 }); |
| 1031 }); | 1542 }); |
| 1032 } | 1543 } |
| 1033 } | 1544 } |
| 1034 class ResolverTestCase extends EngineTestCase { | 1545 class ResolverTestCase extends EngineTestCase { |
| 1035 /** | 1546 /** |
| 1036 * The source factory used to create {@link Source sources}. | 1547 * The source factory used to create {@link Source sources}. |
| 1037 */ | 1548 */ |
| 1038 SourceFactory _sourceFactory; | 1549 SourceFactory _sourceFactory; |
| 1039 /** | 1550 /** |
| 1040 * The error listener used during resolution. | 1551 * The error listener used during resolution. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1060 _analysisContext = AnalysisContextFactory.contextWithCore(); | 1571 _analysisContext = AnalysisContextFactory.contextWithCore(); |
| 1061 _sourceFactory = _analysisContext.sourceFactory; | 1572 _sourceFactory = _analysisContext.sourceFactory; |
| 1062 } | 1573 } |
| 1063 /** | 1574 /** |
| 1064 * Add a source file to the content provider. The file path should be absolute
. | 1575 * Add a source file to the content provider. The file path should be absolute
. |
| 1065 * @param filePath the path of the file being added | 1576 * @param filePath the path of the file being added |
| 1066 * @param contents the contents to be returned by the content provider for the
specified file | 1577 * @param contents the contents to be returned by the content provider for the
specified file |
| 1067 * @return the source object representing the added file | 1578 * @return the source object representing the added file |
| 1068 */ | 1579 */ |
| 1069 Source addSource(String filePath, String contents) { | 1580 Source addSource(String filePath, String contents) { |
| 1070 Source source = new FileBasedSource.con1(_sourceFactory, FileUtilities2.crea
teFile(filePath)); | 1581 Source source = new FileBasedSource.con1(_sourceFactory.contentCache, FileUt
ilities2.createFile(filePath)); |
| 1071 _sourceFactory.setContents(source, contents); | 1582 _sourceFactory.setContents(source, contents); |
| 1072 ChangeSet changeSet = new ChangeSet(); | 1583 ChangeSet changeSet = new ChangeSet(); |
| 1073 changeSet.added(source); | 1584 changeSet.added(source); |
| 1074 _analysisContext.applyChanges(changeSet); | 1585 _analysisContext.applyChanges(changeSet); |
| 1075 return source; | 1586 return source; |
| 1076 } | 1587 } |
| 1077 /** | 1588 /** |
| 1078 * Assert that no errors have been gathered. | 1589 * Assert that no errors have been gathered. |
| 1079 * @throws AssertionFailedError if any errors have been gathered | 1590 * @throws AssertionFailedError if any errors have been gathered |
| 1080 */ | 1591 */ |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1091 * Create a library element that represents a library with the given name cont
aining a single | 1602 * Create a library element that represents a library with the given name cont
aining a single |
| 1092 * empty compilation unit. | 1603 * empty compilation unit. |
| 1093 * @param libraryName the name of the library to be created | 1604 * @param libraryName the name of the library to be created |
| 1094 * @return the library element that was created | 1605 * @return the library element that was created |
| 1095 */ | 1606 */ |
| 1096 LibraryElementImpl createTestLibrary2(AnalysisContext context, String libraryN
ame, List<String> typeNames) { | 1607 LibraryElementImpl createTestLibrary2(AnalysisContext context, String libraryN
ame, List<String> typeNames) { |
| 1097 int count = typeNames.length; | 1608 int count = typeNames.length; |
| 1098 List<CompilationUnitElementImpl> sourcedCompilationUnits = new List<Compilat
ionUnitElementImpl>(count); | 1609 List<CompilationUnitElementImpl> sourcedCompilationUnits = new List<Compilat
ionUnitElementImpl>(count); |
| 1099 for (int i = 0; i < count; i++) { | 1610 for (int i = 0; i < count; i++) { |
| 1100 String typeName = typeNames[i]; | 1611 String typeName = typeNames[i]; |
| 1101 ClassElementImpl type = new ClassElementImpl(ASTFactory.identifier2(typeNa
me)); | 1612 ClassElementImpl type = new ClassElementImpl(ASTFactory.identifier3(typeNa
me)); |
| 1102 String fileName = "${typeName}.dart"; | 1613 String fileName = "${typeName}.dart"; |
| 1103 CompilationUnitElementImpl compilationUnit = new CompilationUnitElementImp
l(fileName); | 1614 CompilationUnitElementImpl compilationUnit = new CompilationUnitElementImp
l(fileName); |
| 1104 compilationUnit.source = createSource2(fileName); | 1615 compilationUnit.source = createSource2(fileName); |
| 1105 compilationUnit.types = <ClassElement> [type]; | 1616 compilationUnit.types = <ClassElement> [type]; |
| 1106 sourcedCompilationUnits[i] = compilationUnit; | 1617 sourcedCompilationUnits[i] = compilationUnit; |
| 1107 } | 1618 } |
| 1108 String fileName = "${libraryName}.dart"; | 1619 String fileName = "${libraryName}.dart"; |
| 1109 CompilationUnitElementImpl compilationUnit = new CompilationUnitElementImpl(
fileName); | 1620 CompilationUnitElementImpl compilationUnit = new CompilationUnitElementImpl(
fileName); |
| 1110 compilationUnit.source = createSource2(fileName); | 1621 compilationUnit.source = createSource2(fileName); |
| 1111 LibraryElementImpl library = new LibraryElementImpl(context, ASTFactory.libr
aryIdentifier2([libraryName])); | 1622 LibraryElementImpl library = new LibraryElementImpl(context, ASTFactory.libr
aryIdentifier2([libraryName])); |
| 1112 library.definingCompilationUnit = compilationUnit; | 1623 library.definingCompilationUnit = compilationUnit; |
| 1113 library.parts = sourcedCompilationUnits; | 1624 library.parts = sourcedCompilationUnits; |
| 1114 return library; | 1625 return library; |
| 1115 } | 1626 } |
| 1116 AnalysisContext get analysisContext => _analysisContext; | 1627 AnalysisContext get analysisContext => _analysisContext; |
| 1117 GatheringErrorListener get errorListener => _errorListener; | 1628 GatheringErrorListener get errorListener => _errorListener; |
| 1118 SourceFactory get sourceFactory => _sourceFactory; | 1629 SourceFactory get sourceFactory => _sourceFactory; |
| 1119 /** | 1630 /** |
| 1631 * Return a type provider that can be used to test the results of resolution. |
| 1632 * @return a type provider |
| 1633 */ |
| 1634 TypeProvider get typeProvider { |
| 1635 Source coreSource = _analysisContext.sourceFactory.forUri(DartSdk.DART_CORE)
; |
| 1636 LibraryElement coreElement = _analysisContext.getLibraryElement(coreSource); |
| 1637 return new TypeProviderImpl(coreElement); |
| 1638 } |
| 1639 /** |
| 1120 * Given a library and all of its parts, resolve the contents of the library a
nd the contents of | 1640 * Given a library and all of its parts, resolve the contents of the library a
nd the contents of |
| 1121 * the parts. This assumes that the sources for the library and its parts have
already been added | 1641 * the parts. This assumes that the sources for the library and its parts have
already been added |
| 1122 * to the content provider using the method {@link #addSource(String,String)}. | 1642 * to the content provider using the method {@link #addSource(String,String)}. |
| 1123 * @param librarySource the source for the compilation unit that defines the l
ibrary | 1643 * @param librarySource the source for the compilation unit that defines the l
ibrary |
| 1124 * @param unitSources the sources for the compilation units that are part of t
he library | 1644 * @param unitSources the sources for the compilation units that are part of t
he library |
| 1125 * @return the element representing the resolved library | 1645 * @return the element representing the resolved library |
| 1126 * @throws AnalysisException if the analysis could not be performed | 1646 * @throws AnalysisException if the analysis could not be performed |
| 1127 */ | 1647 */ |
| 1128 LibraryElement resolve(Source librarySource, List<Source> unitSources) { | 1648 LibraryElement resolve(Source librarySource, List<Source> unitSources) { |
| 1129 LibraryResolver resolver = new LibraryResolver.con2(_analysisContext, _error
Listener); | 1649 LibraryResolver resolver = new LibraryResolver.con2(_analysisContext, _error
Listener); |
| 1130 return resolver.resolveLibrary(librarySource, true); | 1650 return resolver.resolveLibrary(librarySource, true); |
| 1131 } | 1651 } |
| 1132 /** | 1652 /** |
| 1653 * Return the resolved compilation unit corresponding to the given source in t
he given library. |
| 1654 * @param source the source of the compilation unit to be returned |
| 1655 * @param library the library in which the compilation unit is to be resolved |
| 1656 * @return the resolved compilation unit |
| 1657 * @throws Exception if the compilation unit could not be resolved |
| 1658 */ |
| 1659 CompilationUnit resolveCompilationUnit(Source source, LibraryElement library)
=> _analysisContext.resolveCompilationUnit(source, library); |
| 1660 /** |
| 1133 * Verify that all of the identifiers in the compilation units associated with
the given sources | 1661 * Verify that all of the identifiers in the compilation units associated with
the given sources |
| 1134 * have been resolved. | 1662 * have been resolved. |
| 1135 * @param resolvedElementMap a table mapping the AST nodes that have been reso
lved to the element | 1663 * @param resolvedElementMap a table mapping the AST nodes that have been reso
lved to the element |
| 1136 * to which they were resolved | 1664 * to which they were resolved |
| 1137 * @param sources the sources identifying the compilation units to be verified | 1665 * @param sources the sources identifying the compilation units to be verified |
| 1138 * @throws Exception if the contents of the compilation unit cannot be accesse
d | 1666 * @throws Exception if the contents of the compilation unit cannot be accesse
d |
| 1139 */ | 1667 */ |
| 1140 void verify(List<Source> sources) { | 1668 void verify(List<Source> sources) { |
| 1141 ResolutionVerifier verifier = new ResolutionVerifier(); | 1669 ResolutionVerifier verifier = new ResolutionVerifier(); |
| 1142 for (Source source in sources) { | 1670 for (Source source in sources) { |
| 1143 _analysisContext.parseCompilationUnit(source).accept(verifier); | 1671 _analysisContext.parseCompilationUnit(source).accept(verifier); |
| 1144 } | 1672 } |
| 1145 verifier.assertResolved(); | 1673 verifier.assertResolved(); |
| 1146 } | 1674 } |
| 1147 /** | 1675 /** |
| 1148 * Create a source object representing a file with the given name and give it
an empty content. | 1676 * Create a source object representing a file with the given name and give it
an empty content. |
| 1149 * @param fileName the name of the file for which a source is to be created | 1677 * @param fileName the name of the file for which a source is to be created |
| 1150 * @return the source that was created | 1678 * @return the source that was created |
| 1151 */ | 1679 */ |
| 1152 FileBasedSource createSource2(String fileName) { | 1680 FileBasedSource createSource2(String fileName) { |
| 1153 FileBasedSource source = new FileBasedSource.con1(_sourceFactory, FileUtilit
ies2.createFile(fileName)); | 1681 FileBasedSource source = new FileBasedSource.con1(_sourceFactory.contentCach
e, FileUtilities2.createFile(fileName)); |
| 1154 _sourceFactory.setContents(source, ""); | 1682 _sourceFactory.setContents(source, ""); |
| 1155 return source; | 1683 return source; |
| 1156 } | 1684 } |
| 1157 static dartSuite() { | 1685 static dartSuite() { |
| 1158 _ut.group('ResolverTestCase', () { | 1686 _ut.group('ResolverTestCase', () { |
| 1159 }); | 1687 }); |
| 1160 } | 1688 } |
| 1161 } | 1689 } |
| 1162 class TypeProviderImplTest extends EngineTestCase { | 1690 class TypeProviderImplTest extends EngineTestCase { |
| 1163 void test_creation() { | 1691 void test_creation() { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1184 JUnitTestCase.assertSame(functionType, provider.functionType); | 1712 JUnitTestCase.assertSame(functionType, provider.functionType); |
| 1185 JUnitTestCase.assertSame(intType, provider.intType); | 1713 JUnitTestCase.assertSame(intType, provider.intType); |
| 1186 JUnitTestCase.assertSame(listType, provider.listType); | 1714 JUnitTestCase.assertSame(listType, provider.listType); |
| 1187 JUnitTestCase.assertSame(mapType, provider.mapType); | 1715 JUnitTestCase.assertSame(mapType, provider.mapType); |
| 1188 JUnitTestCase.assertSame(objectType, provider.objectType); | 1716 JUnitTestCase.assertSame(objectType, provider.objectType); |
| 1189 JUnitTestCase.assertSame(stackTraceType, provider.stackTraceType); | 1717 JUnitTestCase.assertSame(stackTraceType, provider.stackTraceType); |
| 1190 JUnitTestCase.assertSame(stringType, provider.stringType); | 1718 JUnitTestCase.assertSame(stringType, provider.stringType); |
| 1191 JUnitTestCase.assertSame(typeType, provider.typeType); | 1719 JUnitTestCase.assertSame(typeType, provider.typeType); |
| 1192 } | 1720 } |
| 1193 ClassElement classElement(String typeName, InterfaceType superclassType, List<
String> parameterNames) { | 1721 ClassElement classElement(String typeName, InterfaceType superclassType, List<
String> parameterNames) { |
| 1194 ClassElementImpl element = new ClassElementImpl(ASTFactory.identifier2(typeN
ame)); | 1722 ClassElementImpl element = new ClassElementImpl(ASTFactory.identifier3(typeN
ame)); |
| 1195 element.supertype = superclassType; | 1723 element.supertype = superclassType; |
| 1196 InterfaceTypeImpl type = new InterfaceTypeImpl.con1(element); | 1724 InterfaceTypeImpl type = new InterfaceTypeImpl.con1(element); |
| 1197 element.type = type; | 1725 element.type = type; |
| 1198 int count = parameterNames.length; | 1726 int count = parameterNames.length; |
| 1199 if (count > 0) { | 1727 if (count > 0) { |
| 1200 List<TypeVariableElementImpl> typeVariables = new List<TypeVariableElement
Impl>(count); | 1728 List<TypeVariableElementImpl> typeVariables = new List<TypeVariableElement
Impl>(count); |
| 1201 List<TypeVariableTypeImpl> typeArguments = new List<TypeVariableTypeImpl>(
count); | 1729 List<TypeVariableTypeImpl> typeArguments = new List<TypeVariableTypeImpl>(
count); |
| 1202 for (int i = 0; i < count; i++) { | 1730 for (int i = 0; i < count; i++) { |
| 1203 TypeVariableElementImpl variable = new TypeVariableElementImpl(ASTFactor
y.identifier2(parameterNames[i])); | 1731 TypeVariableElementImpl variable = new TypeVariableElementImpl(ASTFactor
y.identifier3(parameterNames[i])); |
| 1204 typeVariables[i] = variable; | 1732 typeVariables[i] = variable; |
| 1205 typeArguments[i] = new TypeVariableTypeImpl(variable); | 1733 typeArguments[i] = new TypeVariableTypeImpl(variable); |
| 1206 variable.type = typeArguments[i]; | 1734 variable.type = typeArguments[i]; |
| 1207 } | 1735 } |
| 1208 element.typeVariables = typeVariables; | 1736 element.typeVariables = typeVariables; |
| 1209 type.typeArguments = typeArguments; | 1737 type.typeArguments = typeArguments; |
| 1210 } | 1738 } |
| 1211 return element; | 1739 return element; |
| 1212 } | 1740 } |
| 1213 static dartSuite() { | 1741 static dartSuite() { |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1291 resolve(source, []); | 1819 resolve(source, []); |
| 1292 assertErrors([CompileTimeErrorCode.DUPLICATE_MEMBER_NAME_INSTANCE_STATIC]); | 1820 assertErrors([CompileTimeErrorCode.DUPLICATE_MEMBER_NAME_INSTANCE_STATIC]); |
| 1293 verify([source]); | 1821 verify([source]); |
| 1294 } | 1822 } |
| 1295 void fail_duplicateNamedArgument() { | 1823 void fail_duplicateNamedArgument() { |
| 1296 Source source = addSource("/test.dart", EngineTestCase.createSource(["f({a,
a}) {}"])); | 1824 Source source = addSource("/test.dart", EngineTestCase.createSource(["f({a,
a}) {}"])); |
| 1297 resolve(source, []); | 1825 resolve(source, []); |
| 1298 assertErrors([CompileTimeErrorCode.DUPLICATE_NAMED_ARGUMENT]); | 1826 assertErrors([CompileTimeErrorCode.DUPLICATE_NAMED_ARGUMENT]); |
| 1299 verify([source]); | 1827 verify([source]); |
| 1300 } | 1828 } |
| 1301 void fail_exportOfNonLibrary() { | |
| 1302 Source source = addSource("/test.dart", EngineTestCase.createSource(["librar
y L;", "export 'lib1.dart';"])); | |
| 1303 addSource("/lib1.dart", EngineTestCase.createSource(["part of lib;"])); | |
| 1304 resolve(source, []); | |
| 1305 assertErrors([CompileTimeErrorCode.EXPORT_OF_NON_LIBRARY]); | |
| 1306 verify([source]); | |
| 1307 } | |
| 1308 void fail_extendsOrImplementsDisallowedClass_extends_null() { | 1829 void fail_extendsOrImplementsDisallowedClass_extends_null() { |
| 1309 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A extends Null {}"])); | 1830 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A extends Null {}"])); |
| 1310 resolve(source, []); | 1831 resolve(source, []); |
| 1311 assertErrors([CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]); | 1832 assertErrors([CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]); |
| 1312 verify([source]); | 1833 verify([source]); |
| 1313 } | 1834 } |
| 1314 void fail_extendsOrImplementsDisallowedClass_implements_null() { | 1835 void fail_extendsOrImplementsDisallowedClass_implements_null() { |
| 1315 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A implements Null {}"])); | 1836 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A implements Null {}"])); |
| 1316 resolve(source, []); | 1837 resolve(source, []); |
| 1317 assertErrors([CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]); | 1838 assertErrors([CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]); |
| 1318 verify([source]); | 1839 verify([source]); |
| 1319 } | 1840 } |
| 1320 void fail_fieldInitializedByMultipleInitializers() { | 1841 void fail_finalNotInitialized_inConstructor() { |
| 1321 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int x;", " A() : x = 0, x = 1 {}", "}"])); | 1842 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " final int x;", " A() {}", "}"])); |
| 1322 resolve(source, []); | |
| 1323 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZER
S]); | |
| 1324 verify([source]); | |
| 1325 } | |
| 1326 void fail_finalInitializedInDeclarationAndConstructor_assignment() { | |
| 1327 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " final x = 0;", " A() { x = 1; }", "}"])); | |
| 1328 resolve(source, []); | |
| 1329 assertErrors([CompileTimeErrorCode.FINAL_INITIALIZED_IN_DECLARATION_AND_CONS
TRUCTOR]); | |
| 1330 verify([source]); | |
| 1331 } | |
| 1332 void fail_finalInitializedInDeclarationAndConstructor_initializingFormal() { | |
| 1333 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " final x = 0;", " A(this.x) {}", "}"])); | |
| 1334 resolve(source, []); | |
| 1335 assertErrors([CompileTimeErrorCode.FINAL_INITIALIZED_IN_DECLARATION_AND_CONS
TRUCTOR]); | |
| 1336 verify([source]); | |
| 1337 } | |
| 1338 void fail_finalInitializedMultipleTimes() { | |
| 1339 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " final x;", " A(this.x) { x = 0; }", "}"])); | |
| 1340 resolve(source, []); | |
| 1341 assertErrors([CompileTimeErrorCode.FINAL_INITIALIZED_MULTIPLE_TIMES]); | |
| 1342 verify([source]); | |
| 1343 } | |
| 1344 void fail_finalNotInitialized_library() { | |
| 1345 Source source = addSource("/test.dart", EngineTestCase.createSource(["final
F;"])); | |
| 1346 resolve(source, []); | 1843 resolve(source, []); |
| 1347 assertErrors([CompileTimeErrorCode.FINAL_NOT_INITIALIZED]); | 1844 assertErrors([CompileTimeErrorCode.FINAL_NOT_INITIALIZED]); |
| 1348 verify([source]); | 1845 verify([source]); |
| 1349 } | |
| 1350 void fail_finalNotInitialized_local() { | |
| 1351 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " final int x;", "}"])); | |
| 1352 resolve(source, []); | |
| 1353 assertErrors([CompileTimeErrorCode.FINAL_NOT_INITIALIZED]); | |
| 1354 verify([source]); | |
| 1355 } | |
| 1356 void fail_finalNotInitialized_static() { | |
| 1357 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " static final F;", "}"])); | |
| 1358 resolve(source, []); | |
| 1359 assertErrors([CompileTimeErrorCode.FINAL_NOT_INITIALIZED]); | |
| 1360 verify([source]); | |
| 1361 } | 1846 } |
| 1362 void fail_getterAndMethodWithSameName() { | 1847 void fail_getterAndMethodWithSameName() { |
| 1363 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " get x -> 0;", " x(y) {}", "}"])); | 1848 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " get x -> 0;", " x(y) {}", "}"])); |
| 1364 resolve(source, []); | 1849 resolve(source, []); |
| 1365 assertErrors([CompileTimeErrorCode.GETTER_AND_METHOD_WITH_SAME_NAME]); | 1850 assertErrors([CompileTimeErrorCode.GETTER_AND_METHOD_WITH_SAME_NAME]); |
| 1366 verify([source]); | 1851 verify([source]); |
| 1367 } | 1852 } |
| 1368 void fail_implementsDynamic() { | |
| 1369 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A implements dynamic {}"])); | |
| 1370 resolve(source, []); | |
| 1371 assertErrors([CompileTimeErrorCode.IMPLEMENTS_DYNAMIC]); | |
| 1372 verify([source]); | |
| 1373 } | |
| 1374 void fail_implementsRepeated() { | |
| 1375 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "class B implements A, A {}"])); | |
| 1376 resolve(source, []); | |
| 1377 assertErrors([CompileTimeErrorCode.IMPLEMENTS_REPEATED]); | |
| 1378 verify([source]); | |
| 1379 } | |
| 1380 void fail_implementsSelf() { | |
| 1381 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A implements A {}"])); | |
| 1382 resolve(source, []); | |
| 1383 assertErrors([CompileTimeErrorCode.IMPLEMENTS_SELF]); | |
| 1384 verify([source]); | |
| 1385 } | |
| 1386 void fail_importDuplicatedLibraryName() { | 1853 void fail_importDuplicatedLibraryName() { |
| 1387 Source source = addSource("/test.dart", EngineTestCase.createSource(["librar
y test;", "import 'lib1.dart';", "import 'lib2.dart';"])); | 1854 Source source = addSource("/test.dart", EngineTestCase.createSource(["librar
y test;", "import 'lib1.dart';", "import 'lib2.dart';"])); |
| 1388 addSource("/lib1.dart", EngineTestCase.createSource(["library lib;"])); | 1855 addSource("/lib1.dart", EngineTestCase.createSource(["library lib;"])); |
| 1389 addSource("/lib2.dart", EngineTestCase.createSource(["library lib;"])); | 1856 addSource("/lib2.dart", EngineTestCase.createSource(["library lib;"])); |
| 1390 resolve(source, []); | 1857 resolve(source, []); |
| 1391 assertErrors([CompileTimeErrorCode.IMPORT_DUPLICATED_LIBRARY_NAME]); | 1858 assertErrors([CompileTimeErrorCode.IMPORT_DUPLICATED_LIBRARY_NAME]); |
| 1392 verify([source]); | 1859 verify([source]); |
| 1393 } | 1860 } |
| 1394 void fail_importOfNonLibrary() { | |
| 1395 Source source = addSource("/test.dart", EngineTestCase.createSource(["librar
y lib;", "import 'part.dart';"])); | |
| 1396 addSource("/part.dart", EngineTestCase.createSource(["part of lib;"])); | |
| 1397 resolve(source, []); | |
| 1398 assertErrors([CompileTimeErrorCode.IMPORT_OF_NON_LIBRARY]); | |
| 1399 verify([source]); | |
| 1400 } | |
| 1401 void fail_inconsistentCaseExpressionTypes() { | 1861 void fail_inconsistentCaseExpressionTypes() { |
| 1402 Source source = addSource("/test.dart", EngineTestCase.createSource(["f(var
p) {", " switch (p) {", " case 3:", " break;", " case 'a':", "
break;", " }", "}"])); | 1862 Source source = addSource("/test.dart", EngineTestCase.createSource(["f(var
p) {", " switch (p) {", " case 3:", " break;", " case 'a':", "
break;", " }", "}"])); |
| 1403 resolve(source, []); | 1863 resolve(source, []); |
| 1404 assertErrors([CompileTimeErrorCode.INCONSITENT_CASE_EXPRESSION_TYPES]); | 1864 assertErrors([CompileTimeErrorCode.INCONSITENT_CASE_EXPRESSION_TYPES]); |
| 1405 verify([source]); | 1865 verify([source]); |
| 1406 } | 1866 } |
| 1407 void fail_initializerForNonExistantField() { | 1867 void fail_initializerForNonExistant_initializer() { |
| 1408 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " A(this.x) {}", "}"])); | 1868 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " A() : x = 0 {}", "}"])); |
| 1409 resolve(source, []); | 1869 resolve(source, []); |
| 1410 assertErrors([CompileTimeErrorCode.INITIALIZER_FOR_NON_EXISTANT_FIELD]); | 1870 assertErrors([CompileTimeErrorCode.INITIALIZER_FOR_NON_EXISTANT_FIELD]); |
| 1411 verify([source]); | 1871 verify([source]); |
| 1412 } | 1872 } |
| 1873 void fail_initializerForStaticField() { |
| 1874 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " static x;", " A() : x = 0 {}", "}"])); |
| 1875 resolve(source, []); |
| 1876 assertErrors([CompileTimeErrorCode.INITIALIZER_FOR_STATIC_FIELD]); |
| 1877 verify([source]); |
| 1878 } |
| 1413 void fail_invalidConstructorName() { | 1879 void fail_invalidConstructorName() { |
| 1414 Source source = addSource("/test.dart", EngineTestCase.createSource([])); | 1880 Source source = addSource("/test.dart", EngineTestCase.createSource([])); |
| 1415 resolve(source, []); | 1881 resolve(source, []); |
| 1416 assertErrors([CompileTimeErrorCode.INVALID_CONSTRUCTOR_NAME]); | 1882 assertErrors([CompileTimeErrorCode.INVALID_CONSTRUCTOR_NAME]); |
| 1417 verify([source]); | 1883 verify([source]); |
| 1418 } | 1884 } |
| 1419 void fail_invalidFactoryNameNotAClass() { | 1885 void fail_invalidFactoryNameNotAClass() { |
| 1420 Source source = addSource("/test.dart", EngineTestCase.createSource([])); | 1886 Source source = addSource("/test.dart", EngineTestCase.createSource([])); |
| 1421 resolve(source, []); | 1887 resolve(source, []); |
| 1422 assertErrors([CompileTimeErrorCode.INVALID_FACTORY_NAME_NOT_A_CLASS]); | 1888 assertErrors([CompileTimeErrorCode.INVALID_FACTORY_NAME_NOT_A_CLASS]); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1475 resolve(source, []); | 1941 resolve(source, []); |
| 1476 assertErrors([CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_LIST]); | 1942 assertErrors([CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_LIST]); |
| 1477 verify([source]); | 1943 verify([source]); |
| 1478 } | 1944 } |
| 1479 void fail_invalidTypeArgumentInConstMap() { | 1945 void fail_invalidTypeArgumentInConstMap() { |
| 1480 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A<E> {", " m() {", " return const <String, E>{}", " }", "}"])); | 1946 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A<E> {", " m() {", " return const <String, E>{}", " }", "}"])); |
| 1481 resolve(source, []); | 1947 resolve(source, []); |
| 1482 assertErrors([CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_MAP]); | 1948 assertErrors([CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_MAP]); |
| 1483 verify([source]); | 1949 verify([source]); |
| 1484 } | 1950 } |
| 1485 void fail_invalidVariableInInitializer_nonField() { | |
| 1486 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " A(this.x) {}", "}"])); | |
| 1487 resolve(source, []); | |
| 1488 assertErrors([CompileTimeErrorCode.INVALID_VARIABLE_IN_INITIALIZER]); | |
| 1489 verify([source]); | |
| 1490 } | |
| 1491 void fail_invalidVariableInInitializer_static() { | |
| 1492 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " static x = 0;", " A(this.x) {}", "}"])); | |
| 1493 resolve(source, []); | |
| 1494 assertErrors([CompileTimeErrorCode.INVALID_VARIABLE_IN_INITIALIZER]); | |
| 1495 verify([source]); | |
| 1496 } | |
| 1497 void fail_memberWithClassName() { | 1951 void fail_memberWithClassName() { |
| 1498 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int A = 0;", "}"])); | 1952 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int A = 0;", "}"])); |
| 1499 resolve(source, []); | 1953 resolve(source, []); |
| 1500 assertErrors([CompileTimeErrorCode.MEMBER_WITH_CLASS_NAME]); | 1954 assertErrors([CompileTimeErrorCode.MEMBER_WITH_CLASS_NAME]); |
| 1501 verify([source]); | 1955 verify([source]); |
| 1502 } | 1956 } |
| 1503 void fail_mixinDeclaresConstructor() { | 1957 void fail_mixinDeclaresConstructor() { |
| 1504 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " A() {}", "}", "class B extends Object mixin A {}"])); | 1958 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " A() {}", "}", "class B extends Object mixin A {}"])); |
| 1505 resolve(source, []); | 1959 resolve(source, []); |
| 1506 assertErrors([CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR]); | 1960 assertErrors([CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR]); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1589 resolve(source, []); | 2043 resolve(source, []); |
| 1590 assertErrors([CompileTimeErrorCode.OVERRIDE_MISSING_NAMED_PARAMETERS]); | 2044 assertErrors([CompileTimeErrorCode.OVERRIDE_MISSING_NAMED_PARAMETERS]); |
| 1591 verify([source]); | 2045 verify([source]); |
| 1592 } | 2046 } |
| 1593 void fail_overrideMissingRequiredParameters() { | 2047 void fail_overrideMissingRequiredParameters() { |
| 1594 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " m(a) {}", "}", "class B extends A {", " m(a, b) {}", "}"])); | 2048 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " m(a) {}", "}", "class B extends A {", " m(a, b) {}", "}"])); |
| 1595 resolve(source, []); | 2049 resolve(source, []); |
| 1596 assertErrors([CompileTimeErrorCode.OVERRIDE_MISSING_REQUIRED_PARAMETERS]); | 2050 assertErrors([CompileTimeErrorCode.OVERRIDE_MISSING_REQUIRED_PARAMETERS]); |
| 1597 verify([source]); | 2051 verify([source]); |
| 1598 } | 2052 } |
| 1599 void fail_partOfNonPart() { | |
| 1600 Source source = addSource("/test.dart", EngineTestCase.createSource(["librar
y l1;", "part 'l2.dart';"])); | |
| 1601 addSource("/l2.dart", EngineTestCase.createSource(["library l2;"])); | |
| 1602 resolve(source, []); | |
| 1603 assertErrors([CompileTimeErrorCode.PART_OF_NON_PART]); | |
| 1604 verify([source]); | |
| 1605 } | |
| 1606 void fail_prefixCollidesWithTopLevelMembers() { | 2053 void fail_prefixCollidesWithTopLevelMembers() { |
| 1607 Source source = addSource("/test.dart", EngineTestCase.createSource(["import
'dart:uri' as uri;", "var uri = null;"])); | 2054 Source source = addSource("/test.dart", EngineTestCase.createSource(["import
'dart:uri' as uri;", "var uri = null;"])); |
| 1608 resolve(source, []); | 2055 resolve(source, []); |
| 1609 assertErrors([CompileTimeErrorCode.PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER]); | 2056 assertErrors([CompileTimeErrorCode.PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER]); |
| 1610 verify([source]); | 2057 verify([source]); |
| 1611 } | 2058 } |
| 1612 void fail_privateOptionalParameter() { | 2059 void fail_privateOptionalParameter() { |
| 1613 Source source = addSource("/test.dart", EngineTestCase.createSource(["f({_p
: 0}) {}"])); | 2060 Source source = addSource("/test.dart", EngineTestCase.createSource(["f({_p
: 0}) {}"])); |
| 1614 resolve(source, []); | 2061 resolve(source, []); |
| 1615 assertErrors([CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER]); | 2062 assertErrors([CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER]); |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1821 } | 2268 } |
| 1822 void test_argumentDefinitionTestNonParameter() { | 2269 void test_argumentDefinitionTestNonParameter() { |
| 1823 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " var v = 0;", " return ?v;", "}"])); | 2270 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " var v = 0;", " return ?v;", "}"])); |
| 1824 resolve(source, []); | 2271 resolve(source, []); |
| 1825 assertErrors([CompileTimeErrorCode.ARGUMENT_DEFINITION_TEST_NON_PARAMETER]); | 2272 assertErrors([CompileTimeErrorCode.ARGUMENT_DEFINITION_TEST_NON_PARAMETER]); |
| 1826 verify([source]); | 2273 verify([source]); |
| 1827 } | 2274 } |
| 1828 void test_builtInIdentifierAsType() { | 2275 void test_builtInIdentifierAsType() { |
| 1829 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " typedef x;", "}"])); | 2276 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " typedef x;", "}"])); |
| 1830 resolve(source, []); | 2277 resolve(source, []); |
| 1831 assertErrors([CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE]); | 2278 assertErrors([CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE, StaticWarnin
gCode.UNDEFINED_CLASS]); |
| 1832 verify([source]); | 2279 verify([source]); |
| 1833 } | 2280 } |
| 1834 void test_builtInIdentifierAsTypedefName_classTypeAlias() { | 2281 void test_builtInIdentifierAsTypedefName_classTypeAlias() { |
| 1835 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "class B {}", "typedef as = A with B;"])); | 2282 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "class B {}", "typedef as = A with B;"])); |
| 1836 resolve(source, []); | 2283 resolve(source, []); |
| 1837 assertErrors([CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME]); | 2284 assertErrors([CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME]); |
| 1838 verify([source]); | 2285 verify([source]); |
| 1839 } | 2286 } |
| 1840 void test_builtInIdentifierAsTypedefName_functionTypeAlias() { | 2287 void test_builtInIdentifierAsTypedefName_functionTypeAlias() { |
| 1841 Source source = addSource("/test.dart", EngineTestCase.createSource(["typede
f bool as();"])); | 2288 Source source = addSource("/test.dart", EngineTestCase.createSource(["typede
f bool as();"])); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1854 resolve(source, []); | 2301 resolve(source, []); |
| 1855 assertErrors([CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_VARIABLE_NAME
]); | 2302 assertErrors([CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_VARIABLE_NAME
]); |
| 1856 verify([source]); | 2303 verify([source]); |
| 1857 } | 2304 } |
| 1858 void test_caseExpressionTypeImplementsEquals() { | 2305 void test_caseExpressionTypeImplementsEquals() { |
| 1859 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
IntWrapper {", " final int value;", " const IntWrapper(this.value);", " bool
operator ==(IntWrapper x) {", " return value == x.value;", " }", "}", "", "f
(IntWrapper a) {", " switch(a) {", " case(const IntWrapper(1)) : return 1;",
" default: return 0;", " }", "}"])); | 2306 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
IntWrapper {", " final int value;", " const IntWrapper(this.value);", " bool
operator ==(IntWrapper x) {", " return value == x.value;", " }", "}", "", "f
(IntWrapper a) {", " switch(a) {", " case(const IntWrapper(1)) : return 1;",
" default: return 0;", " }", "}"])); |
| 1860 resolve(source, []); | 2307 resolve(source, []); |
| 1861 assertErrors([CompileTimeErrorCode.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS]); | 2308 assertErrors([CompileTimeErrorCode.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS]); |
| 1862 verify([source]); | 2309 verify([source]); |
| 1863 } | 2310 } |
| 1864 void test_compileTimeConstantRaisesExceptionDivideByZero() { | |
| 1865 Source source = addSource("/test.dart", EngineTestCase.createSource(["const
int INF = 0 / 0;"])); | |
| 1866 resolve(source, []); | |
| 1867 assertErrors([CompileTimeErrorCode.COMPILE_TIME_CONSTANT_RAISES_EXCEPTION_DI
VIDE_BY_ZERO]); | |
| 1868 verify([source]); | |
| 1869 } | |
| 1870 void test_conflictingConstructorNameAndMember_field() { | 2311 void test_conflictingConstructorNameAndMember_field() { |
| 1871 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int x;", " A.x() {}", "}"])); | 2312 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int x;", " A.x() {}", "}"])); |
| 1872 resolve(source, []); | 2313 resolve(source, []); |
| 1873 assertErrors([CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD]); | 2314 assertErrors([CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD]); |
| 1874 verify([source]); | 2315 verify([source]); |
| 1875 } | 2316 } |
| 1876 void test_conflictingConstructorNameAndMember_method() { | 2317 void test_conflictingConstructorNameAndMember_method() { |
| 1877 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " const A.x() {}", " void x() {}", "}"])); | 2318 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " const A.x() {}", " void x() {}", "}"])); |
| 1878 resolve(source, []); | 2319 resolve(source, []); |
| 1879 assertErrors([CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD])
; | 2320 assertErrors([CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD])
; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1928 verify([source]); | 2369 verify([source]); |
| 1929 } | 2370 } |
| 1930 void test_duplicateMemberError() { | 2371 void test_duplicateMemberError() { |
| 1931 Source librarySource = addSource("/lib.dart", EngineTestCase.createSource(["
library lib;", "", "part 'a.dart';", "part 'b.dart';"])); | 2372 Source librarySource = addSource("/lib.dart", EngineTestCase.createSource(["
library lib;", "", "part 'a.dart';", "part 'b.dart';"])); |
| 1932 Source sourceA = addSource("/a.dart", EngineTestCase.createSource(["part of
lib;", "", "class A {}"])); | 2373 Source sourceA = addSource("/a.dart", EngineTestCase.createSource(["part of
lib;", "", "class A {}"])); |
| 1933 Source sourceB = addSource("/b.dart", EngineTestCase.createSource(["part of
lib;", "", "class A {}"])); | 2374 Source sourceB = addSource("/b.dart", EngineTestCase.createSource(["part of
lib;", "", "class A {}"])); |
| 1934 resolve(librarySource, [sourceA, sourceB]); | 2375 resolve(librarySource, [sourceA, sourceB]); |
| 1935 assertErrors([CompileTimeErrorCode.DUPLICATE_DEFINITION]); | 2376 assertErrors([CompileTimeErrorCode.DUPLICATE_DEFINITION]); |
| 1936 verify([librarySource, sourceA, sourceB]); | 2377 verify([librarySource, sourceA, sourceB]); |
| 1937 } | 2378 } |
| 1938 void test_extendsNonClass() { | 2379 void test_exportOfNonLibrary() { |
| 2380 Source source = addSource("/test.dart", EngineTestCase.createSource(["librar
y L;", "export 'lib1.dart';"])); |
| 2381 addSource("/lib1.dart", EngineTestCase.createSource(["part of lib;"])); |
| 2382 resolve(source, []); |
| 2383 assertErrors([CompileTimeErrorCode.EXPORT_OF_NON_LIBRARY]); |
| 2384 verify([source]); |
| 2385 } |
| 2386 void test_extendsNonClass_class() { |
| 1939 Source source = addSource("/test.dart", EngineTestCase.createSource(["int A;
", "class B extends A {}"])); | 2387 Source source = addSource("/test.dart", EngineTestCase.createSource(["int A;
", "class B extends A {}"])); |
| 1940 resolve(source, []); | 2388 resolve(source, []); |
| 1941 assertErrors([CompileTimeErrorCode.EXTENDS_NON_CLASS]); | 2389 assertErrors([CompileTimeErrorCode.EXTENDS_NON_CLASS]); |
| 1942 verify([source]); | 2390 verify([source]); |
| 1943 } | 2391 } |
| 1944 void test_extendsOrImplementsDisallowedClass_extends_bool() { | 2392 void test_extendsOrImplementsDisallowedClass_extends_bool() { |
| 1945 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A extends bool {}"])); | 2393 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A extends bool {}"])); |
| 1946 resolve(source, []); | 2394 resolve(source, []); |
| 1947 assertErrors([CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]); | 2395 assertErrors([CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]); |
| 1948 verify([source]); | 2396 verify([source]); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1994 resolve(source, []); | 2442 resolve(source, []); |
| 1995 assertErrors([CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]); | 2443 assertErrors([CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]); |
| 1996 verify([source]); | 2444 verify([source]); |
| 1997 } | 2445 } |
| 1998 void test_extendsOrImplementsDisallowedClass_implements_String() { | 2446 void test_extendsOrImplementsDisallowedClass_implements_String() { |
| 1999 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A implements String {}"])); | 2447 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A implements String {}"])); |
| 2000 resolve(source, []); | 2448 resolve(source, []); |
| 2001 assertErrors([CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]); | 2449 assertErrors([CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]); |
| 2002 verify([source]); | 2450 verify([source]); |
| 2003 } | 2451 } |
| 2452 void test_fieldInitializedByMultipleInitializers() { |
| 2453 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int x;", " A() : x = 0, x = 1 {}", "}"])); |
| 2454 resolve(source, []); |
| 2455 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZER
S]); |
| 2456 verify([source]); |
| 2457 } |
| 2458 void test_fieldInitializedByMultipleInitializers_multipleInits() { |
| 2459 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int x;", " A() : x = 0, x = 1, x = 2 {}", "}"])); |
| 2460 resolve(source, []); |
| 2461 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZER
S, CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS]); |
| 2462 verify([source]); |
| 2463 } |
| 2464 void test_fieldInitializedByMultipleInitializers_multipleNames() { |
| 2465 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int x;", " int y;", " A() : x = 0, x = 1, y = 0, y = 1 {}", "}"])); |
| 2466 resolve(source, []); |
| 2467 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZER
S, CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS]); |
| 2468 verify([source]); |
| 2469 } |
| 2004 void test_fieldInitializedInInitializerAndDeclaration_const() { | 2470 void test_fieldInitializedInInitializerAndDeclaration_const() { |
| 2005 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " const int x = 0;", " A() : x = 1 {}", "}"])); | 2471 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " const int x = 0;", " A() : x = 1 {}", "}"])); |
| 2006 resolve(source, []); | 2472 resolve(source, []); |
| 2007 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZED_IN_INITIALIZER_AND_DECL
ARATION]); | 2473 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZED_IN_INITIALIZER_AND_DECL
ARATION]); |
| 2008 verify([source]); | 2474 verify([source]); |
| 2009 } | 2475 } |
| 2010 void test_fieldInitializedInInitializerAndDeclaration_final() { | 2476 void test_fieldInitializedInInitializerAndDeclaration_final() { |
| 2011 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " final int x = 0;", " A() : x = 1 {}", "}"])); | 2477 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " final int x = 0;", " A() : x = 1 {}", "}"])); |
| 2012 resolve(source, []); | 2478 resolve(source, []); |
| 2013 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZED_IN_INITIALIZER_AND_DECL
ARATION]); | 2479 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZED_IN_INITIALIZER_AND_DECL
ARATION]); |
| 2014 verify([source]); | 2480 verify([source]); |
| 2015 } | 2481 } |
| 2016 void test_fieldInitializeInParameterAndInitializer() { | 2482 void test_fieldInitializedInParameterAndInitializer() { |
| 2017 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int x;", " A(this.x) : x = 1 {}", "}"])); | 2483 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int x;", " A(this.x) : x = 1 {}", "}"])); |
| 2018 resolve(source, []); | 2484 resolve(source, []); |
| 2019 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZED_IN_PARAMETER_AND_INITIA
LIZER]); | 2485 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZED_IN_PARAMETER_AND_INITIA
LIZER]); |
| 2020 verify([source]); | 2486 verify([source]); |
| 2021 } | 2487 } |
| 2022 void test_fieldInitializerOutsideConstructor() { | 2488 void test_fieldInitializerOutsideConstructor() { |
| 2023 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int x;", " m(this.x) {}", "}"])); | 2489 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int x;", " m(this.x) {}", "}"])); |
| 2024 resolve(source, []); | 2490 resolve(source, []); |
| 2025 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR]); | 2491 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR]); |
| 2026 verify([source]); | 2492 verify([source]); |
| 2027 } | 2493 } |
| 2028 void test_fieldInitializerOutsideConstructor_defaultParameters() { | 2494 void test_fieldInitializerOutsideConstructor_defaultParameter() { |
| 2029 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int x;", " m([this.x]) {}", "}"])); | 2495 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int x;", " m([this.x]) {}", "}"])); |
| 2030 resolve(source, []); | 2496 resolve(source, []); |
| 2031 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR]); | 2497 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR]); |
| 2032 verify([source]); | 2498 verify([source]); |
| 2033 } | 2499 } |
| 2034 void test_implementsNonClass() { | 2500 /** |
| 2501 * This test doesn't test the FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR
code, but tests the |
| 2502 * FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION code instead. It is provid
ed here to show |
| 2503 * coverage over all of the permutations of initializers in constructor declar
ations. |
| 2504 * <p> |
| 2505 * Note: FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION covers a subset of |
| 2506 * FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR, since it more specific, w
e use it instead of |
| 2507 * the broader code |
| 2508 */ |
| 2509 void test_finalInitializedInDeclarationAndConstructor_initializers() { |
| 2510 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " final x = 0;", " A() : x = 0 {}", "}"])); |
| 2511 resolve(source, []); |
| 2512 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZED_IN_INITIALIZER_AND_DECL
ARATION]); |
| 2513 verify([source]); |
| 2514 } |
| 2515 void test_finalInitializedInDeclarationAndConstructor_initializingFormal() { |
| 2516 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " final x = 0;", " A(this.x) {}", "}"])); |
| 2517 resolve(source, []); |
| 2518 assertErrors([CompileTimeErrorCode.FINAL_INITIALIZED_IN_DECLARATION_AND_CONS
TRUCTOR]); |
| 2519 verify([source]); |
| 2520 } |
| 2521 void test_finalInitializedMultipleTimes_initializers() { |
| 2522 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " final x;", " A() : x = 0, x = 0 {}", "}"])); |
| 2523 resolve(source, []); |
| 2524 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZER
S]); |
| 2525 verify([source]); |
| 2526 } |
| 2527 /** |
| 2528 * This test doesn't test the FINAL_INITIALIZED_MULTIPLE_TIMES code, but tests
the |
| 2529 * FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER code instead. It is provided
here to show |
| 2530 * coverage over all of the permutations of initializers in constructor declar
ations. |
| 2531 * <p> |
| 2532 * Note: FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER covers a subset of |
| 2533 * FINAL_INITIALIZED_MULTIPLE_TIMES, since it more specific, we use it instead
of the broader code |
| 2534 */ |
| 2535 void test_finalInitializedMultipleTimes_initializingFormal_initializer() { |
| 2536 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " final x;", " A(this.x) : x = 0 {}", "}"])); |
| 2537 resolve(source, []); |
| 2538 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZED_IN_PARAMETER_AND_INITIA
LIZER]); |
| 2539 verify([source]); |
| 2540 } |
| 2541 void test_finalInitializedMultipleTimes_initializingFormals() { |
| 2542 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " final x;", " A(this.x, this.x) {}", "}"])); |
| 2543 resolve(source, []); |
| 2544 assertErrors([CompileTimeErrorCode.FINAL_INITIALIZED_MULTIPLE_TIMES]); |
| 2545 verify([source]); |
| 2546 } |
| 2547 void test_finalNotInitialized_instanceField_const() { |
| 2548 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " const F;", "}"])); |
| 2549 resolve(source, []); |
| 2550 assertErrors([CompileTimeErrorCode.FINAL_NOT_INITIALIZED]); |
| 2551 verify([source]); |
| 2552 } |
| 2553 void test_finalNotInitialized_instanceField_const_static() { |
| 2554 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " static const F;", "}"])); |
| 2555 resolve(source, []); |
| 2556 assertErrors([CompileTimeErrorCode.FINAL_NOT_INITIALIZED]); |
| 2557 verify([source]); |
| 2558 } |
| 2559 void test_finalNotInitialized_instanceField_final() { |
| 2560 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " final F;", "}"])); |
| 2561 resolve(source, []); |
| 2562 assertErrors([CompileTimeErrorCode.FINAL_NOT_INITIALIZED]); |
| 2563 verify([source]); |
| 2564 } |
| 2565 void test_finalNotInitialized_instanceField_final_static() { |
| 2566 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " static final F;", "}"])); |
| 2567 resolve(source, []); |
| 2568 assertErrors([CompileTimeErrorCode.FINAL_NOT_INITIALIZED]); |
| 2569 verify([source]); |
| 2570 } |
| 2571 void test_finalNotInitialized_library_const() { |
| 2572 Source source = addSource("/test.dart", EngineTestCase.createSource(["const
F;"])); |
| 2573 resolve(source, []); |
| 2574 assertErrors([CompileTimeErrorCode.FINAL_NOT_INITIALIZED]); |
| 2575 verify([source]); |
| 2576 } |
| 2577 void test_finalNotInitialized_library_final() { |
| 2578 Source source = addSource("/test.dart", EngineTestCase.createSource(["final
F;"])); |
| 2579 resolve(source, []); |
| 2580 assertErrors([CompileTimeErrorCode.FINAL_NOT_INITIALIZED]); |
| 2581 verify([source]); |
| 2582 } |
| 2583 void test_finalNotInitialized_local_const() { |
| 2584 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " const int x;", "}"])); |
| 2585 resolve(source, []); |
| 2586 assertErrors([CompileTimeErrorCode.FINAL_NOT_INITIALIZED]); |
| 2587 verify([source]); |
| 2588 } |
| 2589 void test_finalNotInitialized_local_final() { |
| 2590 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " final int x;", "}"])); |
| 2591 resolve(source, []); |
| 2592 assertErrors([CompileTimeErrorCode.FINAL_NOT_INITIALIZED]); |
| 2593 verify([source]); |
| 2594 } |
| 2595 void test_implementsDynamic() { |
| 2596 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A implements dynamic {}"])); |
| 2597 resolve(source, []); |
| 2598 assertErrors([CompileTimeErrorCode.IMPLEMENTS_DYNAMIC]); |
| 2599 verify([source]); |
| 2600 } |
| 2601 void test_implementsNonClass_class() { |
| 2035 Source source = addSource("/test.dart", EngineTestCase.createSource(["int A;
", "class B implements A {}"])); | 2602 Source source = addSource("/test.dart", EngineTestCase.createSource(["int A;
", "class B implements A {}"])); |
| 2036 resolve(source, []); | 2603 resolve(source, []); |
| 2037 assertErrors([CompileTimeErrorCode.IMPLEMENTS_NON_CLASS]); | 2604 assertErrors([CompileTimeErrorCode.IMPLEMENTS_NON_CLASS]); |
| 2038 verify([source]); | 2605 verify([source]); |
| 2039 } | 2606 } |
| 2607 void test_implementsNonClass_typedef() { |
| 2608 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "int B;", "typedef C = A implements B;"])); |
| 2609 resolve(source, []); |
| 2610 assertErrors([CompileTimeErrorCode.IMPLEMENTS_NON_CLASS]); |
| 2611 verify([source]); |
| 2612 } |
| 2613 void test_implementsRepeated() { |
| 2614 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "class B implements A, A {}"])); |
| 2615 resolve(source, []); |
| 2616 assertErrors([CompileTimeErrorCode.IMPLEMENTS_REPEATED]); |
| 2617 verify([source]); |
| 2618 } |
| 2619 void test_implementsRepeated_3times() { |
| 2620 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {} class C{}", "class B implements A, A, A, A {}"])); |
| 2621 resolve(source, []); |
| 2622 assertErrors([CompileTimeErrorCode.IMPLEMENTS_REPEATED, CompileTimeErrorCode
.IMPLEMENTS_REPEATED, CompileTimeErrorCode.IMPLEMENTS_REPEATED]); |
| 2623 verify([source]); |
| 2624 } |
| 2625 void test_implementsSelf() { |
| 2626 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A implements A {}"])); |
| 2627 resolve(source, []); |
| 2628 assertErrors([CompileTimeErrorCode.IMPLEMENTS_SELF]); |
| 2629 verify([source]); |
| 2630 } |
| 2631 void test_importOfNonLibrary() { |
| 2632 Source source = addSource("/test.dart", EngineTestCase.createSource(["librar
y lib;", "import 'part.dart';"])); |
| 2633 addSource("/part.dart", EngineTestCase.createSource(["part of lib;"])); |
| 2634 resolve(source, []); |
| 2635 assertErrors([CompileTimeErrorCode.IMPORT_OF_NON_LIBRARY]); |
| 2636 verify([source]); |
| 2637 } |
| 2638 void test_initializingFormalForNonExistantField() { |
| 2639 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " A(this.x) {}", "}"])); |
| 2640 resolve(source, []); |
| 2641 assertErrors([CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTANT_FIEL
D]); |
| 2642 verify([source]); |
| 2643 } |
| 2644 void test_initializingFormalForNonExistantField_notInEnclosingClass() { |
| 2645 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", "int x;", "}", "class B extends A {", " B(this.x) {}", "}"])); |
| 2646 resolve(source, []); |
| 2647 assertErrors([CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTANT_FIEL
D]); |
| 2648 verify([source]); |
| 2649 } |
| 2650 void test_initializingFormalForNonExistantField_optional() { |
| 2651 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " A([this.x]) {}", "}"])); |
| 2652 resolve(source, []); |
| 2653 assertErrors([CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTANT_FIEL
D]); |
| 2654 verify([source]); |
| 2655 } |
| 2656 void test_initializingFormalForNonExistantField_static() { |
| 2657 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " static x;", " A([this.x]) {}", "}"])); |
| 2658 resolve(source, []); |
| 2659 assertErrors([CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_STATIC_FIELD]); |
| 2660 verify([source]); |
| 2661 } |
| 2662 void test_invalidUri_export() { |
| 2663 Source source = addSource("/test.dart", EngineTestCase.createSource(["librar
y L;", "export 'unknown.dart';"])); |
| 2664 resolve(source, []); |
| 2665 assertErrors([CompileTimeErrorCode.INVALID_URI]); |
| 2666 } |
| 2667 void test_invalidUri_import() { |
| 2668 Source source = addSource("/test.dart", EngineTestCase.createSource(["librar
y L;", "import 'unknown.dart';"])); |
| 2669 resolve(source, []); |
| 2670 assertErrors([CompileTimeErrorCode.INVALID_URI]); |
| 2671 } |
| 2672 void test_invalidUri_part() { |
| 2673 Source source = addSource("/test.dart", EngineTestCase.createSource(["librar
y L;", "part 'unknown.dart';"])); |
| 2674 resolve(source, []); |
| 2675 assertErrors([CompileTimeErrorCode.INVALID_URI]); |
| 2676 } |
| 2040 void test_labelInOuterScope() { | 2677 void test_labelInOuterScope() { |
| 2041 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
int {}", "", "class A {", " void m(int i) {", " l: while (i > 0) {", "
void f() {", " break l;", " };", " }", " }", "}"])); | 2678 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
int {}", "", "class A {", " void m(int i) {", " l: while (i > 0) {", "
void f() {", " break l;", " };", " }", " }", "}"])); |
| 2042 resolve(source, []); | 2679 resolve(source, []); |
| 2043 assertErrors([CompileTimeErrorCode.LABEL_IN_OUTER_SCOPE, ResolverErrorCode.C
ANNOT_BE_RESOLVED]); | 2680 assertErrors([CompileTimeErrorCode.LABEL_IN_OUTER_SCOPE, StaticWarningCode.U
NDEFINED_OPERATOR]); |
| 2044 } | 2681 } |
| 2045 void test_labelUndefined_break() { | 2682 void test_labelUndefined_break() { |
| 2046 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " x: while (true) {", " break y;", " }", "}"])); | 2683 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " x: while (true) {", " break y;", " }", "}"])); |
| 2047 resolve(source, []); | 2684 resolve(source, []); |
| 2048 assertErrors([CompileTimeErrorCode.LABEL_UNDEFINED]); | 2685 assertErrors([CompileTimeErrorCode.LABEL_UNDEFINED]); |
| 2049 } | 2686 } |
| 2050 void test_labelUndefined_continue() { | 2687 void test_labelUndefined_continue() { |
| 2051 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " x: while (true) {", " continue y;", " }", "}"])); | 2688 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " x: while (true) {", " continue y;", " }", "}"])); |
| 2052 resolve(source, []); | 2689 resolve(source, []); |
| 2053 assertErrors([CompileTimeErrorCode.LABEL_UNDEFINED]); | 2690 assertErrors([CompileTimeErrorCode.LABEL_UNDEFINED]); |
| 2054 } | 2691 } |
| 2692 void test_mixinOfNonClass_class() { |
| 2693 Source source = addSource("/test.dart", EngineTestCase.createSource(["int A;
", "class B with A {}"])); |
| 2694 resolve(source, []); |
| 2695 assertErrors([CompileTimeErrorCode.MIXIN_OF_NON_CLASS]); |
| 2696 verify([source]); |
| 2697 } |
| 2698 void test_mixinOfNonClass_typedef() { |
| 2699 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "int B;", "typedef C = A with B;"])); |
| 2700 resolve(source, []); |
| 2701 assertErrors([CompileTimeErrorCode.MIXIN_OF_NON_CLASS]); |
| 2702 verify([source]); |
| 2703 } |
| 2704 void test_nativeFunctionBodyInNonSDKCode_function() { |
| 2705 Source source = addSource("/test.dart", EngineTestCase.createSource(["int m(
a) native 'string';"])); |
| 2706 resolve(source, []); |
| 2707 assertErrors([ParserErrorCode.NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE]); |
| 2708 verify([source]); |
| 2709 } |
| 2710 void test_nativeFunctionBodyInNonSDKCode_method() { |
| 2711 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A{", " static int m(a) native 'string';", "}"])); |
| 2712 resolve(source, []); |
| 2713 assertErrors([ParserErrorCode.NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE]); |
| 2714 verify([source]); |
| 2715 } |
| 2055 void test_newWithInvalidTypeParameters() { | 2716 void test_newWithInvalidTypeParameters() { |
| 2056 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "f() { return new A<A>(); }"])); | 2717 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "f() { return new A<A>(); }"])); |
| 2057 resolve(source, []); | 2718 resolve(source, []); |
| 2058 assertErrors([CompileTimeErrorCode.NEW_WITH_INVALID_TYPE_PARAMETERS]); | 2719 assertErrors([CompileTimeErrorCode.NEW_WITH_INVALID_TYPE_PARAMETERS]); |
| 2059 verify([source]); | 2720 verify([source]); |
| 2060 } | 2721 } |
| 2061 void test_nonConstCaseExpression() { | 2722 void test_nonConstCaseExpression() { |
| 2062 Source source = addSource("/test.dart", EngineTestCase.createSource(["f(int
p, int q) {", " switch (p) {", " case 3 + q:", " break;", " }", "}"]))
; | 2723 Source source = addSource("/test.dart", EngineTestCase.createSource(["f(int
p, int q) {", " switch (p) {", " case 3 + q:", " break;", " }", "}"]))
; |
| 2063 resolve(source, []); | 2724 resolve(source, []); |
| 2064 assertErrors([CompileTimeErrorCode.NON_CONSTANT_CASE_EXPRESSION]); | 2725 assertErrors([CompileTimeErrorCode.NON_CONSTANT_CASE_EXPRESSION]); |
| 2065 verify([source]); | 2726 verify([source]); |
| 2066 } | 2727 } |
| 2067 void test_nonConstListElement() { | 2728 void test_nonConstListElement() { |
| 2068 Source source = addSource("/test.dart", EngineTestCase.createSource(["f(a) {
", " return const [a];", "}"])); | 2729 Source source = addSource("/test.dart", EngineTestCase.createSource(["f(a) {
", " return const [a];", "}"])); |
| 2069 resolve(source, []); | 2730 resolve(source, []); |
| 2070 assertErrors([CompileTimeErrorCode.NON_CONSTANT_LIST_ELEMENT]); | 2731 assertErrors([CompileTimeErrorCode.NON_CONSTANT_LIST_ELEMENT]); |
| 2071 verify([source]); | 2732 verify([source]); |
| 2072 } | 2733 } |
| 2073 void test_nonConstMapValue() { | 2734 void test_nonConstMapValue() { |
| 2074 Source source = addSource("/test.dart", EngineTestCase.createSource(["f(a) {
", " return const {'a' : a};", "}"])); | 2735 Source source = addSource("/test.dart", EngineTestCase.createSource(["f(a) {
", " return const {'a' : a};", "}"])); |
| 2075 resolve(source, []); | 2736 resolve(source, []); |
| 2076 assertErrors([CompileTimeErrorCode.NON_CONSTANT_MAP_VALUE]); | 2737 assertErrors([CompileTimeErrorCode.NON_CONSTANT_MAP_VALUE]); |
| 2077 verify([source]); | 2738 verify([source]); |
| 2078 } | 2739 } |
| 2740 void test_partOfNonPart() { |
| 2741 Source source = addSource("/test.dart", EngineTestCase.createSource(["librar
y l1;", "part 'l2.dart';"])); |
| 2742 addSource("/l2.dart", EngineTestCase.createSource(["library l2;"])); |
| 2743 resolve(source, []); |
| 2744 assertErrors([CompileTimeErrorCode.PART_OF_NON_PART]); |
| 2745 verify([source]); |
| 2746 } |
| 2079 void test_rethrowOutsideCatch() { | 2747 void test_rethrowOutsideCatch() { |
| 2080 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " rethrow;", "}"])); | 2748 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " rethrow;", "}"])); |
| 2081 resolve(source, []); | 2749 resolve(source, []); |
| 2082 assertErrors([CompileTimeErrorCode.RETHROW_OUTSIDE_CATCH]); | 2750 assertErrors([CompileTimeErrorCode.RETHROW_OUTSIDE_CATCH]); |
| 2083 verify([source]); | 2751 verify([source]); |
| 2084 } | 2752 } |
| 2085 void test_uriWithInterpolation_constant() { | 2753 void test_uriWithInterpolation_constant() { |
| 2086 Source source = addSource("/test.dart", EngineTestCase.createSource(["import
'stuff_\$platform.dart';"])); | 2754 Source source = addSource("/test.dart", EngineTestCase.createSource(["import
'stuff_\$platform.dart';"])); |
| 2087 resolve(source, []); | 2755 resolve(source, []); |
| 2088 assertErrors([CompileTimeErrorCode.URI_WITH_INTERPOLATION]); | 2756 assertErrors([CompileTimeErrorCode.URI_WITH_INTERPOLATION, StaticWarningCode
.UNDEFINED_IDENTIFIER]); |
| 2089 } | 2757 } |
| 2090 void test_uriWithInterpolation_nonConstant() { | 2758 void test_uriWithInterpolation_nonConstant() { |
| 2091 Source source = addSource("/test.dart", EngineTestCase.createSource(["librar
y lib;", "part '\${'a'}.dart';"])); | 2759 Source source = addSource("/test.dart", EngineTestCase.createSource(["librar
y lib;", "part '\${'a'}.dart';"])); |
| 2092 resolve(source, []); | 2760 resolve(source, []); |
| 2093 assertErrors([CompileTimeErrorCode.URI_WITH_INTERPOLATION]); | 2761 assertErrors([CompileTimeErrorCode.URI_WITH_INTERPOLATION]); |
| 2094 } | 2762 } |
| 2095 static dartSuite() { | 2763 static dartSuite() { |
| 2096 _ut.group('CompileTimeErrorCodeTest', () { | 2764 _ut.group('CompileTimeErrorCodeTest', () { |
| 2097 _ut.test('test_argumentDefinitionTestNonParameter', () { | 2765 _ut.test('test_argumentDefinitionTestNonParameter', () { |
| 2098 final __test = new CompileTimeErrorCodeTest(); | 2766 final __test = new CompileTimeErrorCodeTest(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 2115 runJUnitTest(__test, __test.test_builtInIdentifierAsTypedefName_classTyp
eAlias); | 2783 runJUnitTest(__test, __test.test_builtInIdentifierAsTypedefName_classTyp
eAlias); |
| 2116 }); | 2784 }); |
| 2117 _ut.test('test_builtInIdentifierAsTypedefName_functionTypeAlias', () { | 2785 _ut.test('test_builtInIdentifierAsTypedefName_functionTypeAlias', () { |
| 2118 final __test = new CompileTimeErrorCodeTest(); | 2786 final __test = new CompileTimeErrorCodeTest(); |
| 2119 runJUnitTest(__test, __test.test_builtInIdentifierAsTypedefName_function
TypeAlias); | 2787 runJUnitTest(__test, __test.test_builtInIdentifierAsTypedefName_function
TypeAlias); |
| 2120 }); | 2788 }); |
| 2121 _ut.test('test_caseExpressionTypeImplementsEquals', () { | 2789 _ut.test('test_caseExpressionTypeImplementsEquals', () { |
| 2122 final __test = new CompileTimeErrorCodeTest(); | 2790 final __test = new CompileTimeErrorCodeTest(); |
| 2123 runJUnitTest(__test, __test.test_caseExpressionTypeImplementsEquals); | 2791 runJUnitTest(__test, __test.test_caseExpressionTypeImplementsEquals); |
| 2124 }); | 2792 }); |
| 2125 _ut.test('test_compileTimeConstantRaisesExceptionDivideByZero', () { | |
| 2126 final __test = new CompileTimeErrorCodeTest(); | |
| 2127 runJUnitTest(__test, __test.test_compileTimeConstantRaisesExceptionDivid
eByZero); | |
| 2128 }); | |
| 2129 _ut.test('test_conflictingConstructorNameAndMember_field', () { | 2793 _ut.test('test_conflictingConstructorNameAndMember_field', () { |
| 2130 final __test = new CompileTimeErrorCodeTest(); | 2794 final __test = new CompileTimeErrorCodeTest(); |
| 2131 runJUnitTest(__test, __test.test_conflictingConstructorNameAndMember_fie
ld); | 2795 runJUnitTest(__test, __test.test_conflictingConstructorNameAndMember_fie
ld); |
| 2132 }); | 2796 }); |
| 2133 _ut.test('test_conflictingConstructorNameAndMember_method', () { | 2797 _ut.test('test_conflictingConstructorNameAndMember_method', () { |
| 2134 final __test = new CompileTimeErrorCodeTest(); | 2798 final __test = new CompileTimeErrorCodeTest(); |
| 2135 runJUnitTest(__test, __test.test_conflictingConstructorNameAndMember_met
hod); | 2799 runJUnitTest(__test, __test.test_conflictingConstructorNameAndMember_met
hod); |
| 2136 }); | 2800 }); |
| 2137 _ut.test('test_constConstructorWithNonFinalField', () { | 2801 _ut.test('test_constConstructorWithNonFinalField', () { |
| 2138 final __test = new CompileTimeErrorCodeTest(); | 2802 final __test = new CompileTimeErrorCodeTest(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 2163 runJUnitTest(__test, __test.test_constWithNonConst); | 2827 runJUnitTest(__test, __test.test_constWithNonConst); |
| 2164 }); | 2828 }); |
| 2165 _ut.test('test_defaultValueInFunctionTypeAlias', () { | 2829 _ut.test('test_defaultValueInFunctionTypeAlias', () { |
| 2166 final __test = new CompileTimeErrorCodeTest(); | 2830 final __test = new CompileTimeErrorCodeTest(); |
| 2167 runJUnitTest(__test, __test.test_defaultValueInFunctionTypeAlias); | 2831 runJUnitTest(__test, __test.test_defaultValueInFunctionTypeAlias); |
| 2168 }); | 2832 }); |
| 2169 _ut.test('test_duplicateMemberError', () { | 2833 _ut.test('test_duplicateMemberError', () { |
| 2170 final __test = new CompileTimeErrorCodeTest(); | 2834 final __test = new CompileTimeErrorCodeTest(); |
| 2171 runJUnitTest(__test, __test.test_duplicateMemberError); | 2835 runJUnitTest(__test, __test.test_duplicateMemberError); |
| 2172 }); | 2836 }); |
| 2173 _ut.test('test_extendsNonClass', () { | 2837 _ut.test('test_exportOfNonLibrary', () { |
| 2174 final __test = new CompileTimeErrorCodeTest(); | 2838 final __test = new CompileTimeErrorCodeTest(); |
| 2175 runJUnitTest(__test, __test.test_extendsNonClass); | 2839 runJUnitTest(__test, __test.test_exportOfNonLibrary); |
| 2840 }); |
| 2841 _ut.test('test_extendsNonClass_class', () { |
| 2842 final __test = new CompileTimeErrorCodeTest(); |
| 2843 runJUnitTest(__test, __test.test_extendsNonClass_class); |
| 2176 }); | 2844 }); |
| 2177 _ut.test('test_extendsOrImplementsDisallowedClass_extends_String', () { | 2845 _ut.test('test_extendsOrImplementsDisallowedClass_extends_String', () { |
| 2178 final __test = new CompileTimeErrorCodeTest(); | 2846 final __test = new CompileTimeErrorCodeTest(); |
| 2179 runJUnitTest(__test, __test.test_extendsOrImplementsDisallowedClass_exte
nds_String); | 2847 runJUnitTest(__test, __test.test_extendsOrImplementsDisallowedClass_exte
nds_String); |
| 2180 }); | 2848 }); |
| 2181 _ut.test('test_extendsOrImplementsDisallowedClass_extends_bool', () { | 2849 _ut.test('test_extendsOrImplementsDisallowedClass_extends_bool', () { |
| 2182 final __test = new CompileTimeErrorCodeTest(); | 2850 final __test = new CompileTimeErrorCodeTest(); |
| 2183 runJUnitTest(__test, __test.test_extendsOrImplementsDisallowedClass_exte
nds_bool); | 2851 runJUnitTest(__test, __test.test_extendsOrImplementsDisallowedClass_exte
nds_bool); |
| 2184 }); | 2852 }); |
| 2185 _ut.test('test_extendsOrImplementsDisallowedClass_extends_double', () { | 2853 _ut.test('test_extendsOrImplementsDisallowedClass_extends_double', () { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 2207 runJUnitTest(__test, __test.test_extendsOrImplementsDisallowedClass_impl
ements_double); | 2875 runJUnitTest(__test, __test.test_extendsOrImplementsDisallowedClass_impl
ements_double); |
| 2208 }); | 2876 }); |
| 2209 _ut.test('test_extendsOrImplementsDisallowedClass_implements_int', () { | 2877 _ut.test('test_extendsOrImplementsDisallowedClass_implements_int', () { |
| 2210 final __test = new CompileTimeErrorCodeTest(); | 2878 final __test = new CompileTimeErrorCodeTest(); |
| 2211 runJUnitTest(__test, __test.test_extendsOrImplementsDisallowedClass_impl
ements_int); | 2879 runJUnitTest(__test, __test.test_extendsOrImplementsDisallowedClass_impl
ements_int); |
| 2212 }); | 2880 }); |
| 2213 _ut.test('test_extendsOrImplementsDisallowedClass_implements_num', () { | 2881 _ut.test('test_extendsOrImplementsDisallowedClass_implements_num', () { |
| 2214 final __test = new CompileTimeErrorCodeTest(); | 2882 final __test = new CompileTimeErrorCodeTest(); |
| 2215 runJUnitTest(__test, __test.test_extendsOrImplementsDisallowedClass_impl
ements_num); | 2883 runJUnitTest(__test, __test.test_extendsOrImplementsDisallowedClass_impl
ements_num); |
| 2216 }); | 2884 }); |
| 2217 _ut.test('test_fieldInitializeInParameterAndInitializer', () { | 2885 _ut.test('test_fieldInitializedByMultipleInitializers', () { |
| 2218 final __test = new CompileTimeErrorCodeTest(); | 2886 final __test = new CompileTimeErrorCodeTest(); |
| 2219 runJUnitTest(__test, __test.test_fieldInitializeInParameterAndInitialize
r); | 2887 runJUnitTest(__test, __test.test_fieldInitializedByMultipleInitializers)
; |
| 2888 }); |
| 2889 _ut.test('test_fieldInitializedByMultipleInitializers_multipleInits', () { |
| 2890 final __test = new CompileTimeErrorCodeTest(); |
| 2891 runJUnitTest(__test, __test.test_fieldInitializedByMultipleInitializers_
multipleInits); |
| 2892 }); |
| 2893 _ut.test('test_fieldInitializedByMultipleInitializers_multipleNames', () { |
| 2894 final __test = new CompileTimeErrorCodeTest(); |
| 2895 runJUnitTest(__test, __test.test_fieldInitializedByMultipleInitializers_
multipleNames); |
| 2220 }); | 2896 }); |
| 2221 _ut.test('test_fieldInitializedInInitializerAndDeclaration_const', () { | 2897 _ut.test('test_fieldInitializedInInitializerAndDeclaration_const', () { |
| 2222 final __test = new CompileTimeErrorCodeTest(); | 2898 final __test = new CompileTimeErrorCodeTest(); |
| 2223 runJUnitTest(__test, __test.test_fieldInitializedInInitializerAndDeclara
tion_const); | 2899 runJUnitTest(__test, __test.test_fieldInitializedInInitializerAndDeclara
tion_const); |
| 2224 }); | 2900 }); |
| 2225 _ut.test('test_fieldInitializedInInitializerAndDeclaration_final', () { | 2901 _ut.test('test_fieldInitializedInInitializerAndDeclaration_final', () { |
| 2226 final __test = new CompileTimeErrorCodeTest(); | 2902 final __test = new CompileTimeErrorCodeTest(); |
| 2227 runJUnitTest(__test, __test.test_fieldInitializedInInitializerAndDeclara
tion_final); | 2903 runJUnitTest(__test, __test.test_fieldInitializedInInitializerAndDeclara
tion_final); |
| 2228 }); | 2904 }); |
| 2905 _ut.test('test_fieldInitializedInParameterAndInitializer', () { |
| 2906 final __test = new CompileTimeErrorCodeTest(); |
| 2907 runJUnitTest(__test, __test.test_fieldInitializedInParameterAndInitializ
er); |
| 2908 }); |
| 2229 _ut.test('test_fieldInitializerOutsideConstructor', () { | 2909 _ut.test('test_fieldInitializerOutsideConstructor', () { |
| 2230 final __test = new CompileTimeErrorCodeTest(); | 2910 final __test = new CompileTimeErrorCodeTest(); |
| 2231 runJUnitTest(__test, __test.test_fieldInitializerOutsideConstructor); | 2911 runJUnitTest(__test, __test.test_fieldInitializerOutsideConstructor); |
| 2232 }); | 2912 }); |
| 2233 _ut.test('test_fieldInitializerOutsideConstructor_defaultParameters', () { | 2913 _ut.test('test_fieldInitializerOutsideConstructor_defaultParameter', () { |
| 2234 final __test = new CompileTimeErrorCodeTest(); | 2914 final __test = new CompileTimeErrorCodeTest(); |
| 2235 runJUnitTest(__test, __test.test_fieldInitializerOutsideConstructor_defa
ultParameters); | 2915 runJUnitTest(__test, __test.test_fieldInitializerOutsideConstructor_defa
ultParameter); |
| 2236 }); | 2916 }); |
| 2237 _ut.test('test_implementsNonClass', () { | 2917 _ut.test('test_finalInitializedInDeclarationAndConstructor_initializers',
() { |
| 2238 final __test = new CompileTimeErrorCodeTest(); | 2918 final __test = new CompileTimeErrorCodeTest(); |
| 2239 runJUnitTest(__test, __test.test_implementsNonClass); | 2919 runJUnitTest(__test, __test.test_finalInitializedInDeclarationAndConstru
ctor_initializers); |
| 2920 }); |
| 2921 _ut.test('test_finalInitializedInDeclarationAndConstructor_initializingFor
mal', () { |
| 2922 final __test = new CompileTimeErrorCodeTest(); |
| 2923 runJUnitTest(__test, __test.test_finalInitializedInDeclarationAndConstru
ctor_initializingFormal); |
| 2924 }); |
| 2925 _ut.test('test_finalInitializedMultipleTimes_initializers', () { |
| 2926 final __test = new CompileTimeErrorCodeTest(); |
| 2927 runJUnitTest(__test, __test.test_finalInitializedMultipleTimes_initializ
ers); |
| 2928 }); |
| 2929 _ut.test('test_finalInitializedMultipleTimes_initializingFormal_initialize
r', () { |
| 2930 final __test = new CompileTimeErrorCodeTest(); |
| 2931 runJUnitTest(__test, __test.test_finalInitializedMultipleTimes_initializ
ingFormal_initializer); |
| 2932 }); |
| 2933 _ut.test('test_finalInitializedMultipleTimes_initializingFormals', () { |
| 2934 final __test = new CompileTimeErrorCodeTest(); |
| 2935 runJUnitTest(__test, __test.test_finalInitializedMultipleTimes_initializ
ingFormals); |
| 2936 }); |
| 2937 _ut.test('test_finalNotInitialized_instanceField_const', () { |
| 2938 final __test = new CompileTimeErrorCodeTest(); |
| 2939 runJUnitTest(__test, __test.test_finalNotInitialized_instanceField_const
); |
| 2940 }); |
| 2941 _ut.test('test_finalNotInitialized_instanceField_const_static', () { |
| 2942 final __test = new CompileTimeErrorCodeTest(); |
| 2943 runJUnitTest(__test, __test.test_finalNotInitialized_instanceField_const
_static); |
| 2944 }); |
| 2945 _ut.test('test_finalNotInitialized_instanceField_final', () { |
| 2946 final __test = new CompileTimeErrorCodeTest(); |
| 2947 runJUnitTest(__test, __test.test_finalNotInitialized_instanceField_final
); |
| 2948 }); |
| 2949 _ut.test('test_finalNotInitialized_instanceField_final_static', () { |
| 2950 final __test = new CompileTimeErrorCodeTest(); |
| 2951 runJUnitTest(__test, __test.test_finalNotInitialized_instanceField_final
_static); |
| 2952 }); |
| 2953 _ut.test('test_finalNotInitialized_library_const', () { |
| 2954 final __test = new CompileTimeErrorCodeTest(); |
| 2955 runJUnitTest(__test, __test.test_finalNotInitialized_library_const); |
| 2956 }); |
| 2957 _ut.test('test_finalNotInitialized_library_final', () { |
| 2958 final __test = new CompileTimeErrorCodeTest(); |
| 2959 runJUnitTest(__test, __test.test_finalNotInitialized_library_final); |
| 2960 }); |
| 2961 _ut.test('test_finalNotInitialized_local_const', () { |
| 2962 final __test = new CompileTimeErrorCodeTest(); |
| 2963 runJUnitTest(__test, __test.test_finalNotInitialized_local_const); |
| 2964 }); |
| 2965 _ut.test('test_finalNotInitialized_local_final', () { |
| 2966 final __test = new CompileTimeErrorCodeTest(); |
| 2967 runJUnitTest(__test, __test.test_finalNotInitialized_local_final); |
| 2968 }); |
| 2969 _ut.test('test_implementsDynamic', () { |
| 2970 final __test = new CompileTimeErrorCodeTest(); |
| 2971 runJUnitTest(__test, __test.test_implementsDynamic); |
| 2972 }); |
| 2973 _ut.test('test_implementsNonClass_class', () { |
| 2974 final __test = new CompileTimeErrorCodeTest(); |
| 2975 runJUnitTest(__test, __test.test_implementsNonClass_class); |
| 2976 }); |
| 2977 _ut.test('test_implementsNonClass_typedef', () { |
| 2978 final __test = new CompileTimeErrorCodeTest(); |
| 2979 runJUnitTest(__test, __test.test_implementsNonClass_typedef); |
| 2980 }); |
| 2981 _ut.test('test_implementsRepeated', () { |
| 2982 final __test = new CompileTimeErrorCodeTest(); |
| 2983 runJUnitTest(__test, __test.test_implementsRepeated); |
| 2984 }); |
| 2985 _ut.test('test_implementsRepeated_3times', () { |
| 2986 final __test = new CompileTimeErrorCodeTest(); |
| 2987 runJUnitTest(__test, __test.test_implementsRepeated_3times); |
| 2988 }); |
| 2989 _ut.test('test_implementsSelf', () { |
| 2990 final __test = new CompileTimeErrorCodeTest(); |
| 2991 runJUnitTest(__test, __test.test_implementsSelf); |
| 2992 }); |
| 2993 _ut.test('test_importOfNonLibrary', () { |
| 2994 final __test = new CompileTimeErrorCodeTest(); |
| 2995 runJUnitTest(__test, __test.test_importOfNonLibrary); |
| 2996 }); |
| 2997 _ut.test('test_initializingFormalForNonExistantField', () { |
| 2998 final __test = new CompileTimeErrorCodeTest(); |
| 2999 runJUnitTest(__test, __test.test_initializingFormalForNonExistantField); |
| 3000 }); |
| 3001 _ut.test('test_initializingFormalForNonExistantField_notInEnclosingClass',
() { |
| 3002 final __test = new CompileTimeErrorCodeTest(); |
| 3003 runJUnitTest(__test, __test.test_initializingFormalForNonExistantField_n
otInEnclosingClass); |
| 3004 }); |
| 3005 _ut.test('test_initializingFormalForNonExistantField_optional', () { |
| 3006 final __test = new CompileTimeErrorCodeTest(); |
| 3007 runJUnitTest(__test, __test.test_initializingFormalForNonExistantField_o
ptional); |
| 3008 }); |
| 3009 _ut.test('test_initializingFormalForNonExistantField_static', () { |
| 3010 final __test = new CompileTimeErrorCodeTest(); |
| 3011 runJUnitTest(__test, __test.test_initializingFormalForNonExistantField_s
tatic); |
| 3012 }); |
| 3013 _ut.test('test_invalidUri_export', () { |
| 3014 final __test = new CompileTimeErrorCodeTest(); |
| 3015 runJUnitTest(__test, __test.test_invalidUri_export); |
| 3016 }); |
| 3017 _ut.test('test_invalidUri_import', () { |
| 3018 final __test = new CompileTimeErrorCodeTest(); |
| 3019 runJUnitTest(__test, __test.test_invalidUri_import); |
| 3020 }); |
| 3021 _ut.test('test_invalidUri_part', () { |
| 3022 final __test = new CompileTimeErrorCodeTest(); |
| 3023 runJUnitTest(__test, __test.test_invalidUri_part); |
| 2240 }); | 3024 }); |
| 2241 _ut.test('test_labelInOuterScope', () { | 3025 _ut.test('test_labelInOuterScope', () { |
| 2242 final __test = new CompileTimeErrorCodeTest(); | 3026 final __test = new CompileTimeErrorCodeTest(); |
| 2243 runJUnitTest(__test, __test.test_labelInOuterScope); | 3027 runJUnitTest(__test, __test.test_labelInOuterScope); |
| 2244 }); | 3028 }); |
| 2245 _ut.test('test_labelUndefined_break', () { | 3029 _ut.test('test_labelUndefined_break', () { |
| 2246 final __test = new CompileTimeErrorCodeTest(); | 3030 final __test = new CompileTimeErrorCodeTest(); |
| 2247 runJUnitTest(__test, __test.test_labelUndefined_break); | 3031 runJUnitTest(__test, __test.test_labelUndefined_break); |
| 2248 }); | 3032 }); |
| 2249 _ut.test('test_labelUndefined_continue', () { | 3033 _ut.test('test_labelUndefined_continue', () { |
| 2250 final __test = new CompileTimeErrorCodeTest(); | 3034 final __test = new CompileTimeErrorCodeTest(); |
| 2251 runJUnitTest(__test, __test.test_labelUndefined_continue); | 3035 runJUnitTest(__test, __test.test_labelUndefined_continue); |
| 2252 }); | 3036 }); |
| 3037 _ut.test('test_mixinOfNonClass_class', () { |
| 3038 final __test = new CompileTimeErrorCodeTest(); |
| 3039 runJUnitTest(__test, __test.test_mixinOfNonClass_class); |
| 3040 }); |
| 3041 _ut.test('test_mixinOfNonClass_typedef', () { |
| 3042 final __test = new CompileTimeErrorCodeTest(); |
| 3043 runJUnitTest(__test, __test.test_mixinOfNonClass_typedef); |
| 3044 }); |
| 3045 _ut.test('test_nativeFunctionBodyInNonSDKCode_function', () { |
| 3046 final __test = new CompileTimeErrorCodeTest(); |
| 3047 runJUnitTest(__test, __test.test_nativeFunctionBodyInNonSDKCode_function
); |
| 3048 }); |
| 3049 _ut.test('test_nativeFunctionBodyInNonSDKCode_method', () { |
| 3050 final __test = new CompileTimeErrorCodeTest(); |
| 3051 runJUnitTest(__test, __test.test_nativeFunctionBodyInNonSDKCode_method); |
| 3052 }); |
| 2253 _ut.test('test_newWithInvalidTypeParameters', () { | 3053 _ut.test('test_newWithInvalidTypeParameters', () { |
| 2254 final __test = new CompileTimeErrorCodeTest(); | 3054 final __test = new CompileTimeErrorCodeTest(); |
| 2255 runJUnitTest(__test, __test.test_newWithInvalidTypeParameters); | 3055 runJUnitTest(__test, __test.test_newWithInvalidTypeParameters); |
| 2256 }); | 3056 }); |
| 2257 _ut.test('test_nonConstCaseExpression', () { | 3057 _ut.test('test_nonConstCaseExpression', () { |
| 2258 final __test = new CompileTimeErrorCodeTest(); | 3058 final __test = new CompileTimeErrorCodeTest(); |
| 2259 runJUnitTest(__test, __test.test_nonConstCaseExpression); | 3059 runJUnitTest(__test, __test.test_nonConstCaseExpression); |
| 2260 }); | 3060 }); |
| 2261 _ut.test('test_nonConstListElement', () { | 3061 _ut.test('test_nonConstListElement', () { |
| 2262 final __test = new CompileTimeErrorCodeTest(); | 3062 final __test = new CompileTimeErrorCodeTest(); |
| 2263 runJUnitTest(__test, __test.test_nonConstListElement); | 3063 runJUnitTest(__test, __test.test_nonConstListElement); |
| 2264 }); | 3064 }); |
| 2265 _ut.test('test_nonConstMapValue', () { | 3065 _ut.test('test_nonConstMapValue', () { |
| 2266 final __test = new CompileTimeErrorCodeTest(); | 3066 final __test = new CompileTimeErrorCodeTest(); |
| 2267 runJUnitTest(__test, __test.test_nonConstMapValue); | 3067 runJUnitTest(__test, __test.test_nonConstMapValue); |
| 2268 }); | 3068 }); |
| 3069 _ut.test('test_partOfNonPart', () { |
| 3070 final __test = new CompileTimeErrorCodeTest(); |
| 3071 runJUnitTest(__test, __test.test_partOfNonPart); |
| 3072 }); |
| 2269 _ut.test('test_rethrowOutsideCatch', () { | 3073 _ut.test('test_rethrowOutsideCatch', () { |
| 2270 final __test = new CompileTimeErrorCodeTest(); | 3074 final __test = new CompileTimeErrorCodeTest(); |
| 2271 runJUnitTest(__test, __test.test_rethrowOutsideCatch); | 3075 runJUnitTest(__test, __test.test_rethrowOutsideCatch); |
| 2272 }); | 3076 }); |
| 2273 _ut.test('test_uriWithInterpolation_constant', () { | 3077 _ut.test('test_uriWithInterpolation_constant', () { |
| 2274 final __test = new CompileTimeErrorCodeTest(); | 3078 final __test = new CompileTimeErrorCodeTest(); |
| 2275 runJUnitTest(__test, __test.test_uriWithInterpolation_constant); | 3079 runJUnitTest(__test, __test.test_uriWithInterpolation_constant); |
| 2276 }); | 3080 }); |
| 2277 _ut.test('test_uriWithInterpolation_nonConstant', () { | 3081 _ut.test('test_uriWithInterpolation_nonConstant', () { |
| 2278 final __test = new CompileTimeErrorCodeTest(); | 3082 final __test = new CompileTimeErrorCodeTest(); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2363 return null; | 3167 return null; |
| 2364 } | 3168 } |
| 2365 Object visitLibraryIdentifier(LibraryIdentifier node) => null; | 3169 Object visitLibraryIdentifier(LibraryIdentifier node) => null; |
| 2366 Object visitPrefixedIdentifier(PrefixedIdentifier node) { | 3170 Object visitPrefixedIdentifier(PrefixedIdentifier node) { |
| 2367 if (node.staticType == null && identical(node.prefix.staticType, DynamicType
Impl.instance)) { | 3171 if (node.staticType == null && identical(node.prefix.staticType, DynamicType
Impl.instance)) { |
| 2368 return null; | 3172 return null; |
| 2369 } | 3173 } |
| 2370 return super.visitPrefixedIdentifier(node); | 3174 return super.visitPrefixedIdentifier(node); |
| 2371 } | 3175 } |
| 2372 Object visitSimpleIdentifier(SimpleIdentifier node) { | 3176 Object visitSimpleIdentifier(SimpleIdentifier node) { |
| 2373 ASTNode parent21 = node.parent; | 3177 ASTNode parent20 = node.parent; |
| 2374 if (parent21 is MethodInvocation && identical(node, ((parent21 as MethodInvo
cation)).methodName)) { | 3178 if (parent20 is MethodInvocation && identical(node, ((parent20 as MethodInvo
cation)).methodName)) { |
| 2375 return null; | 3179 return null; |
| 2376 } else if (parent21 is RedirectingConstructorInvocation && identical(node, (
(parent21 as RedirectingConstructorInvocation)).constructorName)) { | 3180 } else if (parent20 is RedirectingConstructorInvocation && identical(node, (
(parent20 as RedirectingConstructorInvocation)).constructorName)) { |
| 2377 return null; | 3181 return null; |
| 2378 } else if (parent21 is SuperConstructorInvocation && identical(node, ((paren
t21 as SuperConstructorInvocation)).constructorName)) { | 3182 } else if (parent20 is SuperConstructorInvocation && identical(node, ((paren
t20 as SuperConstructorInvocation)).constructorName)) { |
| 2379 return null; | 3183 return null; |
| 2380 } else if (parent21 is ConstructorName && identical(node, ((parent21 as Cons
tructorName)).name)) { | 3184 } else if (parent20 is ConstructorName && identical(node, ((parent20 as Cons
tructorName)).name)) { |
| 2381 return null; | 3185 return null; |
| 2382 } else if (parent21 is Label && identical(node, ((parent21 as Label)).label)
) { | 3186 } else if (parent20 is Label && identical(node, ((parent20 as Label)).label)
) { |
| 2383 return null; | 3187 return null; |
| 2384 } else if (parent21 is ImportDirective && identical(node, ((parent21 as Impo
rtDirective)).prefix)) { | 3188 } else if (parent20 is ImportDirective && identical(node, ((parent20 as Impo
rtDirective)).prefix)) { |
| 2385 return null; | 3189 return null; |
| 2386 } else if (node.element is PrefixElement) { | 3190 } else if (node.element is PrefixElement) { |
| 2387 return null; | 3191 return null; |
| 2388 } | 3192 } |
| 2389 return super.visitSimpleIdentifier(node); | 3193 return super.visitSimpleIdentifier(node); |
| 2390 } | 3194 } |
| 2391 Object visitTypeName(TypeName node) { | 3195 Object visitTypeName(TypeName node) { |
| 2392 if (node.type == null) { | 3196 if (node.type == null) { |
| 2393 _unresolvedTypes.add(node); | 3197 _unresolvedTypes.add(node); |
| 2394 } else { | 3198 } else { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2461 void fail_visitRedirectingConstructorInvocation() { | 3265 void fail_visitRedirectingConstructorInvocation() { |
| 2462 JUnitTestCase.fail("Not yet tested"); | 3266 JUnitTestCase.fail("Not yet tested"); |
| 2463 _listener.assertNoErrors(); | 3267 _listener.assertNoErrors(); |
| 2464 } | 3268 } |
| 2465 void setUp() { | 3269 void setUp() { |
| 2466 _listener = new GatheringErrorListener(); | 3270 _listener = new GatheringErrorListener(); |
| 2467 _typeProvider = new TestTypeProvider(); | 3271 _typeProvider = new TestTypeProvider(); |
| 2468 _resolver = createResolver(); | 3272 _resolver = createResolver(); |
| 2469 } | 3273 } |
| 2470 void test_visitAssignmentExpression_compound() { | 3274 void test_visitAssignmentExpression_compound() { |
| 2471 InterfaceType intType2 = _typeProvider.intType; | 3275 InterfaceType intType3 = _typeProvider.intType; |
| 2472 SimpleIdentifier leftHandSide = ASTFactory.identifier2("a"); | 3276 SimpleIdentifier leftHandSide = ASTFactory.identifier3("a"); |
| 2473 leftHandSide.staticType = intType2; | 3277 leftHandSide.staticType = intType3; |
| 2474 AssignmentExpression assignment = ASTFactory.assignmentExpression(leftHandSi
de, TokenType.PLUS_EQ, ASTFactory.integer(1)); | 3278 AssignmentExpression assignment = ASTFactory.assignmentExpression(leftHandSi
de, TokenType.PLUS_EQ, ASTFactory.integer(1)); |
| 2475 resolveNode(assignment, []); | 3279 resolveNode(assignment, []); |
| 2476 JUnitTestCase.assertSame(getMethod(_typeProvider.numType, "+"), assignment.e
lement); | 3280 JUnitTestCase.assertSame(getMethod(_typeProvider.numType, "+"), assignment.e
lement); |
| 2477 _listener.assertNoErrors(); | 3281 _listener.assertNoErrors(); |
| 2478 } | 3282 } |
| 2479 void test_visitAssignmentExpression_simple() { | 3283 void test_visitAssignmentExpression_simple() { |
| 2480 AssignmentExpression expression = ASTFactory.assignmentExpression(ASTFactory
.identifier2("x"), TokenType.EQ, ASTFactory.integer(0)); | 3284 AssignmentExpression expression = ASTFactory.assignmentExpression(ASTFactory
.identifier3("x"), TokenType.EQ, ASTFactory.integer(0)); |
| 2481 resolveNode(expression, []); | 3285 resolveNode(expression, []); |
| 2482 JUnitTestCase.assertNull(expression.element); | 3286 JUnitTestCase.assertNull(expression.element); |
| 2483 _listener.assertNoErrors(); | 3287 _listener.assertNoErrors(); |
| 2484 } | 3288 } |
| 2485 void test_visitBinaryExpression() { | 3289 void test_visitBinaryExpression() { |
| 2486 InterfaceType numType2 = _typeProvider.numType; | 3290 InterfaceType numType2 = _typeProvider.numType; |
| 2487 SimpleIdentifier left = ASTFactory.identifier2("i"); | 3291 SimpleIdentifier left = ASTFactory.identifier3("i"); |
| 2488 left.staticType = numType2; | 3292 left.staticType = numType2; |
| 2489 BinaryExpression expression = ASTFactory.binaryExpression(left, TokenType.PL
US, ASTFactory.identifier2("j")); | 3293 BinaryExpression expression = ASTFactory.binaryExpression(left, TokenType.PL
US, ASTFactory.identifier3("j")); |
| 2490 resolveNode(expression, []); | 3294 resolveNode(expression, []); |
| 2491 JUnitTestCase.assertEquals(getMethod(numType2, "+"), expression.element); | 3295 JUnitTestCase.assertEquals(getMethod(numType2, "+"), expression.element); |
| 2492 _listener.assertNoErrors(); | 3296 _listener.assertNoErrors(); |
| 2493 } | 3297 } |
| 2494 void test_visitBreakStatement_withLabel() { | 3298 void test_visitBreakStatement_withLabel() { |
| 2495 String label = "loop"; | 3299 String label = "loop"; |
| 2496 LabelElementImpl labelElement = new LabelElementImpl(ASTFactory.identifier2(
label), false, false); | 3300 LabelElementImpl labelElement = new LabelElementImpl(ASTFactory.identifier3(
label), false, false); |
| 2497 BreakStatement statement = ASTFactory.breakStatement2(label); | 3301 BreakStatement statement = ASTFactory.breakStatement2(label); |
| 2498 JUnitTestCase.assertSame(labelElement, resolve(statement, labelElement)); | 3302 JUnitTestCase.assertSame(labelElement, resolve(statement, labelElement)); |
| 2499 _listener.assertNoErrors(); | 3303 _listener.assertNoErrors(); |
| 2500 } | 3304 } |
| 2501 void test_visitBreakStatement_withoutLabel() { | 3305 void test_visitBreakStatement_withoutLabel() { |
| 2502 BreakStatement statement = ASTFactory.breakStatement(); | 3306 BreakStatement statement = ASTFactory.breakStatement(); |
| 2503 resolveStatement(statement, null); | 3307 resolveStatement(statement, null); |
| 2504 _listener.assertNoErrors(); | 3308 _listener.assertNoErrors(); |
| 2505 } | 3309 } |
| 2506 void test_visitConstructorName_named() { | 3310 void test_visitConstructorName_named() { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2518 String constructorName = null; | 3322 String constructorName = null; |
| 2519 ConstructorElement constructor = ElementFactory.constructorElement(construct
orName); | 3323 ConstructorElement constructor = ElementFactory.constructorElement(construct
orName); |
| 2520 classA.constructors = <ConstructorElement> [constructor]; | 3324 classA.constructors = <ConstructorElement> [constructor]; |
| 2521 ConstructorName name = ASTFactory.constructorName(ASTFactory.typeName(classA
, []), constructorName); | 3325 ConstructorName name = ASTFactory.constructorName(ASTFactory.typeName(classA
, []), constructorName); |
| 2522 resolveNode(name, []); | 3326 resolveNode(name, []); |
| 2523 JUnitTestCase.assertSame(constructor, name.element); | 3327 JUnitTestCase.assertSame(constructor, name.element); |
| 2524 _listener.assertNoErrors(); | 3328 _listener.assertNoErrors(); |
| 2525 } | 3329 } |
| 2526 void test_visitContinueStatement_withLabel() { | 3330 void test_visitContinueStatement_withLabel() { |
| 2527 String label = "loop"; | 3331 String label = "loop"; |
| 2528 LabelElementImpl labelElement = new LabelElementImpl(ASTFactory.identifier2(
label), false, false); | 3332 LabelElementImpl labelElement = new LabelElementImpl(ASTFactory.identifier3(
label), false, false); |
| 2529 ContinueStatement statement = ASTFactory.continueStatement2(label); | 3333 ContinueStatement statement = ASTFactory.continueStatement2(label); |
| 2530 JUnitTestCase.assertSame(labelElement, resolve2(statement, labelElement)); | 3334 JUnitTestCase.assertSame(labelElement, resolve2(statement, labelElement)); |
| 2531 _listener.assertNoErrors(); | 3335 _listener.assertNoErrors(); |
| 2532 } | 3336 } |
| 2533 void test_visitContinueStatement_withoutLabel() { | 3337 void test_visitContinueStatement_withoutLabel() { |
| 2534 ContinueStatement statement = ASTFactory.continueStatement(); | 3338 ContinueStatement statement = ASTFactory.continueStatement(); |
| 2535 resolveStatement(statement, null); | 3339 resolveStatement(statement, null); |
| 2536 _listener.assertNoErrors(); | 3340 _listener.assertNoErrors(); |
| 2537 } | 3341 } |
| 2538 void test_visitExportDirective_noCombinators() { | 3342 void test_visitExportDirective_noCombinators() { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2551 String prefixName = "p"; | 3355 String prefixName = "p"; |
| 2552 ImportElement importElement = ElementFactory.importFor(ElementFactory.librar
y(_definingLibrary.context, "lib"), ElementFactory.prefix(prefixName), []); | 3356 ImportElement importElement = ElementFactory.importFor(ElementFactory.librar
y(_definingLibrary.context, "lib"), ElementFactory.prefix(prefixName), []); |
| 2553 _definingLibrary.imports = <ImportElement> [importElement]; | 3357 _definingLibrary.imports = <ImportElement> [importElement]; |
| 2554 ImportDirective directive = ASTFactory.importDirective2(null, prefixName, []
); | 3358 ImportDirective directive = ASTFactory.importDirective2(null, prefixName, []
); |
| 2555 directive.element = importElement; | 3359 directive.element = importElement; |
| 2556 resolveNode(directive, []); | 3360 resolveNode(directive, []); |
| 2557 _listener.assertNoErrors(); | 3361 _listener.assertNoErrors(); |
| 2558 } | 3362 } |
| 2559 void test_visitIndexExpression_get() { | 3363 void test_visitIndexExpression_get() { |
| 2560 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 3364 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 2561 InterfaceType intType3 = _typeProvider.intType; | 3365 InterfaceType intType4 = _typeProvider.intType; |
| 2562 MethodElement getter = ElementFactory.methodElement("[]", intType3, [intType
3]); | 3366 MethodElement getter = ElementFactory.methodElement("[]", intType4, [intType
4]); |
| 2563 classA.methods = <MethodElement> [getter]; | 3367 classA.methods = <MethodElement> [getter]; |
| 2564 SimpleIdentifier array = ASTFactory.identifier2("a"); | 3368 SimpleIdentifier array = ASTFactory.identifier3("a"); |
| 2565 array.staticType = classA.type; | 3369 array.staticType = classA.type; |
| 2566 IndexExpression expression = ASTFactory.indexExpression(array, ASTFactory.id
entifier2("i")); | 3370 IndexExpression expression = ASTFactory.indexExpression(array, ASTFactory.id
entifier3("i")); |
| 2567 JUnitTestCase.assertSame(getter, resolve4(expression, [])); | 3371 JUnitTestCase.assertSame(getter, resolve4(expression, [])); |
| 2568 _listener.assertNoErrors(); | 3372 _listener.assertNoErrors(); |
| 2569 } | 3373 } |
| 2570 void test_visitIndexExpression_set() { | 3374 void test_visitIndexExpression_set() { |
| 2571 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 3375 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 2572 InterfaceType intType4 = _typeProvider.intType; | 3376 InterfaceType intType5 = _typeProvider.intType; |
| 2573 MethodElement setter = ElementFactory.methodElement("[]=", intType4, [intTyp
e4]); | 3377 MethodElement setter = ElementFactory.methodElement("[]=", intType5, [intTyp
e5]); |
| 2574 classA.methods = <MethodElement> [setter]; | 3378 classA.methods = <MethodElement> [setter]; |
| 2575 SimpleIdentifier array = ASTFactory.identifier2("a"); | 3379 SimpleIdentifier array = ASTFactory.identifier3("a"); |
| 2576 array.staticType = classA.type; | 3380 array.staticType = classA.type; |
| 2577 IndexExpression expression = ASTFactory.indexExpression(array, ASTFactory.id
entifier2("i")); | 3381 IndexExpression expression = ASTFactory.indexExpression(array, ASTFactory.id
entifier3("i")); |
| 2578 ASTFactory.assignmentExpression(expression, TokenType.EQ, ASTFactory.integer
(0)); | 3382 ASTFactory.assignmentExpression(expression, TokenType.EQ, ASTFactory.integer
(0)); |
| 2579 JUnitTestCase.assertSame(setter, resolve4(expression, [])); | 3383 JUnitTestCase.assertSame(setter, resolve4(expression, [])); |
| 2580 _listener.assertNoErrors(); | 3384 _listener.assertNoErrors(); |
| 2581 } | 3385 } |
| 2582 void test_visitInstanceCreationExpression_named() { | 3386 void test_visitInstanceCreationExpression_named() { |
| 2583 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 3387 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 2584 String constructorName = "a"; | 3388 String constructorName = "a"; |
| 2585 ConstructorElement constructor = ElementFactory.constructorElement(construct
orName); | 3389 ConstructorElement constructor = ElementFactory.constructorElement(construct
orName); |
| 2586 classA.constructors = <ConstructorElement> [constructor]; | 3390 classA.constructors = <ConstructorElement> [constructor]; |
| 2587 ConstructorName name = ASTFactory.constructorName(ASTFactory.typeName(classA
, []), constructorName); | 3391 ConstructorName name = ASTFactory.constructorName(ASTFactory.typeName(classA
, []), constructorName); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 2606 void test_visitInstanceCreationExpression_unnamed_namedParameter() { | 3410 void test_visitInstanceCreationExpression_unnamed_namedParameter() { |
| 2607 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 3411 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 2608 String constructorName = null; | 3412 String constructorName = null; |
| 2609 ConstructorElementImpl constructor = ElementFactory.constructorElement(const
ructorName); | 3413 ConstructorElementImpl constructor = ElementFactory.constructorElement(const
ructorName); |
| 2610 String parameterName = "a"; | 3414 String parameterName = "a"; |
| 2611 ParameterElement parameter = ElementFactory.namedParameter(parameterName); | 3415 ParameterElement parameter = ElementFactory.namedParameter(parameterName); |
| 2612 constructor.parameters = <ParameterElement> [parameter]; | 3416 constructor.parameters = <ParameterElement> [parameter]; |
| 2613 classA.constructors = <ConstructorElement> [constructor]; | 3417 classA.constructors = <ConstructorElement> [constructor]; |
| 2614 ConstructorName name = ASTFactory.constructorName(ASTFactory.typeName(classA
, []), constructorName); | 3418 ConstructorName name = ASTFactory.constructorName(ASTFactory.typeName(classA
, []), constructorName); |
| 2615 name.element = constructor; | 3419 name.element = constructor; |
| 2616 InstanceCreationExpression creation = ASTFactory.instanceCreationExpression(
Keyword.NEW, name, [ASTFactory.namedExpression(parameterName, ASTFactory.integer
(0))]); | 3420 InstanceCreationExpression creation = ASTFactory.instanceCreationExpression(
Keyword.NEW, name, [ASTFactory.namedExpression2(parameterName, ASTFactory.intege
r(0))]); |
| 2617 resolveNode(creation, []); | 3421 resolveNode(creation, []); |
| 2618 JUnitTestCase.assertSame(constructor, creation.element); | 3422 JUnitTestCase.assertSame(constructor, creation.element); |
| 2619 JUnitTestCase.assertSame(parameter, ((creation.argumentList.arguments[0] as
NamedExpression)).name.label.element); | 3423 JUnitTestCase.assertSame(parameter, ((creation.argumentList.arguments[0] as
NamedExpression)).name.label.element); |
| 2620 _listener.assertNoErrors(); | 3424 _listener.assertNoErrors(); |
| 2621 } | 3425 } |
| 2622 void test_visitMethodInvocation() { | 3426 void test_visitMethodInvocation() { |
| 2623 InterfaceType numType3 = _typeProvider.numType; | 3427 InterfaceType numType3 = _typeProvider.numType; |
| 2624 SimpleIdentifier left = ASTFactory.identifier2("i"); | 3428 SimpleIdentifier left = ASTFactory.identifier3("i"); |
| 2625 left.staticType = numType3; | 3429 left.staticType = numType3; |
| 2626 String methodName = "abs"; | 3430 String methodName = "abs"; |
| 2627 MethodInvocation invocation = ASTFactory.methodInvocation(left, methodName,
[]); | 3431 MethodInvocation invocation = ASTFactory.methodInvocation(left, methodName,
[]); |
| 2628 resolveNode(invocation, []); | 3432 resolveNode(invocation, []); |
| 2629 JUnitTestCase.assertSame(getMethod(numType3, methodName), invocation.methodN
ame.element); | 3433 JUnitTestCase.assertSame(getMethod(numType3, methodName), invocation.methodN
ame.element); |
| 2630 _listener.assertNoErrors(); | 3434 _listener.assertNoErrors(); |
| 2631 } | 3435 } |
| 2632 void test_visitMethodInvocation_namedParameter() { | 3436 void test_visitMethodInvocation_namedParameter() { |
| 2633 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 3437 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 2634 String methodName = "m"; | 3438 String methodName = "m"; |
| 2635 String parameterName = "p"; | 3439 String parameterName = "p"; |
| 2636 MethodElementImpl method = ElementFactory.methodElement(methodName, null, []
); | 3440 MethodElementImpl method = ElementFactory.methodElement(methodName, null, []
); |
| 2637 ParameterElement parameter = ElementFactory.namedParameter(parameterName); | 3441 ParameterElement parameter = ElementFactory.namedParameter(parameterName); |
| 2638 method.parameters = <ParameterElement> [parameter]; | 3442 method.parameters = <ParameterElement> [parameter]; |
| 2639 classA.methods = <MethodElement> [method]; | 3443 classA.methods = <MethodElement> [method]; |
| 2640 SimpleIdentifier left = ASTFactory.identifier2("i"); | 3444 SimpleIdentifier left = ASTFactory.identifier3("i"); |
| 2641 left.staticType = classA.type; | 3445 left.staticType = classA.type; |
| 2642 MethodInvocation invocation = ASTFactory.methodInvocation(left, methodName,
[ASTFactory.namedExpression(parameterName, ASTFactory.integer(0))]); | 3446 MethodInvocation invocation = ASTFactory.methodInvocation(left, methodName,
[ASTFactory.namedExpression2(parameterName, ASTFactory.integer(0))]); |
| 2643 resolveNode(invocation, []); | 3447 resolveNode(invocation, []); |
| 2644 JUnitTestCase.assertSame(method, invocation.methodName.element); | 3448 JUnitTestCase.assertSame(method, invocation.methodName.element); |
| 2645 JUnitTestCase.assertSame(parameter, ((invocation.argumentList.arguments[0] a
s NamedExpression)).name.label.element); | 3449 JUnitTestCase.assertSame(parameter, ((invocation.argumentList.arguments[0] a
s NamedExpression)).name.label.element); |
| 2646 _listener.assertNoErrors(); | 3450 _listener.assertNoErrors(); |
| 2647 } | 3451 } |
| 2648 void test_visitPostfixExpression() { | 3452 void test_visitPostfixExpression() { |
| 2649 InterfaceType numType4 = _typeProvider.numType; | 3453 InterfaceType numType4 = _typeProvider.numType; |
| 2650 SimpleIdentifier operand = ASTFactory.identifier2("i"); | 3454 SimpleIdentifier operand = ASTFactory.identifier3("i"); |
| 2651 operand.staticType = numType4; | 3455 operand.staticType = numType4; |
| 2652 PostfixExpression expression = ASTFactory.postfixExpression(operand, TokenTy
pe.PLUS_PLUS); | 3456 PostfixExpression expression = ASTFactory.postfixExpression(operand, TokenTy
pe.PLUS_PLUS); |
| 2653 resolveNode(expression, []); | 3457 resolveNode(expression, []); |
| 2654 JUnitTestCase.assertEquals(getMethod(numType4, "+"), expression.element); | 3458 JUnitTestCase.assertEquals(getMethod(numType4, "+"), expression.element); |
| 2655 _listener.assertNoErrors(); | 3459 _listener.assertNoErrors(); |
| 2656 } | 3460 } |
| 2657 void test_visitPrefixedIdentifier_dynamic() { | 3461 void test_visitPrefixedIdentifier_dynamic() { |
| 2658 Type2 dynamicType2 = _typeProvider.dynamicType; | 3462 Type2 dynamicType2 = _typeProvider.dynamicType; |
| 2659 SimpleIdentifier target = ASTFactory.identifier2("a"); | 3463 SimpleIdentifier target = ASTFactory.identifier3("a"); |
| 2660 VariableElementImpl variable = ElementFactory.localVariableElement(target); | 3464 VariableElementImpl variable = ElementFactory.localVariableElement(target); |
| 2661 variable.type = dynamicType2; | 3465 variable.type = dynamicType2; |
| 2662 target.element = variable; | 3466 target.element = variable; |
| 2663 target.staticType = dynamicType2; | 3467 target.staticType = dynamicType2; |
| 2664 PrefixedIdentifier identifier5 = ASTFactory.identifier(target, ASTFactory.id
entifier2("b")); | 3468 PrefixedIdentifier identifier6 = ASTFactory.identifier(target, ASTFactory.id
entifier3("b")); |
| 2665 resolveNode(identifier5, []); | 3469 resolveNode(identifier6, []); |
| 2666 JUnitTestCase.assertNull(identifier5.element); | 3470 JUnitTestCase.assertNull(identifier6.element); |
| 2667 JUnitTestCase.assertNull(identifier5.identifier.element); | 3471 JUnitTestCase.assertNull(identifier6.identifier.element); |
| 2668 _listener.assertNoErrors(); | 3472 _listener.assertNoErrors(); |
| 2669 } | 3473 } |
| 2670 void test_visitPrefixedIdentifier_nonDynamic() { | 3474 void test_visitPrefixedIdentifier_nonDynamic() { |
| 2671 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 3475 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 2672 String getterName = "b"; | 3476 String getterName = "b"; |
| 2673 PropertyAccessorElement getter = ElementFactory.getterElement(getterName, fa
lse, _typeProvider.intType); | 3477 PropertyAccessorElement getter = ElementFactory.getterElement(getterName, fa
lse, _typeProvider.intType); |
| 2674 classA.accessors = <PropertyAccessorElement> [getter]; | 3478 classA.accessors = <PropertyAccessorElement> [getter]; |
| 2675 SimpleIdentifier target = ASTFactory.identifier2("a"); | 3479 SimpleIdentifier target = ASTFactory.identifier3("a"); |
| 2676 VariableElementImpl variable = ElementFactory.localVariableElement(target); | 3480 VariableElementImpl variable = ElementFactory.localVariableElement(target); |
| 2677 variable.type = classA.type; | 3481 variable.type = classA.type; |
| 2678 target.element = variable; | 3482 target.element = variable; |
| 2679 target.staticType = classA.type; | 3483 target.staticType = classA.type; |
| 2680 PrefixedIdentifier identifier6 = ASTFactory.identifier(target, ASTFactory.id
entifier2(getterName)); | 3484 PrefixedIdentifier identifier7 = ASTFactory.identifier(target, ASTFactory.id
entifier3(getterName)); |
| 2681 resolveNode(identifier6, []); | 3485 resolveNode(identifier7, []); |
| 2682 JUnitTestCase.assertSame(getter, identifier6.element); | 3486 JUnitTestCase.assertSame(getter, identifier7.element); |
| 2683 JUnitTestCase.assertSame(getter, identifier6.identifier.element); | 3487 JUnitTestCase.assertSame(getter, identifier7.identifier.element); |
| 2684 _listener.assertNoErrors(); | 3488 _listener.assertNoErrors(); |
| 2685 } | 3489 } |
| 2686 void test_visitPrefixExpression() { | 3490 void test_visitPrefixExpression() { |
| 2687 InterfaceType numType5 = _typeProvider.numType; | 3491 InterfaceType numType5 = _typeProvider.numType; |
| 2688 SimpleIdentifier operand = ASTFactory.identifier2("i"); | 3492 SimpleIdentifier operand = ASTFactory.identifier3("i"); |
| 2689 operand.staticType = numType5; | 3493 operand.staticType = numType5; |
| 2690 PrefixExpression expression = ASTFactory.prefixExpression(TokenType.PLUS_PLU
S, operand); | 3494 PrefixExpression expression = ASTFactory.prefixExpression(TokenType.PLUS_PLU
S, operand); |
| 2691 resolveNode(expression, []); | 3495 resolveNode(expression, []); |
| 2692 JUnitTestCase.assertEquals(getMethod(numType5, "+"), expression.element); | 3496 JUnitTestCase.assertEquals(getMethod(numType5, "+"), expression.element); |
| 2693 _listener.assertNoErrors(); | 3497 _listener.assertNoErrors(); |
| 2694 } | 3498 } |
| 2695 void test_visitPropertyAccess_getter_identifier() { | 3499 void test_visitPropertyAccess_getter_identifier() { |
| 2696 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 3500 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 2697 String getterName = "b"; | 3501 String getterName = "b"; |
| 2698 PropertyAccessorElement getter = ElementFactory.getterElement(getterName, fa
lse, _typeProvider.intType); | 3502 PropertyAccessorElement getter = ElementFactory.getterElement(getterName, fa
lse, _typeProvider.intType); |
| 2699 classA.accessors = <PropertyAccessorElement> [getter]; | 3503 classA.accessors = <PropertyAccessorElement> [getter]; |
| 2700 SimpleIdentifier target = ASTFactory.identifier2("a"); | 3504 SimpleIdentifier target = ASTFactory.identifier3("a"); |
| 2701 target.staticType = classA.type; | 3505 target.staticType = classA.type; |
| 2702 PropertyAccess access = ASTFactory.propertyAccess2(target, getterName); | 3506 PropertyAccess access = ASTFactory.propertyAccess2(target, getterName); |
| 2703 resolveNode(access, []); | 3507 resolveNode(access, []); |
| 2704 JUnitTestCase.assertSame(getter, access.propertyName.element); | 3508 JUnitTestCase.assertSame(getter, access.propertyName.element); |
| 2705 _listener.assertNoErrors(); | 3509 _listener.assertNoErrors(); |
| 2706 } | 3510 } |
| 2707 void test_visitPropertyAccess_getter_super() { | 3511 void test_visitPropertyAccess_getter_super() { |
| 2708 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 3512 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 2709 String getterName = "b"; | 3513 String getterName = "b"; |
| 2710 PropertyAccessorElement getter = ElementFactory.getterElement(getterName, fa
lse, _typeProvider.intType); | 3514 PropertyAccessorElement getter = ElementFactory.getterElement(getterName, fa
lse, _typeProvider.intType); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2723 classA.accessors = <PropertyAccessorElement> [setter]; | 3527 classA.accessors = <PropertyAccessorElement> [setter]; |
| 2724 ThisExpression target = ASTFactory.thisExpression(); | 3528 ThisExpression target = ASTFactory.thisExpression(); |
| 2725 target.staticType = classA.type; | 3529 target.staticType = classA.type; |
| 2726 PropertyAccess access = ASTFactory.propertyAccess2(target, setterName); | 3530 PropertyAccess access = ASTFactory.propertyAccess2(target, setterName); |
| 2727 ASTFactory.assignmentExpression(access, TokenType.EQ, ASTFactory.integer(0))
; | 3531 ASTFactory.assignmentExpression(access, TokenType.EQ, ASTFactory.integer(0))
; |
| 2728 resolveNode(access, []); | 3532 resolveNode(access, []); |
| 2729 JUnitTestCase.assertSame(setter, access.propertyName.element); | 3533 JUnitTestCase.assertSame(setter, access.propertyName.element); |
| 2730 _listener.assertNoErrors(); | 3534 _listener.assertNoErrors(); |
| 2731 } | 3535 } |
| 2732 void test_visitSimpleIdentifier_classScope() { | 3536 void test_visitSimpleIdentifier_classScope() { |
| 2733 InterfaceType doubleType2 = _typeProvider.doubleType; | 3537 InterfaceType doubleType3 = _typeProvider.doubleType; |
| 2734 String fieldName = "NAN"; | 3538 String fieldName = "NAN"; |
| 2735 SimpleIdentifier node = ASTFactory.identifier2(fieldName); | 3539 SimpleIdentifier node = ASTFactory.identifier3(fieldName); |
| 2736 resolveInClass(node, doubleType2.element); | 3540 resolveInClass(node, doubleType3.element); |
| 2737 JUnitTestCase.assertEquals(getGetter(doubleType2, fieldName), node.element); | 3541 JUnitTestCase.assertEquals(getGetter(doubleType3, fieldName), node.element); |
| 2738 _listener.assertNoErrors(); | 3542 _listener.assertNoErrors(); |
| 2739 } | 3543 } |
| 2740 void test_visitSimpleIdentifier_lexicalScope() { | 3544 void test_visitSimpleIdentifier_lexicalScope() { |
| 2741 SimpleIdentifier node = ASTFactory.identifier2("i"); | 3545 SimpleIdentifier node = ASTFactory.identifier3("i"); |
| 2742 VariableElementImpl element = ElementFactory.localVariableElement(node); | 3546 VariableElementImpl element = ElementFactory.localVariableElement(node); |
| 2743 JUnitTestCase.assertSame(element, resolve3(node, [element])); | 3547 JUnitTestCase.assertSame(element, resolve3(node, [element])); |
| 2744 _listener.assertNoErrors(); | 3548 _listener.assertNoErrors(); |
| 2745 } | 3549 } |
| 2746 void test_visitSimpleIdentifier_lexicalScope_field_setter() { | 3550 void test_visitSimpleIdentifier_lexicalScope_field_setter() { |
| 2747 InterfaceType intType5 = _typeProvider.intType; | 3551 InterfaceType intType6 = _typeProvider.intType; |
| 2748 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 3552 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 2749 String fieldName = "a"; | 3553 String fieldName = "a"; |
| 2750 FieldElement field = ElementFactory.fieldElement(fieldName, false, false, fa
lse, intType5); | 3554 FieldElement field = ElementFactory.fieldElement(fieldName, false, false, fa
lse, intType6); |
| 2751 classA.fields = <FieldElement> [field]; | 3555 classA.fields = <FieldElement> [field]; |
| 2752 classA.accessors = <PropertyAccessorElement> [field.getter, field.setter]; | 3556 classA.accessors = <PropertyAccessorElement> [field.getter, field.setter]; |
| 2753 SimpleIdentifier node = ASTFactory.identifier2(fieldName); | 3557 SimpleIdentifier node = ASTFactory.identifier3(fieldName); |
| 2754 ASTFactory.assignmentExpression(node, TokenType.EQ, ASTFactory.integer(0)); | 3558 ASTFactory.assignmentExpression(node, TokenType.EQ, ASTFactory.integer(0)); |
| 2755 resolveInClass(node, classA); | 3559 resolveInClass(node, classA); |
| 2756 Element element56 = node.element; | 3560 Element element65 = node.element; |
| 2757 EngineTestCase.assertInstanceOf(PropertyAccessorElement, element56); | 3561 EngineTestCase.assertInstanceOf(PropertyAccessorElement, element65); |
| 2758 JUnitTestCase.assertTrue(((element56 as PropertyAccessorElement)).isSetter()
); | 3562 JUnitTestCase.assertTrue(((element65 as PropertyAccessorElement)).isSetter()
); |
| 2759 _listener.assertNoErrors(); | 3563 _listener.assertNoErrors(); |
| 2760 } | 3564 } |
| 2761 void test_visitSuperConstructorInvocation() { | 3565 void test_visitSuperConstructorInvocation() { |
| 2762 ClassElementImpl superclass = ElementFactory.classElement2("A", []); | 3566 ClassElementImpl superclass = ElementFactory.classElement2("A", []); |
| 2763 ConstructorElementImpl superConstructor = ElementFactory.constructorElement(
null); | 3567 ConstructorElementImpl superConstructor = ElementFactory.constructorElement(
null); |
| 2764 superclass.constructors = <ConstructorElement> [superConstructor]; | 3568 superclass.constructors = <ConstructorElement> [superConstructor]; |
| 2765 ClassElementImpl subclass = ElementFactory.classElement("B", superclass.type
, []); | 3569 ClassElementImpl subclass = ElementFactory.classElement("B", superclass.type
, []); |
| 2766 ConstructorElementImpl subConstructor = ElementFactory.constructorElement(nu
ll); | 3570 ConstructorElementImpl subConstructor = ElementFactory.constructorElement(nu
ll); |
| 2767 subclass.constructors = <ConstructorElement> [subConstructor]; | 3571 subclass.constructors = <ConstructorElement> [subConstructor]; |
| 2768 SuperConstructorInvocation invocation = ASTFactory.superConstructorInvocatio
n([]); | 3572 SuperConstructorInvocation invocation = ASTFactory.superConstructorInvocatio
n([]); |
| 2769 resolveInClass(invocation, subclass); | 3573 resolveInClass(invocation, subclass); |
| 2770 JUnitTestCase.assertEquals(superConstructor, invocation.element); | 3574 JUnitTestCase.assertEquals(superConstructor, invocation.element); |
| 2771 _listener.assertNoErrors(); | 3575 _listener.assertNoErrors(); |
| 2772 } | 3576 } |
| 2773 void test_visitSuperConstructorInvocation_namedParameter() { | 3577 void test_visitSuperConstructorInvocation_namedParameter() { |
| 2774 ClassElementImpl superclass = ElementFactory.classElement2("A", []); | 3578 ClassElementImpl superclass = ElementFactory.classElement2("A", []); |
| 2775 ConstructorElementImpl superConstructor = ElementFactory.constructorElement(
null); | 3579 ConstructorElementImpl superConstructor = ElementFactory.constructorElement(
null); |
| 2776 String parameterName = "p"; | 3580 String parameterName = "p"; |
| 2777 ParameterElement parameter = ElementFactory.namedParameter(parameterName); | 3581 ParameterElement parameter = ElementFactory.namedParameter(parameterName); |
| 2778 superConstructor.parameters = <ParameterElement> [parameter]; | 3582 superConstructor.parameters = <ParameterElement> [parameter]; |
| 2779 superclass.constructors = <ConstructorElement> [superConstructor]; | 3583 superclass.constructors = <ConstructorElement> [superConstructor]; |
| 2780 ClassElementImpl subclass = ElementFactory.classElement("B", superclass.type
, []); | 3584 ClassElementImpl subclass = ElementFactory.classElement("B", superclass.type
, []); |
| 2781 ConstructorElementImpl subConstructor = ElementFactory.constructorElement(nu
ll); | 3585 ConstructorElementImpl subConstructor = ElementFactory.constructorElement(nu
ll); |
| 2782 subclass.constructors = <ConstructorElement> [subConstructor]; | 3586 subclass.constructors = <ConstructorElement> [subConstructor]; |
| 2783 SuperConstructorInvocation invocation = ASTFactory.superConstructorInvocatio
n([ASTFactory.namedExpression(parameterName, ASTFactory.integer(0))]); | 3587 SuperConstructorInvocation invocation = ASTFactory.superConstructorInvocatio
n([ASTFactory.namedExpression2(parameterName, ASTFactory.integer(0))]); |
| 2784 resolveInClass(invocation, subclass); | 3588 resolveInClass(invocation, subclass); |
| 2785 JUnitTestCase.assertEquals(superConstructor, invocation.element); | 3589 JUnitTestCase.assertEquals(superConstructor, invocation.element); |
| 2786 JUnitTestCase.assertSame(parameter, ((invocation.argumentList.arguments[0] a
s NamedExpression)).name.label.element); | 3590 JUnitTestCase.assertSame(parameter, ((invocation.argumentList.arguments[0] a
s NamedExpression)).name.label.element); |
| 2787 _listener.assertNoErrors(); | 3591 _listener.assertNoErrors(); |
| 2788 } | 3592 } |
| 2789 /** | 3593 /** |
| 2790 * Create the resolver used by the tests. | 3594 * Create the resolver used by the tests. |
| 2791 * @return the resolver that was created | 3595 * @return the resolver that was created |
| 2792 */ | 3596 */ |
| 2793 ElementResolver createResolver() { | 3597 ElementResolver createResolver() { |
| 2794 AnalysisContextImpl context = new AnalysisContextImpl(); | 3598 AnalysisContextImpl context = new AnalysisContextImpl(); |
| 2795 SourceFactory sourceFactory = new SourceFactory.con2([new DartUriResolver(Da
rtSdk.defaultSdk)]); | 3599 ContentCache contentCache = new ContentCache(); |
| 3600 SourceFactory sourceFactory = new SourceFactory.con1(contentCache, [new Dart
UriResolver(DirectoryBasedDartSdk.defaultSdk)]); |
| 2796 context.sourceFactory = sourceFactory; | 3601 context.sourceFactory = sourceFactory; |
| 2797 FileBasedSource source = new FileBasedSource.con1(sourceFactory, FileUtiliti
es2.createFile("/test.dart")); | 3602 FileBasedSource source = new FileBasedSource.con1(contentCache, FileUtilitie
s2.createFile("/test.dart")); |
| 2798 CompilationUnitElementImpl definingCompilationUnit = new CompilationUnitElem
entImpl("test.dart"); | 3603 CompilationUnitElementImpl definingCompilationUnit = new CompilationUnitElem
entImpl("test.dart"); |
| 2799 definingCompilationUnit.source = source; | 3604 definingCompilationUnit.source = source; |
| 2800 _definingLibrary = ElementFactory.library(context, "test"); | 3605 _definingLibrary = ElementFactory.library(context, "test"); |
| 2801 _definingLibrary.definingCompilationUnit = definingCompilationUnit; | 3606 _definingLibrary.definingCompilationUnit = definingCompilationUnit; |
| 2802 Library library = new Library(context, _listener, source); | 3607 Library library = new Library(context, _listener, source); |
| 2803 library.libraryElement = _definingLibrary; | 3608 library.libraryElement = _definingLibrary; |
| 2804 _visitor = new ResolverVisitor(library, source, _typeProvider); | 3609 _visitor = new ResolverVisitor.con1(library, source, _typeProvider); |
| 2805 try { | 3610 try { |
| 2806 return _visitor.elementResolver_J2DAccessor as ElementResolver; | 3611 return _visitor.elementResolver_J2DAccessor as ElementResolver; |
| 2807 } catch (exception) { | 3612 } catch (exception) { |
| 2808 throw new IllegalArgumentException("Could not create resolver", exception)
; | 3613 throw new IllegalArgumentException("Could not create resolver", exception)
; |
| 2809 } | 3614 } |
| 2810 } | 3615 } |
| 2811 /** | 3616 /** |
| 2812 * Return the element associated with the label of the given statement after t
he resolver has | 3617 * Return the element associated with the label of the given statement after t
he resolver has |
| 2813 * resolved the statement. | 3618 * resolved the statement. |
| 2814 * @param statement the statement to be resolved | 3619 * @param statement the statement to be resolved |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3050 final __test = new ElementResolverTest(); | 3855 final __test = new ElementResolverTest(); |
| 3051 runJUnitTest(__test, __test.test_visitSuperConstructorInvocation); | 3856 runJUnitTest(__test, __test.test_visitSuperConstructorInvocation); |
| 3052 }); | 3857 }); |
| 3053 _ut.test('test_visitSuperConstructorInvocation_namedParameter', () { | 3858 _ut.test('test_visitSuperConstructorInvocation_namedParameter', () { |
| 3054 final __test = new ElementResolverTest(); | 3859 final __test = new ElementResolverTest(); |
| 3055 runJUnitTest(__test, __test.test_visitSuperConstructorInvocation_namedPa
rameter); | 3860 runJUnitTest(__test, __test.test_visitSuperConstructorInvocation_namedPa
rameter); |
| 3056 }); | 3861 }); |
| 3057 }); | 3862 }); |
| 3058 } | 3863 } |
| 3059 } | 3864 } |
| 3865 class TypeOverrideManagerTest extends EngineTestCase { |
| 3866 void test_exitScope_noScopes() { |
| 3867 TypeOverrideManager manager = new TypeOverrideManager(); |
| 3868 try { |
| 3869 manager.exitScope(); |
| 3870 JUnitTestCase.fail("Expected IllegalStateException"); |
| 3871 } on IllegalStateException catch (exception) { |
| 3872 } |
| 3873 } |
| 3874 void test_exitScope_oneScope() { |
| 3875 TypeOverrideManager manager = new TypeOverrideManager(); |
| 3876 manager.enterScope(); |
| 3877 manager.exitScope(); |
| 3878 try { |
| 3879 manager.exitScope(); |
| 3880 JUnitTestCase.fail("Expected IllegalStateException"); |
| 3881 } on IllegalStateException catch (exception) { |
| 3882 } |
| 3883 } |
| 3884 void test_exitScope_twoScopes() { |
| 3885 TypeOverrideManager manager = new TypeOverrideManager(); |
| 3886 manager.enterScope(); |
| 3887 manager.exitScope(); |
| 3888 manager.enterScope(); |
| 3889 manager.exitScope(); |
| 3890 try { |
| 3891 manager.exitScope(); |
| 3892 JUnitTestCase.fail("Expected IllegalStateException"); |
| 3893 } on IllegalStateException catch (exception) { |
| 3894 } |
| 3895 } |
| 3896 void test_getType_enclosedOverride() { |
| 3897 TypeOverrideManager manager = new TypeOverrideManager(); |
| 3898 LocalVariableElementImpl element = ElementFactory.localVariableElement2("v")
; |
| 3899 InterfaceType type30 = ElementFactory.classElement2("C", []).type; |
| 3900 manager.enterScope(); |
| 3901 manager.setType(element, type30); |
| 3902 manager.enterScope(); |
| 3903 JUnitTestCase.assertSame(type30, manager.getType(element)); |
| 3904 } |
| 3905 void test_getType_immediateOverride() { |
| 3906 TypeOverrideManager manager = new TypeOverrideManager(); |
| 3907 LocalVariableElementImpl element = ElementFactory.localVariableElement2("v")
; |
| 3908 InterfaceType type31 = ElementFactory.classElement2("C", []).type; |
| 3909 manager.enterScope(); |
| 3910 manager.setType(element, type31); |
| 3911 JUnitTestCase.assertSame(type31, manager.getType(element)); |
| 3912 } |
| 3913 void test_getType_noOverride() { |
| 3914 TypeOverrideManager manager = new TypeOverrideManager(); |
| 3915 manager.enterScope(); |
| 3916 JUnitTestCase.assertNull(manager.getType(ElementFactory.localVariableElement
2("v"))); |
| 3917 } |
| 3918 void test_getType_noScope() { |
| 3919 TypeOverrideManager manager = new TypeOverrideManager(); |
| 3920 JUnitTestCase.assertNull(manager.getType(ElementFactory.localVariableElement
2("v"))); |
| 3921 } |
| 3922 static dartSuite() { |
| 3923 _ut.group('TypeOverrideManagerTest', () { |
| 3924 _ut.test('test_exitScope_noScopes', () { |
| 3925 final __test = new TypeOverrideManagerTest(); |
| 3926 runJUnitTest(__test, __test.test_exitScope_noScopes); |
| 3927 }); |
| 3928 _ut.test('test_exitScope_oneScope', () { |
| 3929 final __test = new TypeOverrideManagerTest(); |
| 3930 runJUnitTest(__test, __test.test_exitScope_oneScope); |
| 3931 }); |
| 3932 _ut.test('test_exitScope_twoScopes', () { |
| 3933 final __test = new TypeOverrideManagerTest(); |
| 3934 runJUnitTest(__test, __test.test_exitScope_twoScopes); |
| 3935 }); |
| 3936 _ut.test('test_getType_enclosedOverride', () { |
| 3937 final __test = new TypeOverrideManagerTest(); |
| 3938 runJUnitTest(__test, __test.test_getType_enclosedOverride); |
| 3939 }); |
| 3940 _ut.test('test_getType_immediateOverride', () { |
| 3941 final __test = new TypeOverrideManagerTest(); |
| 3942 runJUnitTest(__test, __test.test_getType_immediateOverride); |
| 3943 }); |
| 3944 _ut.test('test_getType_noOverride', () { |
| 3945 final __test = new TypeOverrideManagerTest(); |
| 3946 runJUnitTest(__test, __test.test_getType_noOverride); |
| 3947 }); |
| 3948 _ut.test('test_getType_noScope', () { |
| 3949 final __test = new TypeOverrideManagerTest(); |
| 3950 runJUnitTest(__test, __test.test_getType_noScope); |
| 3951 }); |
| 3952 }); |
| 3953 } |
| 3954 } |
| 3060 class StaticWarningCodeTest extends ResolverTestCase { | 3955 class StaticWarningCodeTest extends ResolverTestCase { |
| 3061 void fail_argumentTypeNotAssignable() { | 3956 void fail_argumentTypeNotAssignable() { |
| 3062 Source source = addSource("/test.dart", EngineTestCase.createSource([])); | 3957 Source source = addSource("/test.dart", EngineTestCase.createSource([])); |
| 3063 resolve(source, []); | 3958 resolve(source, []); |
| 3064 assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); | 3959 assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); |
| 3065 verify([source]); | 3960 verify([source]); |
| 3066 } | 3961 } |
| 3067 void fail_assignmentToFinal() { | 3962 void fail_assignmentToFinal() { |
| 3068 Source source = addSource("/test.dart", EngineTestCase.createSource(["final
x = 0;", "f() { x = 1; }"])); | 3963 Source source = addSource("/test.dart", EngineTestCase.createSource(["final
x = 0;", "f() { x = 1; }"])); |
| 3069 resolve(source, []); | 3964 resolve(source, []); |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3285 resolve(source, []); | 4180 resolve(source, []); |
| 3286 assertErrors([StaticWarningCode.RETURN_WITHOUT_VALUE]); | 4181 assertErrors([StaticWarningCode.RETURN_WITHOUT_VALUE]); |
| 3287 verify([source]); | 4182 verify([source]); |
| 3288 } | 4183 } |
| 3289 void fail_switchExpressionNotAssignable() { | 4184 void fail_switchExpressionNotAssignable() { |
| 3290 Source source = addSource("/test.dart", EngineTestCase.createSource(["f(int
p) {", " switch (p) {", " case 'a': break;", " }", "}"])); | 4185 Source source = addSource("/test.dart", EngineTestCase.createSource(["f(int
p) {", " switch (p) {", " case 'a': break;", " }", "}"])); |
| 3291 resolve(source, []); | 4186 resolve(source, []); |
| 3292 assertErrors([StaticWarningCode.SWITCH_EXPRESSION_NOT_ASSIGNABLE]); | 4187 assertErrors([StaticWarningCode.SWITCH_EXPRESSION_NOT_ASSIGNABLE]); |
| 3293 verify([source]); | 4188 verify([source]); |
| 3294 } | 4189 } |
| 3295 void fail_undefinedClass() { | |
| 3296 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {
C.m(); }"])); | |
| 3297 resolve(source, []); | |
| 3298 assertErrors([StaticWarningCode.UNDEFINED_CLASS]); | |
| 3299 verify([source]); | |
| 3300 } | |
| 3301 void fail_undefinedGetter() { | 4190 void fail_undefinedGetter() { |
| 3302 Source source = addSource("/test.dart", EngineTestCase.createSource([])); | 4191 Source source = addSource("/test.dart", EngineTestCase.createSource([])); |
| 3303 resolve(source, []); | 4192 resolve(source, []); |
| 3304 assertErrors([StaticWarningCode.UNDEFINED_GETTER]); | 4193 assertErrors([StaticWarningCode.UNDEFINED_GETTER]); |
| 3305 verify([source]); | 4194 verify([source]); |
| 3306 } | 4195 } |
| 3307 void fail_undefinedIdentifier_function() { | 4196 void fail_undefinedIdentifier_function() { |
| 3308 Source source = addSource("/test.dart", EngineTestCase.createSource(["int a(
) -> b;"])); | 4197 Source source = addSource("/test.dart", EngineTestCase.createSource(["int a(
) -> b;"])); |
| 3309 resolve(source, []); | 4198 resolve(source, []); |
| 3310 assertErrors([StaticWarningCode.UNDEFINED_IDENTIFIER]); | 4199 assertErrors([StaticWarningCode.UNDEFINED_IDENTIFIER]); |
| 3311 verify([source]); | 4200 verify([source]); |
| 3312 } | 4201 } |
| 3313 void fail_undefinedIdentifier_initializer() { | |
| 3314 Source source = addSource("/test.dart", EngineTestCase.createSource(["var a
= b;"])); | |
| 3315 resolve(source, []); | |
| 3316 assertErrors([StaticWarningCode.UNDEFINED_IDENTIFIER]); | |
| 3317 verify([source]); | |
| 3318 } | |
| 3319 void fail_undefinedSetter() { | 4202 void fail_undefinedSetter() { |
| 3320 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
C {}", "f(var p) {", " C.m = 0;", "}"])); | 4203 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
C {}", "f(var p) {", " C.m = 0;", "}"])); |
| 3321 resolve(source, []); | 4204 resolve(source, []); |
| 3322 assertErrors([StaticWarningCode.UNDEFINED_SETTER]); | 4205 assertErrors([StaticWarningCode.UNDEFINED_SETTER]); |
| 3323 verify([source]); | 4206 verify([source]); |
| 3324 } | 4207 } |
| 3325 void fail_undefinedStaticMethodOrGetter_getter() { | 4208 void fail_undefinedStaticMethodOrGetter_getter() { |
| 3326 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
C {}", "f(var p) {", " f(C.m);", "}"])); | 4209 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
C {}", "f(var p) {", " f(C.m);", "}"])); |
| 3327 resolve(source, []); | 4210 resolve(source, []); |
| 3328 assertErrors([StaticWarningCode.UNDEFINED_STATIC_METHOD_OR_GETTER]); | 4211 assertErrors([StaticWarningCode.UNDEFINED_STATIC_METHOD_OR_GETTER]); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 3352 assertErrors([StaticWarningCode.NEW_WITH_ABSTRACT_CLASS]); | 4235 assertErrors([StaticWarningCode.NEW_WITH_ABSTRACT_CLASS]); |
| 3353 verify([source]); | 4236 verify([source]); |
| 3354 } | 4237 } |
| 3355 void test_partOfDifferentLibrary() { | 4238 void test_partOfDifferentLibrary() { |
| 3356 Source source = addSource("/test.dart", EngineTestCase.createSource(["librar
y lib;", "part 'part.dart';"])); | 4239 Source source = addSource("/test.dart", EngineTestCase.createSource(["librar
y lib;", "part 'part.dart';"])); |
| 3357 addSource("/part.dart", EngineTestCase.createSource(["part of lub;"])); | 4240 addSource("/part.dart", EngineTestCase.createSource(["part of lub;"])); |
| 3358 resolve(source, []); | 4241 resolve(source, []); |
| 3359 assertErrors([StaticWarningCode.PART_OF_DIFFERENT_LIBRARY]); | 4242 assertErrors([StaticWarningCode.PART_OF_DIFFERENT_LIBRARY]); |
| 3360 verify([source]); | 4243 verify([source]); |
| 3361 } | 4244 } |
| 4245 void test_undefinedClass_instanceCreation() { |
| 4246 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {
new C(); }"])); |
| 4247 resolve(source, []); |
| 4248 assertErrors([StaticWarningCode.UNDEFINED_CLASS]); |
| 4249 } |
| 4250 void test_undefinedClass_variableDeclaration() { |
| 4251 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {
C c; }"])); |
| 4252 resolve(source, []); |
| 4253 assertErrors([StaticWarningCode.UNDEFINED_CLASS]); |
| 4254 } |
| 4255 void test_undefinedIdentifier_initializer() { |
| 4256 Source source = addSource("/test.dart", EngineTestCase.createSource(["var a
= b;"])); |
| 4257 resolve(source, []); |
| 4258 assertErrors([StaticWarningCode.UNDEFINED_IDENTIFIER]); |
| 4259 } |
| 4260 void test_undefinedIdentifier_methodInvocation() { |
| 4261 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {
C.m(); }"])); |
| 4262 resolve(source, []); |
| 4263 assertErrors([StaticWarningCode.UNDEFINED_IDENTIFIER]); |
| 4264 } |
| 3362 static dartSuite() { | 4265 static dartSuite() { |
| 3363 _ut.group('StaticWarningCodeTest', () { | 4266 _ut.group('StaticWarningCodeTest', () { |
| 3364 _ut.test('test_constWithAbstractClass', () { | 4267 _ut.test('test_constWithAbstractClass', () { |
| 3365 final __test = new StaticWarningCodeTest(); | 4268 final __test = new StaticWarningCodeTest(); |
| 3366 runJUnitTest(__test, __test.test_constWithAbstractClass); | 4269 runJUnitTest(__test, __test.test_constWithAbstractClass); |
| 3367 }); | 4270 }); |
| 3368 _ut.test('test_equalKeysInMap', () { | 4271 _ut.test('test_equalKeysInMap', () { |
| 3369 final __test = new StaticWarningCodeTest(); | 4272 final __test = new StaticWarningCodeTest(); |
| 3370 runJUnitTest(__test, __test.test_equalKeysInMap); | 4273 runJUnitTest(__test, __test.test_equalKeysInMap); |
| 3371 }); | 4274 }); |
| 3372 _ut.test('test_newWithAbstractClass', () { | 4275 _ut.test('test_newWithAbstractClass', () { |
| 3373 final __test = new StaticWarningCodeTest(); | 4276 final __test = new StaticWarningCodeTest(); |
| 3374 runJUnitTest(__test, __test.test_newWithAbstractClass); | 4277 runJUnitTest(__test, __test.test_newWithAbstractClass); |
| 3375 }); | 4278 }); |
| 3376 _ut.test('test_partOfDifferentLibrary', () { | 4279 _ut.test('test_partOfDifferentLibrary', () { |
| 3377 final __test = new StaticWarningCodeTest(); | 4280 final __test = new StaticWarningCodeTest(); |
| 3378 runJUnitTest(__test, __test.test_partOfDifferentLibrary); | 4281 runJUnitTest(__test, __test.test_partOfDifferentLibrary); |
| 3379 }); | 4282 }); |
| 4283 _ut.test('test_undefinedClass_instanceCreation', () { |
| 4284 final __test = new StaticWarningCodeTest(); |
| 4285 runJUnitTest(__test, __test.test_undefinedClass_instanceCreation); |
| 4286 }); |
| 4287 _ut.test('test_undefinedClass_variableDeclaration', () { |
| 4288 final __test = new StaticWarningCodeTest(); |
| 4289 runJUnitTest(__test, __test.test_undefinedClass_variableDeclaration); |
| 4290 }); |
| 4291 _ut.test('test_undefinedIdentifier_initializer', () { |
| 4292 final __test = new StaticWarningCodeTest(); |
| 4293 runJUnitTest(__test, __test.test_undefinedIdentifier_initializer); |
| 4294 }); |
| 4295 _ut.test('test_undefinedIdentifier_methodInvocation', () { |
| 4296 final __test = new StaticWarningCodeTest(); |
| 4297 runJUnitTest(__test, __test.test_undefinedIdentifier_methodInvocation); |
| 4298 }); |
| 3380 }); | 4299 }); |
| 3381 } | 4300 } |
| 3382 } | 4301 } |
| 3383 class ErrorResolverTest extends ResolverTestCase { | 4302 class ErrorResolverTest extends ResolverTestCase { |
| 3384 void test_breakLabelOnSwitchMember() { | 4303 void test_breakLabelOnSwitchMember() { |
| 3385 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " void m(int i) {", " switch (i) {", " l: case 0:", " brea
k;", " case 1:", " break l;", " }", " }", "}"])); | 4304 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " void m(int i) {", " switch (i) {", " l: case 0:", " brea
k;", " case 1:", " break l;", " }", " }", "}"])); |
| 3386 resolve(source, []); | 4305 resolve(source, []); |
| 3387 assertErrors([ResolverErrorCode.BREAK_LABEL_ON_SWITCH_MEMBER]); | 4306 assertErrors([ResolverErrorCode.BREAK_LABEL_ON_SWITCH_MEMBER]); |
| 3388 verify([source]); | 4307 verify([source]); |
| 3389 } | 4308 } |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3588 * The class {@code AnalysisContextFactory} defines utility methods used to crea
te analysis contexts | 4507 * The class {@code AnalysisContextFactory} defines utility methods used to crea
te analysis contexts |
| 3589 * for testing purposes. | 4508 * for testing purposes. |
| 3590 */ | 4509 */ |
| 3591 class AnalysisContextFactory { | 4510 class AnalysisContextFactory { |
| 3592 /** | 4511 /** |
| 3593 * Create an analysis context that has a fake core library already resolved. | 4512 * Create an analysis context that has a fake core library already resolved. |
| 3594 * @return the analysis context that was created | 4513 * @return the analysis context that was created |
| 3595 */ | 4514 */ |
| 3596 static AnalysisContextImpl contextWithCore() { | 4515 static AnalysisContextImpl contextWithCore() { |
| 3597 AnalysisContextImpl context = new AnalysisContextImpl(); | 4516 AnalysisContextImpl context = new AnalysisContextImpl(); |
| 3598 SourceFactory sourceFactory = new SourceFactory.con2([new DartUriResolver(Da
rtSdk.defaultSdk), new FileUriResolver()]); | 4517 SourceFactory sourceFactory = new SourceFactory.con2([new DartUriResolver(Di
rectoryBasedDartSdk.defaultSdk), new FileUriResolver()]); |
| 3599 context.sourceFactory = sourceFactory; | 4518 context.sourceFactory = sourceFactory; |
| 3600 TestTypeProvider provider = new TestTypeProvider(); | 4519 TestTypeProvider provider = new TestTypeProvider(); |
| 3601 CompilationUnitElementImpl coreUnit = new CompilationUnitElementImpl("core.d
art"); | 4520 CompilationUnitElementImpl coreUnit = new CompilationUnitElementImpl("core.d
art"); |
| 3602 Source coreSource = sourceFactory.forUri(DartSdk.DART_CORE); | 4521 Source coreSource = sourceFactory.forUri(DartSdk.DART_CORE); |
| 3603 coreUnit.source = coreSource; | 4522 coreUnit.source = coreSource; |
| 3604 coreUnit.types = <ClassElement> [provider.boolType.element, provider.doubleT
ype.element, provider.functionType.element, provider.intType.element, provider.l
istType.element, provider.mapType.element, provider.numType.element, provider.ob
jectType.element, provider.stackTraceType.element, provider.stringType.element,
provider.typeType.element]; | 4523 coreUnit.types = <ClassElement> [provider.boolType.element, provider.doubleT
ype.element, provider.functionType.element, provider.intType.element, provider.l
istType.element, provider.mapType.element, provider.numType.element, provider.ob
jectType.element, provider.stackTraceType.element, provider.stringType.element,
provider.typeType.element]; |
| 3605 LibraryElementImpl coreLibrary = new LibraryElementImpl(context, ASTFactory.
libraryIdentifier2(["dart", "core"])); | 4524 LibraryElementImpl coreLibrary = new LibraryElementImpl(context, ASTFactory.
libraryIdentifier2(["dart", "core"])); |
| 3606 coreLibrary.definingCompilationUnit = coreUnit; | 4525 coreLibrary.definingCompilationUnit = coreUnit; |
| 3607 CompilationUnitElementImpl htmlUnit = new CompilationUnitElementImpl("html_d
artium.dart"); | 4526 CompilationUnitElementImpl htmlUnit = new CompilationUnitElementImpl("html_d
artium.dart"); |
| 3608 Source htmlSource = sourceFactory.forUri(DartSdk.DART_HTML); | 4527 Source htmlSource = sourceFactory.forUri(DartSdk.DART_HTML); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 3622 */ | 4541 */ |
| 3623 AnalysisContextFactory() { | 4542 AnalysisContextFactory() { |
| 3624 } | 4543 } |
| 3625 } | 4544 } |
| 3626 class LibraryImportScopeTest extends ResolverTestCase { | 4545 class LibraryImportScopeTest extends ResolverTestCase { |
| 3627 void test_conflictingImports() { | 4546 void test_conflictingImports() { |
| 3628 AnalysisContext context = new AnalysisContextImpl(); | 4547 AnalysisContext context = new AnalysisContextImpl(); |
| 3629 String typeNameA = "A"; | 4548 String typeNameA = "A"; |
| 3630 String typeNameB = "B"; | 4549 String typeNameB = "B"; |
| 3631 String typeNameC = "C"; | 4550 String typeNameC = "C"; |
| 3632 ClassElement typeA = new ClassElementImpl(ASTFactory.identifier2(typeNameA))
; | 4551 ClassElement typeA = new ClassElementImpl(ASTFactory.identifier3(typeNameA))
; |
| 3633 ClassElement typeB1 = new ClassElementImpl(ASTFactory.identifier2(typeNameB)
); | 4552 ClassElement typeB1 = new ClassElementImpl(ASTFactory.identifier3(typeNameB)
); |
| 3634 ClassElement typeB2 = new ClassElementImpl(ASTFactory.identifier2(typeNameB)
); | 4553 ClassElement typeB2 = new ClassElementImpl(ASTFactory.identifier3(typeNameB)
); |
| 3635 ClassElement typeC = new ClassElementImpl(ASTFactory.identifier2(typeNameC))
; | 4554 ClassElement typeC = new ClassElementImpl(ASTFactory.identifier3(typeNameC))
; |
| 3636 LibraryElement importedLibrary1 = createTestLibrary2(context, "imported1", [
]); | 4555 LibraryElement importedLibrary1 = createTestLibrary2(context, "imported1", [
]); |
| 3637 ((importedLibrary1.definingCompilationUnit as CompilationUnitElementImpl)).t
ypes = <ClassElement> [typeA, typeB1]; | 4556 ((importedLibrary1.definingCompilationUnit as CompilationUnitElementImpl)).t
ypes = <ClassElement> [typeA, typeB1]; |
| 3638 ImportElementImpl import1 = new ImportElementImpl(); | 4557 ImportElementImpl import1 = new ImportElementImpl(); |
| 3639 import1.importedLibrary = importedLibrary1; | 4558 import1.importedLibrary = importedLibrary1; |
| 3640 LibraryElement importedLibrary2 = createTestLibrary2(context, "imported2", [
]); | 4559 LibraryElement importedLibrary2 = createTestLibrary2(context, "imported2", [
]); |
| 3641 ((importedLibrary2.definingCompilationUnit as CompilationUnitElementImpl)).t
ypes = <ClassElement> [typeB2, typeC]; | 4560 ((importedLibrary2.definingCompilationUnit as CompilationUnitElementImpl)).t
ypes = <ClassElement> [typeB2, typeC]; |
| 3642 ImportElementImpl import2 = new ImportElementImpl(); | 4561 ImportElementImpl import2 = new ImportElementImpl(); |
| 3643 import2.importedLibrary = importedLibrary2; | 4562 import2.importedLibrary = importedLibrary2; |
| 3644 LibraryElementImpl importingLibrary = createTestLibrary2(context, "importing
", []); | 4563 LibraryElementImpl importingLibrary = createTestLibrary2(context, "importing
", []); |
| 3645 importingLibrary.imports = <ImportElement> [import1, import2]; | 4564 importingLibrary.imports = <ImportElement> [import1, import2]; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 3658 JUnitTestCase.assertEquals(2, conflictingElements2.length); | 4577 JUnitTestCase.assertEquals(2, conflictingElements2.length); |
| 3659 } | 4578 } |
| 3660 void test_creation_empty() { | 4579 void test_creation_empty() { |
| 3661 LibraryElement definingLibrary = createTestLibrary(); | 4580 LibraryElement definingLibrary = createTestLibrary(); |
| 3662 GatheringErrorListener errorListener = new GatheringErrorListener(); | 4581 GatheringErrorListener errorListener = new GatheringErrorListener(); |
| 3663 new LibraryImportScope(definingLibrary, errorListener); | 4582 new LibraryImportScope(definingLibrary, errorListener); |
| 3664 } | 4583 } |
| 3665 void test_creation_nonEmpty() { | 4584 void test_creation_nonEmpty() { |
| 3666 AnalysisContext context = new AnalysisContextImpl(); | 4585 AnalysisContext context = new AnalysisContextImpl(); |
| 3667 String importedTypeName = "A"; | 4586 String importedTypeName = "A"; |
| 3668 ClassElement importedType = new ClassElementImpl(ASTFactory.identifier2(impo
rtedTypeName)); | 4587 ClassElement importedType = new ClassElementImpl(ASTFactory.identifier3(impo
rtedTypeName)); |
| 3669 LibraryElement importedLibrary = createTestLibrary2(context, "imported", [])
; | 4588 LibraryElement importedLibrary = createTestLibrary2(context, "imported", [])
; |
| 3670 ((importedLibrary.definingCompilationUnit as CompilationUnitElementImpl)).ty
pes = <ClassElement> [importedType]; | 4589 ((importedLibrary.definingCompilationUnit as CompilationUnitElementImpl)).ty
pes = <ClassElement> [importedType]; |
| 3671 LibraryElementImpl definingLibrary = createTestLibrary2(context, "importing"
, []); | 4590 LibraryElementImpl definingLibrary = createTestLibrary2(context, "importing"
, []); |
| 3672 ImportElementImpl importElement = new ImportElementImpl(); | 4591 ImportElementImpl importElement = new ImportElementImpl(); |
| 3673 importElement.importedLibrary = importedLibrary; | 4592 importElement.importedLibrary = importedLibrary; |
| 3674 definingLibrary.imports = <ImportElement> [importElement]; | 4593 definingLibrary.imports = <ImportElement> [importElement]; |
| 3675 GatheringErrorListener errorListener = new GatheringErrorListener(); | 4594 GatheringErrorListener errorListener = new GatheringErrorListener(); |
| 3676 Scope scope = new LibraryImportScope(definingLibrary, errorListener); | 4595 Scope scope = new LibraryImportScope(definingLibrary, errorListener); |
| 3677 JUnitTestCase.assertEquals(importedType, scope.lookup3(importedTypeName, def
iningLibrary)); | 4596 JUnitTestCase.assertEquals(importedType, scope.lookup3(importedTypeName, def
iningLibrary)); |
| 3678 } | 4597 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3729 List<ASTNode> _unresolvedNodes = new List<ASTNode>(); | 4648 List<ASTNode> _unresolvedNodes = new List<ASTNode>(); |
| 3730 /** | 4649 /** |
| 3731 * A list containing all of the AST nodes that were resolved to an element of
the wrong type. | 4650 * A list containing all of the AST nodes that were resolved to an element of
the wrong type. |
| 3732 */ | 4651 */ |
| 3733 List<ASTNode> _wrongTypedNodes = new List<ASTNode>(); | 4652 List<ASTNode> _wrongTypedNodes = new List<ASTNode>(); |
| 3734 /** | 4653 /** |
| 3735 * Initialize a newly created verifier to verify that all of the nodes in the
visited AST | 4654 * Initialize a newly created verifier to verify that all of the nodes in the
visited AST |
| 3736 * structures that are expected to have been resolved have an element associat
ed with them. | 4655 * structures that are expected to have been resolved have an element associat
ed with them. |
| 3737 */ | 4656 */ |
| 3738 ResolutionVerifier() { | 4657 ResolutionVerifier() { |
| 3739 _jtd_constructor_323_impl(); | 4658 _jtd_constructor_349_impl(); |
| 3740 } | 4659 } |
| 3741 _jtd_constructor_323_impl() { | 4660 _jtd_constructor_349_impl() { |
| 3742 _jtd_constructor_324_impl(null); | 4661 _jtd_constructor_350_impl(null); |
| 3743 } | 4662 } |
| 3744 /** | 4663 /** |
| 3745 * Initialize a newly created verifier to verify that all of the identifiers i
n the visited AST | 4664 * Initialize a newly created verifier to verify that all of the identifiers i
n the visited AST |
| 3746 * structures that are expected to have been resolved have an element associat
ed with them. Nodes | 4665 * structures that are expected to have been resolved have an element associat
ed with them. Nodes |
| 3747 * in the set of known exceptions are not expected to have been resolved, even
if they normally | 4666 * in the set of known exceptions are not expected to have been resolved, even
if they normally |
| 3748 * would have been expected to have been resolved. | 4667 * would have been expected to have been resolved. |
| 3749 * @param knownExceptions a set containing nodes that are known to not be reso
lvable and should | 4668 * @param knownExceptions a set containing nodes that are known to not be reso
lvable and should |
| 3750 * therefore not cause the test to fail | 4669 * therefore not cause the test to fail |
| 3751 */ | 4670 */ |
| 3752 ResolutionVerifier.con1(Set<ASTNode> knownExceptions2) { | 4671 ResolutionVerifier.con1(Set<ASTNode> knownExceptions2) { |
| 3753 _jtd_constructor_324_impl(knownExceptions2); | 4672 _jtd_constructor_350_impl(knownExceptions2); |
| 3754 } | 4673 } |
| 3755 _jtd_constructor_324_impl(Set<ASTNode> knownExceptions2) { | 4674 _jtd_constructor_350_impl(Set<ASTNode> knownExceptions2) { |
| 3756 this._knownExceptions = knownExceptions2; | 4675 this._knownExceptions = knownExceptions2; |
| 3757 } | 4676 } |
| 3758 /** | 4677 /** |
| 3759 * Assert that all of the visited identifiers were resolved. | 4678 * Assert that all of the visited identifiers were resolved. |
| 3760 */ | 4679 */ |
| 3761 void assertResolved() { | 4680 void assertResolved() { |
| 3762 if (!_unresolvedNodes.isEmpty || !_wrongTypedNodes.isEmpty) { | 4681 if (!_unresolvedNodes.isEmpty || !_wrongTypedNodes.isEmpty) { |
| 3763 PrintStringWriter writer = new PrintStringWriter(); | 4682 PrintStringWriter writer = new PrintStringWriter(); |
| 3764 if (!_unresolvedNodes.isEmpty) { | 4683 if (!_unresolvedNodes.isEmpty) { |
| 3765 writer.print("Failed to resolve "); | 4684 writer.print("Failed to resolve "); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 3794 _wrongTypedNodes.add(node); | 4713 _wrongTypedNodes.add(node); |
| 3795 } | 4714 } |
| 3796 return null; | 4715 return null; |
| 3797 } | 4716 } |
| 3798 Object visitFunctionExpressionInvocation(FunctionExpressionInvocation node) { | 4717 Object visitFunctionExpressionInvocation(FunctionExpressionInvocation node) { |
| 3799 node.visitChildren(this); | 4718 node.visitChildren(this); |
| 3800 return checkResolved2(node, node.element, FunctionElement); | 4719 return checkResolved2(node, node.element, FunctionElement); |
| 3801 } | 4720 } |
| 3802 Object visitImportDirective(ImportDirective node) { | 4721 Object visitImportDirective(ImportDirective node) { |
| 3803 checkResolved2(node, node.element, ImportElement); | 4722 checkResolved2(node, node.element, ImportElement); |
| 3804 SimpleIdentifier prefix10 = node.prefix; | 4723 SimpleIdentifier prefix9 = node.prefix; |
| 3805 if (prefix10 == null) { | 4724 if (prefix9 == null) { |
| 3806 return null; | 4725 return null; |
| 3807 } | 4726 } |
| 3808 return checkResolved2(prefix10, prefix10.element, PrefixElement); | 4727 return checkResolved2(prefix9, prefix9.element, PrefixElement); |
| 3809 } | 4728 } |
| 3810 Object visitIndexExpression(IndexExpression node) { | 4729 Object visitIndexExpression(IndexExpression node) { |
| 3811 node.visitChildren(this); | 4730 node.visitChildren(this); |
| 3812 return checkResolved2(node, node.element, MethodElement); | 4731 return checkResolved2(node, node.element, MethodElement); |
| 3813 } | 4732 } |
| 3814 Object visitLibraryDirective(LibraryDirective node) => checkResolved2(node, no
de.element, LibraryElement); | 4733 Object visitLibraryDirective(LibraryDirective node) => checkResolved2(node, no
de.element, LibraryElement); |
| 3815 Object visitPartDirective(PartDirective node) => checkResolved2(node, node.ele
ment, CompilationUnitElement); | 4734 Object visitPartDirective(PartDirective node) => checkResolved2(node, node.ele
ment, CompilationUnitElement); |
| 3816 Object visitPartOfDirective(PartOfDirective node) => checkResolved2(node, node
.element, LibraryElement); | 4735 Object visitPartOfDirective(PartOfDirective node) => checkResolved2(node, node
.element, LibraryElement); |
| 3817 Object visitPostfixExpression(PostfixExpression node) { | 4736 Object visitPostfixExpression(PostfixExpression node) { |
| 3818 node.visitChildren(this); | 4737 node.visitChildren(this); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3880 } | 4799 } |
| 3881 class LibraryScopeTest extends ResolverTestCase { | 4800 class LibraryScopeTest extends ResolverTestCase { |
| 3882 void test_creation_empty() { | 4801 void test_creation_empty() { |
| 3883 LibraryElement definingLibrary = createTestLibrary(); | 4802 LibraryElement definingLibrary = createTestLibrary(); |
| 3884 GatheringErrorListener errorListener = new GatheringErrorListener(); | 4803 GatheringErrorListener errorListener = new GatheringErrorListener(); |
| 3885 new LibraryScope(definingLibrary, errorListener); | 4804 new LibraryScope(definingLibrary, errorListener); |
| 3886 } | 4805 } |
| 3887 void test_creation_nonEmpty() { | 4806 void test_creation_nonEmpty() { |
| 3888 AnalysisContext context = new AnalysisContextImpl(); | 4807 AnalysisContext context = new AnalysisContextImpl(); |
| 3889 String importedTypeName = "A"; | 4808 String importedTypeName = "A"; |
| 3890 ClassElement importedType = new ClassElementImpl(ASTFactory.identifier2(impo
rtedTypeName)); | 4809 ClassElement importedType = new ClassElementImpl(ASTFactory.identifier3(impo
rtedTypeName)); |
| 3891 LibraryElement importedLibrary = createTestLibrary2(context, "imported", [])
; | 4810 LibraryElement importedLibrary = createTestLibrary2(context, "imported", [])
; |
| 3892 ((importedLibrary.definingCompilationUnit as CompilationUnitElementImpl)).ty
pes = <ClassElement> [importedType]; | 4811 ((importedLibrary.definingCompilationUnit as CompilationUnitElementImpl)).ty
pes = <ClassElement> [importedType]; |
| 3893 LibraryElementImpl definingLibrary = createTestLibrary2(context, "importing"
, []); | 4812 LibraryElementImpl definingLibrary = createTestLibrary2(context, "importing"
, []); |
| 3894 ImportElementImpl importElement = new ImportElementImpl(); | 4813 ImportElementImpl importElement = new ImportElementImpl(); |
| 3895 importElement.importedLibrary = importedLibrary; | 4814 importElement.importedLibrary = importedLibrary; |
| 3896 definingLibrary.imports = <ImportElement> [importElement]; | 4815 definingLibrary.imports = <ImportElement> [importElement]; |
| 3897 GatheringErrorListener errorListener = new GatheringErrorListener(); | 4816 GatheringErrorListener errorListener = new GatheringErrorListener(); |
| 3898 Scope scope = new LibraryScope(definingLibrary, errorListener); | 4817 Scope scope = new LibraryScope(definingLibrary, errorListener); |
| 3899 JUnitTestCase.assertEquals(importedType, scope.lookup3(importedTypeName, def
iningLibrary)); | 4818 JUnitTestCase.assertEquals(importedType, scope.lookup3(importedTypeName, def
iningLibrary)); |
| 3900 } | 4819 } |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3981 } | 4900 } |
| 3982 void test_visitAssignmentExpression_compound() { | 4901 void test_visitAssignmentExpression_compound() { |
| 3983 InterfaceType numType6 = _typeProvider.numType; | 4902 InterfaceType numType6 = _typeProvider.numType; |
| 3984 SimpleIdentifier identifier = resolvedVariable(_typeProvider.intType, "i"); | 4903 SimpleIdentifier identifier = resolvedVariable(_typeProvider.intType, "i"); |
| 3985 AssignmentExpression node = ASTFactory.assignmentExpression(identifier, Toke
nType.PLUS_EQ, resolvedInteger(1)); | 4904 AssignmentExpression node = ASTFactory.assignmentExpression(identifier, Toke
nType.PLUS_EQ, resolvedInteger(1)); |
| 3986 node.element = getMethod(numType6, "+"); | 4905 node.element = getMethod(numType6, "+"); |
| 3987 JUnitTestCase.assertSame(numType6, analyze(node)); | 4906 JUnitTestCase.assertSame(numType6, analyze(node)); |
| 3988 _listener.assertNoErrors(); | 4907 _listener.assertNoErrors(); |
| 3989 } | 4908 } |
| 3990 void test_visitAssignmentExpression_simple() { | 4909 void test_visitAssignmentExpression_simple() { |
| 3991 InterfaceType intType6 = _typeProvider.intType; | 4910 InterfaceType intType7 = _typeProvider.intType; |
| 3992 Expression node = ASTFactory.assignmentExpression(resolvedVariable(intType6,
"i"), TokenType.EQ, resolvedInteger(0)); | 4911 Expression node = ASTFactory.assignmentExpression(resolvedVariable(intType7,
"i"), TokenType.EQ, resolvedInteger(0)); |
| 3993 JUnitTestCase.assertSame(intType6, analyze(node)); | 4912 JUnitTestCase.assertSame(intType7, analyze(node)); |
| 3994 _listener.assertNoErrors(); | 4913 _listener.assertNoErrors(); |
| 3995 } | 4914 } |
| 3996 void test_visitBinaryExpression_equals() { | 4915 void test_visitBinaryExpression_equals() { |
| 3997 Expression node = ASTFactory.binaryExpression(resolvedInteger(2), TokenType.
EQ_EQ, resolvedInteger(3)); | 4916 Expression node = ASTFactory.binaryExpression(resolvedInteger(2), TokenType.
EQ_EQ, resolvedInteger(3)); |
| 3998 JUnitTestCase.assertSame(_typeProvider.boolType, analyze(node)); | 4917 JUnitTestCase.assertSame(_typeProvider.boolType, analyze(node)); |
| 3999 _listener.assertNoErrors(); | 4918 _listener.assertNoErrors(); |
| 4000 } | 4919 } |
| 4001 void test_visitBinaryExpression_logicalAnd() { | 4920 void test_visitBinaryExpression_logicalAnd() { |
| 4002 Expression node = ASTFactory.binaryExpression(ASTFactory.booleanLiteral(fals
e), TokenType.AMPERSAND_AMPERSAND, ASTFactory.booleanLiteral(true)); | 4921 Expression node = ASTFactory.binaryExpression(ASTFactory.booleanLiteral(fals
e), TokenType.AMPERSAND_AMPERSAND, ASTFactory.booleanLiteral(true)); |
| 4003 JUnitTestCase.assertSame(_typeProvider.boolType, analyze(node)); | 4922 JUnitTestCase.assertSame(_typeProvider.boolType, analyze(node)); |
| 4004 _listener.assertNoErrors(); | 4923 _listener.assertNoErrors(); |
| 4005 } | 4924 } |
| 4006 void test_visitBinaryExpression_logicalOr() { | 4925 void test_visitBinaryExpression_logicalOr() { |
| 4007 Expression node = ASTFactory.binaryExpression(ASTFactory.booleanLiteral(fals
e), TokenType.BAR_BAR, ASTFactory.booleanLiteral(true)); | 4926 Expression node = ASTFactory.binaryExpression(ASTFactory.booleanLiteral(fals
e), TokenType.BAR_BAR, ASTFactory.booleanLiteral(true)); |
| 4008 JUnitTestCase.assertSame(_typeProvider.boolType, analyze(node)); | 4927 JUnitTestCase.assertSame(_typeProvider.boolType, analyze(node)); |
| 4009 _listener.assertNoErrors(); | 4928 _listener.assertNoErrors(); |
| 4010 } | 4929 } |
| 4011 void test_visitBinaryExpression_notEquals() { | 4930 void test_visitBinaryExpression_notEquals() { |
| 4012 Expression node = ASTFactory.binaryExpression(resolvedInteger(2), TokenType.
BANG_EQ, resolvedInteger(3)); | 4931 Expression node = ASTFactory.binaryExpression(resolvedInteger(2), TokenType.
BANG_EQ, resolvedInteger(3)); |
| 4013 JUnitTestCase.assertSame(_typeProvider.boolType, analyze(node)); | 4932 JUnitTestCase.assertSame(_typeProvider.boolType, analyze(node)); |
| 4014 _listener.assertNoErrors(); | 4933 _listener.assertNoErrors(); |
| 4015 } | 4934 } |
| 4016 void test_visitBinaryExpression_plus() { | 4935 void test_visitBinaryExpression_plus() { |
| 4017 BinaryExpression node = ASTFactory.binaryExpression(resolvedInteger(2), Toke
nType.PLUS, resolvedInteger(2)); | 4936 BinaryExpression node = ASTFactory.binaryExpression(resolvedInteger(2), Toke
nType.PLUS, resolvedInteger(2)); |
| 4018 node.element = getMethod(_typeProvider.numType, "+"); | 4937 node.element = getMethod(_typeProvider.numType, "+"); |
| 4019 JUnitTestCase.assertSame(_typeProvider.numType, analyze(node)); | 4938 JUnitTestCase.assertSame(_typeProvider.intType, analyze(node)); |
| 4020 _listener.assertNoErrors(); | 4939 _listener.assertNoErrors(); |
| 4021 } | 4940 } |
| 4022 void test_visitBooleanLiteral_false() { | 4941 void test_visitBooleanLiteral_false() { |
| 4023 Expression node = ASTFactory.booleanLiteral(false); | 4942 Expression node = ASTFactory.booleanLiteral(false); |
| 4024 JUnitTestCase.assertSame(_typeProvider.boolType, analyze(node)); | 4943 JUnitTestCase.assertSame(_typeProvider.boolType, analyze(node)); |
| 4025 _listener.assertNoErrors(); | 4944 _listener.assertNoErrors(); |
| 4026 } | 4945 } |
| 4027 void test_visitBooleanLiteral_true() { | 4946 void test_visitBooleanLiteral_true() { |
| 4028 Expression node = ASTFactory.booleanLiteral(true); | 4947 Expression node = ASTFactory.booleanLiteral(true); |
| 4029 JUnitTestCase.assertSame(_typeProvider.boolType, analyze(node)); | 4948 JUnitTestCase.assertSame(_typeProvider.boolType, analyze(node)); |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4188 void test_visitIndexExpression_setter() { | 5107 void test_visitIndexExpression_setter() { |
| 4189 InterfaceType listType3 = _typeProvider.listType; | 5108 InterfaceType listType3 = _typeProvider.listType; |
| 4190 SimpleIdentifier identifier = resolvedVariable(listType3, "a"); | 5109 SimpleIdentifier identifier = resolvedVariable(listType3, "a"); |
| 4191 IndexExpression node = ASTFactory.indexExpression(identifier, resolvedIntege
r(2)); | 5110 IndexExpression node = ASTFactory.indexExpression(identifier, resolvedIntege
r(2)); |
| 4192 node.element = listType3.element.methods[1]; | 5111 node.element = listType3.element.methods[1]; |
| 4193 ASTFactory.assignmentExpression(node, TokenType.EQ, ASTFactory.integer(0)); | 5112 ASTFactory.assignmentExpression(node, TokenType.EQ, ASTFactory.integer(0)); |
| 4194 JUnitTestCase.assertSame(listType3.typeArguments[0], analyze(node)); | 5113 JUnitTestCase.assertSame(listType3.typeArguments[0], analyze(node)); |
| 4195 _listener.assertNoErrors(); | 5114 _listener.assertNoErrors(); |
| 4196 } | 5115 } |
| 4197 void test_visitIndexExpression_typeParameters() { | 5116 void test_visitIndexExpression_typeParameters() { |
| 4198 InterfaceType intType7 = _typeProvider.intType; | 5117 InterfaceType intType8 = _typeProvider.intType; |
| 4199 InterfaceType listType4 = _typeProvider.listType; | 5118 InterfaceType listType4 = _typeProvider.listType; |
| 4200 MethodElement methodElement = getMethod(listType4, "[]"); | 5119 MethodElement methodElement = getMethod(listType4, "[]"); |
| 4201 SimpleIdentifier identifier = ASTFactory.identifier2("list"); | 5120 SimpleIdentifier identifier = ASTFactory.identifier3("list"); |
| 4202 identifier.staticType = listType4.substitute5(<Type2> [intType7]); | 5121 InterfaceType listOfIntType = listType4.substitute5(<Type2> [intType8]); |
| 5122 identifier.staticType = listOfIntType; |
| 4203 IndexExpression indexExpression2 = ASTFactory.indexExpression(identifier, AS
TFactory.integer(0)); | 5123 IndexExpression indexExpression2 = ASTFactory.indexExpression(identifier, AS
TFactory.integer(0)); |
| 4204 indexExpression2.element = methodElement; | 5124 indexExpression2.element = MethodMember.from(methodElement, listOfIntType); |
| 4205 JUnitTestCase.assertSame(intType7, analyze(indexExpression2)); | 5125 JUnitTestCase.assertSame(intType8, analyze(indexExpression2)); |
| 4206 _listener.assertNoErrors(); | 5126 _listener.assertNoErrors(); |
| 4207 } | 5127 } |
| 4208 void test_visitIndexExpression_typeParameters_inSetterContext() { | 5128 void test_visitIndexExpression_typeParameters_inSetterContext() { |
| 4209 InterfaceType intType8 = _typeProvider.intType; | 5129 InterfaceType intType9 = _typeProvider.intType; |
| 4210 InterfaceType listType5 = _typeProvider.listType; | 5130 InterfaceType listType5 = _typeProvider.listType; |
| 4211 MethodElement methodElement = getMethod(listType5, "[]="); | 5131 MethodElement methodElement = getMethod(listType5, "[]="); |
| 4212 SimpleIdentifier identifier = ASTFactory.identifier2("list"); | 5132 SimpleIdentifier identifier = ASTFactory.identifier3("list"); |
| 4213 identifier.staticType = listType5.substitute5(<Type2> [intType8]); | 5133 InterfaceType listOfIntType = listType5.substitute5(<Type2> [intType9]); |
| 5134 identifier.staticType = listOfIntType; |
| 4214 IndexExpression indexExpression3 = ASTFactory.indexExpression(identifier, AS
TFactory.integer(0)); | 5135 IndexExpression indexExpression3 = ASTFactory.indexExpression(identifier, AS
TFactory.integer(0)); |
| 4215 indexExpression3.element = methodElement; | 5136 indexExpression3.element = MethodMember.from(methodElement, listOfIntType); |
| 4216 ASTFactory.assignmentExpression(indexExpression3, TokenType.EQ, ASTFactory.i
nteger(0)); | 5137 ASTFactory.assignmentExpression(indexExpression3, TokenType.EQ, ASTFactory.i
nteger(0)); |
| 4217 JUnitTestCase.assertSame(intType8, analyze(indexExpression3)); | 5138 JUnitTestCase.assertSame(intType9, analyze(indexExpression3)); |
| 4218 _listener.assertNoErrors(); | 5139 _listener.assertNoErrors(); |
| 4219 } | 5140 } |
| 4220 void test_visitInstanceCreationExpression_named() { | 5141 void test_visitInstanceCreationExpression_named() { |
| 4221 ClassElement classElement = ElementFactory.classElement2("C", []); | 5142 ClassElementImpl classElement = ElementFactory.classElement2("C", []); |
| 4222 String constructorName = "m"; | 5143 String constructorName = "m"; |
| 4223 ConstructorElementImpl constructor = ElementFactory.constructorElement(const
ructorName); | 5144 ConstructorElementImpl constructor = ElementFactory.constructorElement(const
ructorName); |
| 4224 FunctionTypeImpl constructorType = new FunctionTypeImpl.con1(constructor); | 5145 FunctionTypeImpl constructorType = new FunctionTypeImpl.con1(constructor); |
| 4225 constructorType.returnType = classElement.type; | 5146 constructorType.returnType = classElement.type; |
| 4226 constructor.type = constructorType; | 5147 constructor.type = constructorType; |
| 4227 InstanceCreationExpression node = ASTFactory.instanceCreationExpression2(nul
l, ASTFactory.typeName(classElement, []), [ASTFactory.identifier2(constructorNam
e)]); | 5148 classElement.constructors = <ConstructorElement> [constructor]; |
| 5149 InstanceCreationExpression node = ASTFactory.instanceCreationExpression2(nul
l, ASTFactory.typeName(classElement, []), [ASTFactory.identifier3(constructorNam
e)]); |
| 4228 node.element = constructor; | 5150 node.element = constructor; |
| 4229 JUnitTestCase.assertSame(classElement.type, analyze(node)); | 5151 JUnitTestCase.assertSame(classElement.type, analyze(node)); |
| 4230 _listener.assertNoErrors(); | 5152 _listener.assertNoErrors(); |
| 4231 } | 5153 } |
| 4232 void test_visitInstanceCreationExpression_typeParameters() { | 5154 void test_visitInstanceCreationExpression_typeParameters() { |
| 4233 ClassElementImpl elementC = ElementFactory.classElement2("C", ["E"]); | 5155 ClassElementImpl elementC = ElementFactory.classElement2("C", ["E"]); |
| 4234 ClassElementImpl elementI = ElementFactory.classElement2("I", []); | 5156 ClassElementImpl elementI = ElementFactory.classElement2("I", []); |
| 4235 ConstructorElementImpl constructor = ElementFactory.constructorElement(null)
; | 5157 ConstructorElementImpl constructor = ElementFactory.constructorElement(null)
; |
| 4236 elementC.constructors = <ConstructorElement> [constructor]; | 5158 elementC.constructors = <ConstructorElement> [constructor]; |
| 4237 FunctionTypeImpl constructorType = new FunctionTypeImpl.con1(constructor); | 5159 FunctionTypeImpl constructorType = new FunctionTypeImpl.con1(constructor); |
| 4238 constructorType.returnType = elementC.type; | 5160 constructorType.returnType = elementC.type; |
| 4239 constructor.type = constructorType; | 5161 constructor.type = constructorType; |
| 4240 TypeName typeName4 = ASTFactory.typeName(elementC, [ASTFactory.typeName(elem
entI, [])]); | 5162 TypeName typeName5 = ASTFactory.typeName(elementC, [ASTFactory.typeName(elem
entI, [])]); |
| 4241 typeName4.type = elementC.type.substitute5(<Type2> [elementI.type]); | 5163 typeName5.type = elementC.type.substitute5(<Type2> [elementI.type]); |
| 4242 InstanceCreationExpression node = ASTFactory.instanceCreationExpression2(nul
l, typeName4, []); | 5164 InstanceCreationExpression node = ASTFactory.instanceCreationExpression2(nul
l, typeName5, []); |
| 4243 node.element = constructor; | 5165 node.element = constructor; |
| 4244 InterfaceType interfaceType = analyze(node) as InterfaceType; | 5166 InterfaceType interfaceType = analyze(node) as InterfaceType; |
| 4245 List<Type2> typeArgs = interfaceType.typeArguments; | 5167 List<Type2> typeArgs = interfaceType.typeArguments; |
| 4246 JUnitTestCase.assertEquals(1, typeArgs.length); | 5168 JUnitTestCase.assertEquals(1, typeArgs.length); |
| 4247 JUnitTestCase.assertEquals(elementI.type, typeArgs[0]); | 5169 JUnitTestCase.assertEquals(elementI.type, typeArgs[0]); |
| 4248 _listener.assertNoErrors(); | 5170 _listener.assertNoErrors(); |
| 4249 } | 5171 } |
| 4250 void test_visitInstanceCreationExpression_unnamed() { | 5172 void test_visitInstanceCreationExpression_unnamed() { |
| 4251 ClassElement classElement = ElementFactory.classElement2("C", []); | 5173 ClassElementImpl classElement = ElementFactory.classElement2("C", []); |
| 4252 ConstructorElementImpl constructor = ElementFactory.constructorElement(null)
; | 5174 ConstructorElementImpl constructor = ElementFactory.constructorElement(null)
; |
| 4253 FunctionTypeImpl constructorType = new FunctionTypeImpl.con1(constructor); | 5175 FunctionTypeImpl constructorType = new FunctionTypeImpl.con1(constructor); |
| 4254 constructorType.returnType = classElement.type; | 5176 constructorType.returnType = classElement.type; |
| 4255 constructor.type = constructorType; | 5177 constructor.type = constructorType; |
| 5178 classElement.constructors = <ConstructorElement> [constructor]; |
| 4256 InstanceCreationExpression node = ASTFactory.instanceCreationExpression2(nul
l, ASTFactory.typeName(classElement, []), []); | 5179 InstanceCreationExpression node = ASTFactory.instanceCreationExpression2(nul
l, ASTFactory.typeName(classElement, []), []); |
| 4257 node.element = constructor; | 5180 node.element = constructor; |
| 4258 JUnitTestCase.assertSame(classElement.type, analyze(node)); | 5181 JUnitTestCase.assertSame(classElement.type, analyze(node)); |
| 4259 _listener.assertNoErrors(); | 5182 _listener.assertNoErrors(); |
| 4260 } | 5183 } |
| 4261 void test_visitIntegerLiteral() { | 5184 void test_visitIntegerLiteral() { |
| 4262 Expression node = resolvedInteger(42); | 5185 Expression node = resolvedInteger(42); |
| 4263 JUnitTestCase.assertSame(_typeProvider.intType, analyze(node)); | 5186 JUnitTestCase.assertSame(_typeProvider.intType, analyze(node)); |
| 4264 _listener.assertNoErrors(); | 5187 _listener.assertNoErrors(); |
| 4265 } | 5188 } |
| 4266 void test_visitIsExpression_negated() { | 5189 void test_visitIsExpression_negated() { |
| 4267 Expression node = ASTFactory.isExpression(resolvedString("a"), true, ASTFact
ory.typeName3("String", [])); | 5190 Expression node = ASTFactory.isExpression(resolvedString("a"), true, ASTFact
ory.typeName4("String", [])); |
| 4268 JUnitTestCase.assertSame(_typeProvider.boolType, analyze(node)); | 5191 JUnitTestCase.assertSame(_typeProvider.boolType, analyze(node)); |
| 4269 _listener.assertNoErrors(); | 5192 _listener.assertNoErrors(); |
| 4270 } | 5193 } |
| 4271 void test_visitIsExpression_notNegated() { | 5194 void test_visitIsExpression_notNegated() { |
| 4272 Expression node = ASTFactory.isExpression(resolvedString("a"), false, ASTFac
tory.typeName3("String", [])); | 5195 Expression node = ASTFactory.isExpression(resolvedString("a"), false, ASTFac
tory.typeName4("String", [])); |
| 4273 JUnitTestCase.assertSame(_typeProvider.boolType, analyze(node)); | 5196 JUnitTestCase.assertSame(_typeProvider.boolType, analyze(node)); |
| 4274 _listener.assertNoErrors(); | 5197 _listener.assertNoErrors(); |
| 4275 } | 5198 } |
| 4276 void test_visitListLiteral_empty() { | 5199 void test_visitListLiteral_empty() { |
| 4277 Expression node = ASTFactory.listLiteral([]); | 5200 Expression node = ASTFactory.listLiteral([]); |
| 4278 Type2 resultType = analyze(node); | 5201 Type2 resultType = analyze(node); |
| 4279 assertType2(_typeProvider.listType.substitute5(<Type2> [_typeProvider.dynami
cType]), resultType); | 5202 assertType2(_typeProvider.listType.substitute5(<Type2> [_typeProvider.dynami
cType]), resultType); |
| 4280 _listener.assertNoErrors(); | 5203 _listener.assertNoErrors(); |
| 4281 } | 5204 } |
| 4282 void test_visitListLiteral_nonEmpty() { | 5205 void test_visitListLiteral_nonEmpty() { |
| 4283 Expression node = ASTFactory.listLiteral([resolvedInteger(0)]); | 5206 Expression node = ASTFactory.listLiteral([resolvedInteger(0)]); |
| 4284 Type2 resultType = analyze(node); | 5207 Type2 resultType = analyze(node); |
| 4285 assertType2(_typeProvider.listType.substitute5(<Type2> [_typeProvider.dynami
cType]), resultType); | 5208 assertType2(_typeProvider.listType.substitute5(<Type2> [_typeProvider.dynami
cType]), resultType); |
| 4286 _listener.assertNoErrors(); | 5209 _listener.assertNoErrors(); |
| 4287 } | 5210 } |
| 4288 void test_visitMapLiteral_empty() { | 5211 void test_visitMapLiteral_empty() { |
| 4289 Expression node = ASTFactory.mapLiteral2([]); | 5212 Expression node = ASTFactory.mapLiteral2([]); |
| 4290 Type2 resultType = analyze(node); | 5213 Type2 resultType = analyze(node); |
| 4291 assertType2(_typeProvider.mapType.substitute5(<Type2> [_typeProvider.stringT
ype, _typeProvider.dynamicType]), resultType); | 5214 assertType2(_typeProvider.mapType.substitute5(<Type2> [_typeProvider.stringT
ype, _typeProvider.dynamicType]), resultType); |
| 4292 _listener.assertNoErrors(); | 5215 _listener.assertNoErrors(); |
| 4293 } | 5216 } |
| 4294 void test_visitMapLiteral_nonEmpty() { | 5217 void test_visitMapLiteral_nonEmpty() { |
| 4295 Expression node = ASTFactory.mapLiteral2([ASTFactory.mapLiteralEntry("k", re
solvedInteger(0))]); | 5218 Expression node = ASTFactory.mapLiteral2([ASTFactory.mapLiteralEntry("k", re
solvedInteger(0))]); |
| 4296 Type2 resultType = analyze(node); | 5219 Type2 resultType = analyze(node); |
| 4297 assertType2(_typeProvider.mapType.substitute5(<Type2> [_typeProvider.stringT
ype, _typeProvider.dynamicType]), resultType); | 5220 assertType2(_typeProvider.mapType.substitute5(<Type2> [_typeProvider.stringT
ype, _typeProvider.dynamicType]), resultType); |
| 4298 _listener.assertNoErrors(); | 5221 _listener.assertNoErrors(); |
| 4299 } | 5222 } |
| 4300 void test_visitNamedExpression() { | 5223 void test_visitNamedExpression() { |
| 4301 Expression node = ASTFactory.namedExpression("n", resolvedString("a")); | 5224 Expression node = ASTFactory.namedExpression2("n", resolvedString("a")); |
| 4302 JUnitTestCase.assertSame(_typeProvider.stringType, analyze(node)); | 5225 JUnitTestCase.assertSame(_typeProvider.stringType, analyze(node)); |
| 4303 _listener.assertNoErrors(); | 5226 _listener.assertNoErrors(); |
| 4304 } | 5227 } |
| 4305 void test_visitNullLiteral() { | 5228 void test_visitNullLiteral() { |
| 4306 Expression node = ASTFactory.nullLiteral(); | 5229 Expression node = ASTFactory.nullLiteral(); |
| 4307 JUnitTestCase.assertSame(_typeProvider.bottomType, analyze(node)); | 5230 JUnitTestCase.assertSame(_typeProvider.bottomType, analyze(node)); |
| 4308 _listener.assertNoErrors(); | 5231 _listener.assertNoErrors(); |
| 4309 } | 5232 } |
| 4310 void test_visitParenthesizedExpression() { | 5233 void test_visitParenthesizedExpression() { |
| 4311 Expression node = ASTFactory.parenthesizedExpression(resolvedInteger(0)); | 5234 Expression node = ASTFactory.parenthesizedExpression(resolvedInteger(0)); |
| 4312 JUnitTestCase.assertSame(_typeProvider.intType, analyze(node)); | 5235 JUnitTestCase.assertSame(_typeProvider.intType, analyze(node)); |
| 4313 _listener.assertNoErrors(); | 5236 _listener.assertNoErrors(); |
| 4314 } | 5237 } |
| 4315 void test_visitPostfixExpression_minusMinus() { | 5238 void test_visitPostfixExpression_minusMinus() { |
| 4316 PostfixExpression node = ASTFactory.postfixExpression(resolvedInteger(0), To
kenType.MINUS_MINUS); | 5239 PostfixExpression node = ASTFactory.postfixExpression(resolvedInteger(0), To
kenType.MINUS_MINUS); |
| 4317 JUnitTestCase.assertSame(_typeProvider.intType, analyze(node)); | 5240 JUnitTestCase.assertSame(_typeProvider.intType, analyze(node)); |
| 4318 _listener.assertNoErrors(); | 5241 _listener.assertNoErrors(); |
| 4319 } | 5242 } |
| 4320 void test_visitPostfixExpression_plusPlus() { | 5243 void test_visitPostfixExpression_plusPlus() { |
| 4321 PostfixExpression node = ASTFactory.postfixExpression(resolvedInteger(0), To
kenType.PLUS_PLUS); | 5244 PostfixExpression node = ASTFactory.postfixExpression(resolvedInteger(0), To
kenType.PLUS_PLUS); |
| 4322 JUnitTestCase.assertSame(_typeProvider.intType, analyze(node)); | 5245 JUnitTestCase.assertSame(_typeProvider.intType, analyze(node)); |
| 4323 _listener.assertNoErrors(); | 5246 _listener.assertNoErrors(); |
| 4324 } | 5247 } |
| 4325 void test_visitPrefixedIdentifier_getter() { | 5248 void test_visitPrefixedIdentifier_getter() { |
| 4326 Type2 boolType2 = _typeProvider.boolType; | 5249 Type2 boolType2 = _typeProvider.boolType; |
| 4327 PropertyAccessorElementImpl getter = ElementFactory.getterElement("b", false
, boolType2); | 5250 PropertyAccessorElementImpl getter = ElementFactory.getterElement("b", false
, boolType2); |
| 4328 PrefixedIdentifier node = ASTFactory.identifier4("a", "b"); | 5251 PrefixedIdentifier node = ASTFactory.identifier5("a", "b"); |
| 4329 node.identifier.element = getter; | 5252 node.identifier.element = getter; |
| 4330 JUnitTestCase.assertSame(boolType2, analyze(node)); | 5253 JUnitTestCase.assertSame(boolType2, analyze(node)); |
| 4331 _listener.assertNoErrors(); | 5254 _listener.assertNoErrors(); |
| 4332 } | 5255 } |
| 4333 void test_visitPrefixedIdentifier_setter() { | 5256 void test_visitPrefixedIdentifier_setter() { |
| 4334 Type2 boolType3 = _typeProvider.boolType; | 5257 Type2 boolType3 = _typeProvider.boolType; |
| 4335 FieldElementImpl field = ElementFactory.fieldElement("b", false, false, fals
e, boolType3); | 5258 FieldElementImpl field = ElementFactory.fieldElement("b", false, false, fals
e, boolType3); |
| 4336 PropertyAccessorElement setter5 = field.setter; | 5259 PropertyAccessorElement setter5 = field.setter; |
| 4337 PrefixedIdentifier node = ASTFactory.identifier4("a", "b"); | 5260 PrefixedIdentifier node = ASTFactory.identifier5("a", "b"); |
| 4338 node.identifier.element = setter5; | 5261 node.identifier.element = setter5; |
| 4339 JUnitTestCase.assertSame(boolType3, analyze(node)); | 5262 JUnitTestCase.assertSame(boolType3, analyze(node)); |
| 4340 _listener.assertNoErrors(); | 5263 _listener.assertNoErrors(); |
| 4341 } | 5264 } |
| 4342 void test_visitPrefixedIdentifier_variable() { | 5265 void test_visitPrefixedIdentifier_variable() { |
| 4343 VariableElementImpl variable = ElementFactory.localVariableElement2("b"); | 5266 VariableElementImpl variable = ElementFactory.localVariableElement2("b"); |
| 4344 variable.type = _typeProvider.boolType; | 5267 variable.type = _typeProvider.boolType; |
| 4345 PrefixedIdentifier node = ASTFactory.identifier4("a", "b"); | 5268 PrefixedIdentifier node = ASTFactory.identifier5("a", "b"); |
| 4346 node.identifier.element = variable; | 5269 node.identifier.element = variable; |
| 4347 JUnitTestCase.assertSame(_typeProvider.boolType, analyze(node)); | 5270 JUnitTestCase.assertSame(_typeProvider.boolType, analyze(node)); |
| 4348 _listener.assertNoErrors(); | 5271 _listener.assertNoErrors(); |
| 4349 } | 5272 } |
| 4350 void test_visitPrefixExpression_bang() { | 5273 void test_visitPrefixExpression_bang() { |
| 4351 PrefixExpression node = ASTFactory.prefixExpression(TokenType.BANG, resolved
Integer(0)); | 5274 PrefixExpression node = ASTFactory.prefixExpression(TokenType.BANG, resolved
Integer(0)); |
| 4352 JUnitTestCase.assertSame(_typeProvider.boolType, analyze(node)); | 5275 JUnitTestCase.assertSame(_typeProvider.boolType, analyze(node)); |
| 4353 _listener.assertNoErrors(); | 5276 _listener.assertNoErrors(); |
| 4354 } | 5277 } |
| 4355 void test_visitPrefixExpression_minus() { | 5278 void test_visitPrefixExpression_minus() { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 4377 } | 5300 } |
| 4378 void test_visitPrefixExpression_tilde() { | 5301 void test_visitPrefixExpression_tilde() { |
| 4379 PrefixExpression node = ASTFactory.prefixExpression(TokenType.TILDE, resolve
dInteger(0)); | 5302 PrefixExpression node = ASTFactory.prefixExpression(TokenType.TILDE, resolve
dInteger(0)); |
| 4380 node.element = getMethod(_typeProvider.intType, "~"); | 5303 node.element = getMethod(_typeProvider.intType, "~"); |
| 4381 JUnitTestCase.assertSame(_typeProvider.intType, analyze(node)); | 5304 JUnitTestCase.assertSame(_typeProvider.intType, analyze(node)); |
| 4382 _listener.assertNoErrors(); | 5305 _listener.assertNoErrors(); |
| 4383 } | 5306 } |
| 4384 void test_visitPropertyAccess_getter() { | 5307 void test_visitPropertyAccess_getter() { |
| 4385 Type2 boolType4 = _typeProvider.boolType; | 5308 Type2 boolType4 = _typeProvider.boolType; |
| 4386 PropertyAccessorElementImpl getter = ElementFactory.getterElement("b", false
, boolType4); | 5309 PropertyAccessorElementImpl getter = ElementFactory.getterElement("b", false
, boolType4); |
| 4387 PropertyAccess node = ASTFactory.propertyAccess2(ASTFactory.identifier2("a")
, "b"); | 5310 PropertyAccess node = ASTFactory.propertyAccess2(ASTFactory.identifier3("a")
, "b"); |
| 4388 node.propertyName.element = getter; | 5311 node.propertyName.element = getter; |
| 4389 JUnitTestCase.assertSame(boolType4, analyze(node)); | 5312 JUnitTestCase.assertSame(boolType4, analyze(node)); |
| 4390 _listener.assertNoErrors(); | 5313 _listener.assertNoErrors(); |
| 4391 } | 5314 } |
| 4392 void test_visitPropertyAccess_setter() { | 5315 void test_visitPropertyAccess_setter() { |
| 4393 Type2 boolType5 = _typeProvider.boolType; | 5316 Type2 boolType5 = _typeProvider.boolType; |
| 4394 FieldElementImpl field = ElementFactory.fieldElement("b", false, false, fals
e, boolType5); | 5317 FieldElementImpl field = ElementFactory.fieldElement("b", false, false, fals
e, boolType5); |
| 4395 PropertyAccessorElement setter6 = field.setter; | 5318 PropertyAccessorElement setter6 = field.setter; |
| 4396 PropertyAccess node = ASTFactory.propertyAccess2(ASTFactory.identifier2("a")
, "b"); | 5319 PropertyAccess node = ASTFactory.propertyAccess2(ASTFactory.identifier3("a")
, "b"); |
| 4397 node.propertyName.element = setter6; | 5320 node.propertyName.element = setter6; |
| 4398 JUnitTestCase.assertSame(boolType5, analyze(node)); | 5321 JUnitTestCase.assertSame(boolType5, analyze(node)); |
| 4399 _listener.assertNoErrors(); | 5322 _listener.assertNoErrors(); |
| 4400 } | 5323 } |
| 4401 void test_visitSimpleStringLiteral() { | 5324 void test_visitSimpleStringLiteral() { |
| 4402 Expression node = resolvedString("a"); | 5325 Expression node = resolvedString("a"); |
| 4403 JUnitTestCase.assertSame(_typeProvider.stringType, analyze(node)); | 5326 JUnitTestCase.assertSame(_typeProvider.stringType, analyze(node)); |
| 4404 _listener.assertNoErrors(); | 5327 _listener.assertNoErrors(); |
| 4405 } | 5328 } |
| 4406 void test_visitStringInterpolation() { | 5329 void test_visitStringInterpolation() { |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4522 EngineTestCase.assertInstanceOf(InterfaceTypeImpl, actualType); | 5445 EngineTestCase.assertInstanceOf(InterfaceTypeImpl, actualType); |
| 4523 assertType((expectedType as InterfaceTypeImpl), (actualType as InterfaceTy
peImpl)); | 5446 assertType((expectedType as InterfaceTypeImpl), (actualType as InterfaceTy
peImpl)); |
| 4524 } | 5447 } |
| 4525 } | 5448 } |
| 4526 /** | 5449 /** |
| 4527 * Create the analyzer used by the tests. | 5450 * Create the analyzer used by the tests. |
| 4528 * @return the analyzer to be used by the tests | 5451 * @return the analyzer to be used by the tests |
| 4529 */ | 5452 */ |
| 4530 StaticTypeAnalyzer createAnalyzer() { | 5453 StaticTypeAnalyzer createAnalyzer() { |
| 4531 AnalysisContextImpl context = new AnalysisContextImpl(); | 5454 AnalysisContextImpl context = new AnalysisContextImpl(); |
| 4532 SourceFactory sourceFactory = new SourceFactory.con2([new DartUriResolver(Da
rtSdk.defaultSdk)]); | 5455 SourceFactory sourceFactory = new SourceFactory.con2([new DartUriResolver(Di
rectoryBasedDartSdk.defaultSdk)]); |
| 4533 context.sourceFactory = sourceFactory; | 5456 context.sourceFactory = sourceFactory; |
| 4534 FileBasedSource source = new FileBasedSource.con1(sourceFactory, FileUtiliti
es2.createFile("/lib.dart")); | 5457 FileBasedSource source = new FileBasedSource.con1(sourceFactory.contentCache
, FileUtilities2.createFile("/lib.dart")); |
| 4535 CompilationUnitElementImpl definingCompilationUnit = new CompilationUnitElem
entImpl("lib.dart"); | 5458 CompilationUnitElementImpl definingCompilationUnit = new CompilationUnitElem
entImpl("lib.dart"); |
| 4536 definingCompilationUnit.source = source; | 5459 definingCompilationUnit.source = source; |
| 4537 LibraryElementImpl definingLibrary = new LibraryElementImpl(context, null); | 5460 LibraryElementImpl definingLibrary = new LibraryElementImpl(context, null); |
| 4538 definingLibrary.definingCompilationUnit = definingCompilationUnit; | 5461 definingLibrary.definingCompilationUnit = definingCompilationUnit; |
| 4539 Library library = new Library(context, _listener, source); | 5462 Library library = new Library(context, _listener, source); |
| 4540 library.libraryElement = definingLibrary; | 5463 library.libraryElement = definingLibrary; |
| 4541 ResolverVisitor visitor = new ResolverVisitor(library, source, _typeProvider
); | 5464 ResolverVisitor visitor = new ResolverVisitor.con1(library, source, _typePro
vider); |
| 5465 visitor.overrideManager.enterScope(); |
| 4542 try { | 5466 try { |
| 4543 return visitor.typeAnalyzer_J2DAccessor as StaticTypeAnalyzer; | 5467 return visitor.typeAnalyzer_J2DAccessor as StaticTypeAnalyzer; |
| 4544 } catch (exception) { | 5468 } catch (exception) { |
| 4545 throw new IllegalArgumentException("Could not create analyzer", exception)
; | 5469 throw new IllegalArgumentException("Could not create analyzer", exception)
; |
| 4546 } | 5470 } |
| 4547 } | 5471 } |
| 4548 /** | 5472 /** |
| 4549 * Return an integer literal that has been resolved to the correct type. | 5473 * Return an integer literal that has been resolved to the correct type. |
| 4550 * @param value the value of the literal | 5474 * @param value the value of the literal |
| 4551 * @return an integer literal that has been resolved to the correct type | 5475 * @return an integer literal that has been resolved to the correct type |
| 4552 */ | 5476 */ |
| 4553 DoubleLiteral resolvedDouble(double value) { | 5477 DoubleLiteral resolvedDouble(double value) { |
| 4554 DoubleLiteral literal = ASTFactory.doubleLiteral(value); | 5478 DoubleLiteral literal = ASTFactory.doubleLiteral(value); |
| 4555 literal.staticType = _typeProvider.doubleType; | 5479 literal.staticType = _typeProvider.doubleType; |
| 4556 return literal; | 5480 return literal; |
| 4557 } | 5481 } |
| 4558 /** | 5482 /** |
| 4559 * Create a function expression that has an element associated with it, where
the element has an | 5483 * Create a function expression that has an element associated with it, where
the element has an |
| 4560 * incomplete type associated with it (just like the one{@link ElementBuilder#
visitFunctionExpression(FunctionExpression)} would have built if we had | 5484 * incomplete type associated with it (just like the one{@link ElementBuilder#
visitFunctionExpression(FunctionExpression)} would have built if we had |
| 4561 * run it). | 5485 * run it). |
| 4562 * @param parameters the parameters to the function | 5486 * @param parameters the parameters to the function |
| 4563 * @param body the body of the function | 5487 * @param body the body of the function |
| 4564 * @return a resolved function expression | 5488 * @return a resolved function expression |
| 4565 */ | 5489 */ |
| 4566 FunctionExpression resolvedFunctionExpression(FormalParameterList parameters16
, FunctionBody body) { | 5490 FunctionExpression resolvedFunctionExpression(FormalParameterList parameters18
, FunctionBody body) { |
| 4567 for (FormalParameter parameter in parameters16.parameters) { | 5491 for (FormalParameter parameter in parameters18.parameters) { |
| 4568 ParameterElementImpl element = new ParameterElementImpl(parameter.identifi
er); | 5492 ParameterElementImpl element = new ParameterElementImpl(parameter.identifi
er); |
| 4569 element.parameterKind = parameter.kind; | 5493 element.parameterKind = parameter.kind; |
| 4570 element.type = _typeProvider.dynamicType; | 5494 element.type = _typeProvider.dynamicType; |
| 4571 parameter.identifier.element = element; | 5495 parameter.identifier.element = element; |
| 4572 } | 5496 } |
| 4573 FunctionExpression node = ASTFactory.functionExpression2(parameters16, body)
; | 5497 FunctionExpression node = ASTFactory.functionExpression2(parameters18, body)
; |
| 4574 FunctionElementImpl element = new FunctionElementImpl.con1(null); | 5498 FunctionElementImpl element = new FunctionElementImpl.con1(null); |
| 4575 element.type = new FunctionTypeImpl.con1(element); | 5499 element.type = new FunctionTypeImpl.con1(element); |
| 4576 node.element = element; | 5500 node.element = element; |
| 4577 return node; | 5501 return node; |
| 4578 } | 5502 } |
| 4579 /** | 5503 /** |
| 4580 * Return an integer literal that has been resolved to the correct type. | 5504 * Return an integer literal that has been resolved to the correct type. |
| 4581 * @param value the value of the literal | 5505 * @param value the value of the literal |
| 4582 * @return an integer literal that has been resolved to the correct type | 5506 * @return an integer literal that has been resolved to the correct type |
| 4583 */ | 5507 */ |
| (...skipping 11 matching lines...) Expand all Loading... |
| 4595 SimpleStringLiteral string = ASTFactory.string2(value); | 5519 SimpleStringLiteral string = ASTFactory.string2(value); |
| 4596 string.staticType = _typeProvider.stringType; | 5520 string.staticType = _typeProvider.stringType; |
| 4597 return string; | 5521 return string; |
| 4598 } | 5522 } |
| 4599 /** | 5523 /** |
| 4600 * Return a simple identifier that has been resolved to a variable element wit
h the given type. | 5524 * Return a simple identifier that has been resolved to a variable element wit
h the given type. |
| 4601 * @param type the type of the variable being represented | 5525 * @param type the type of the variable being represented |
| 4602 * @param variableName the name of the variable | 5526 * @param variableName the name of the variable |
| 4603 * @return a simple identifier that has been resolved to a variable element wi
th the given type | 5527 * @return a simple identifier that has been resolved to a variable element wi
th the given type |
| 4604 */ | 5528 */ |
| 4605 SimpleIdentifier resolvedVariable(InterfaceType type37, String variableName) { | 5529 SimpleIdentifier resolvedVariable(InterfaceType type46, String variableName) { |
| 4606 SimpleIdentifier identifier = ASTFactory.identifier2(variableName); | 5530 SimpleIdentifier identifier = ASTFactory.identifier3(variableName); |
| 4607 VariableElementImpl element = ElementFactory.localVariableElement(identifier
); | 5531 VariableElementImpl element = ElementFactory.localVariableElement(identifier
); |
| 4608 element.type = type37; | 5532 element.type = type46; |
| 4609 identifier.element = element; | 5533 identifier.element = element; |
| 4610 identifier.staticType = type37; | 5534 identifier.staticType = type46; |
| 4611 return identifier; | 5535 return identifier; |
| 4612 } | 5536 } |
| 4613 /** | 5537 /** |
| 4614 * Set the type of the given parameter to the given type. | 5538 * Set the type of the given parameter to the given type. |
| 4615 * @param parameter the parameter whose type is to be set | 5539 * @param parameter the parameter whose type is to be set |
| 4616 * @param type the new type of the given parameter | 5540 * @param type the new type of the given parameter |
| 4617 */ | 5541 */ |
| 4618 void setType(FormalParameter parameter, Type2 type38) { | 5542 void setType(FormalParameter parameter, Type2 type47) { |
| 4619 SimpleIdentifier identifier17 = parameter.identifier; | 5543 SimpleIdentifier identifier19 = parameter.identifier; |
| 4620 Element element57 = identifier17.element; | 5544 Element element66 = identifier19.element; |
| 4621 if (element57 is! ParameterElement) { | 5545 if (element66 is! ParameterElement) { |
| 4622 element57 = new ParameterElementImpl(identifier17); | 5546 element66 = new ParameterElementImpl(identifier19); |
| 4623 identifier17.element = element57; | 5547 identifier19.element = element66; |
| 4624 } | 5548 } |
| 4625 ((element57 as ParameterElementImpl)).type = type38; | 5549 ((element66 as ParameterElementImpl)).type = type47; |
| 4626 } | 5550 } |
| 4627 static dartSuite() { | 5551 static dartSuite() { |
| 4628 _ut.group('StaticTypeAnalyzerTest', () { | 5552 _ut.group('StaticTypeAnalyzerTest', () { |
| 4629 _ut.test('test_visitAdjacentStrings', () { | 5553 _ut.test('test_visitAdjacentStrings', () { |
| 4630 final __test = new StaticTypeAnalyzerTest(); | 5554 final __test = new StaticTypeAnalyzerTest(); |
| 4631 runJUnitTest(__test, __test.test_visitAdjacentStrings); | 5555 runJUnitTest(__test, __test.test_visitAdjacentStrings); |
| 4632 }); | 5556 }); |
| 4633 _ut.test('test_visitArgumentDefinitionTest', () { | 5557 _ut.test('test_visitArgumentDefinitionTest', () { |
| 4634 final __test = new StaticTypeAnalyzerTest(); | 5558 final __test = new StaticTypeAnalyzerTest(); |
| 4635 runJUnitTest(__test, __test.test_visitArgumentDefinitionTest); | 5559 runJUnitTest(__test, __test.test_visitArgumentDefinitionTest); |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4872 }); | 5796 }); |
| 4873 _ut.test('test_visitThrowExpression_withoutValue', () { | 5797 _ut.test('test_visitThrowExpression_withoutValue', () { |
| 4874 final __test = new StaticTypeAnalyzerTest(); | 5798 final __test = new StaticTypeAnalyzerTest(); |
| 4875 runJUnitTest(__test, __test.test_visitThrowExpression_withoutValue); | 5799 runJUnitTest(__test, __test.test_visitThrowExpression_withoutValue); |
| 4876 }); | 5800 }); |
| 4877 }); | 5801 }); |
| 4878 } | 5802 } |
| 4879 } | 5803 } |
| 4880 class EnclosedScopeTest extends ResolverTestCase { | 5804 class EnclosedScopeTest extends ResolverTestCase { |
| 4881 void test_define_duplicate() { | 5805 void test_define_duplicate() { |
| 4882 LibraryElement definingLibrary2 = createTestLibrary(); | 5806 LibraryElement definingLibrary3 = createTestLibrary(); |
| 4883 GatheringErrorListener errorListener2 = new GatheringErrorListener(); | 5807 GatheringErrorListener errorListener3 = new GatheringErrorListener(); |
| 4884 Scope rootScope = new Scope_12(definingLibrary2, errorListener2); | 5808 Scope rootScope = new Scope_16(definingLibrary3, errorListener3); |
| 4885 EnclosedScope scope = new EnclosedScope(rootScope); | 5809 EnclosedScope scope = new EnclosedScope(rootScope); |
| 4886 VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.id
entifier2("v1")); | 5810 VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v1")); |
| 4887 VariableElement element2 = ElementFactory.localVariableElement(ASTFactory.id
entifier2("v1")); | 5811 VariableElement element2 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v1")); |
| 4888 scope.define(element1); | 5812 scope.define(element1); |
| 4889 scope.define(element2); | 5813 scope.define(element2); |
| 4890 errorListener2.assertErrors3([ErrorSeverity.ERROR]); | 5814 errorListener3.assertErrors3([ErrorSeverity.ERROR]); |
| 4891 } | 5815 } |
| 4892 void test_define_normal() { | 5816 void test_define_normal() { |
| 4893 LibraryElement definingLibrary3 = createTestLibrary(); | 5817 LibraryElement definingLibrary4 = createTestLibrary(); |
| 4894 GatheringErrorListener errorListener3 = new GatheringErrorListener(); | 5818 GatheringErrorListener errorListener4 = new GatheringErrorListener(); |
| 4895 Scope rootScope = new Scope_13(definingLibrary3, errorListener3); | 5819 Scope rootScope = new Scope_17(definingLibrary4, errorListener4); |
| 4896 EnclosedScope outerScope = new EnclosedScope(rootScope); | 5820 EnclosedScope outerScope = new EnclosedScope(rootScope); |
| 4897 EnclosedScope innerScope = new EnclosedScope(outerScope); | 5821 EnclosedScope innerScope = new EnclosedScope(outerScope); |
| 4898 VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.id
entifier2("v1")); | 5822 VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v1")); |
| 4899 VariableElement element2 = ElementFactory.localVariableElement(ASTFactory.id
entifier2("v2")); | 5823 VariableElement element2 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v2")); |
| 4900 outerScope.define(element1); | 5824 outerScope.define(element1); |
| 4901 innerScope.define(element2); | 5825 innerScope.define(element2); |
| 4902 errorListener3.assertNoErrors(); | 5826 errorListener4.assertNoErrors(); |
| 4903 } | 5827 } |
| 4904 static dartSuite() { | 5828 static dartSuite() { |
| 4905 _ut.group('EnclosedScopeTest', () { | 5829 _ut.group('EnclosedScopeTest', () { |
| 4906 _ut.test('test_define_duplicate', () { | 5830 _ut.test('test_define_duplicate', () { |
| 4907 final __test = new EnclosedScopeTest(); | 5831 final __test = new EnclosedScopeTest(); |
| 4908 runJUnitTest(__test, __test.test_define_duplicate); | 5832 runJUnitTest(__test, __test.test_define_duplicate); |
| 4909 }); | 5833 }); |
| 4910 _ut.test('test_define_normal', () { | 5834 _ut.test('test_define_normal', () { |
| 4911 final __test = new EnclosedScopeTest(); | 5835 final __test = new EnclosedScopeTest(); |
| 4912 runJUnitTest(__test, __test.test_define_normal); | 5836 runJUnitTest(__test, __test.test_define_normal); |
| 4913 }); | 5837 }); |
| 4914 }); | 5838 }); |
| 4915 } | 5839 } |
| 4916 } | 5840 } |
| 4917 class Scope_12 extends Scope { | 5841 class Scope_16 extends Scope { |
| 4918 LibraryElement definingLibrary2; | 5842 LibraryElement definingLibrary3; |
| 4919 GatheringErrorListener errorListener2; | 5843 GatheringErrorListener errorListener3; |
| 4920 Scope_12(this.definingLibrary2, this.errorListener2) : super(); | 5844 Scope_16(this.definingLibrary3, this.errorListener3) : super(); |
| 4921 LibraryElement get definingLibrary => definingLibrary2; | 5845 LibraryElement get definingLibrary => definingLibrary3; |
| 4922 AnalysisErrorListener get errorListener => errorListener2; | 5846 AnalysisErrorListener get errorListener => errorListener3; |
| 4923 Element lookup3(String name, LibraryElement referencingLibrary) => null; | 5847 Element lookup3(String name, LibraryElement referencingLibrary) => null; |
| 4924 } | 5848 } |
| 4925 class Scope_13 extends Scope { | 5849 class Scope_17 extends Scope { |
| 4926 LibraryElement definingLibrary3; | 5850 LibraryElement definingLibrary4; |
| 4927 GatheringErrorListener errorListener3; | 5851 GatheringErrorListener errorListener4; |
| 4928 Scope_13(this.definingLibrary3, this.errorListener3) : super(); | 5852 Scope_17(this.definingLibrary4, this.errorListener4) : super(); |
| 4929 LibraryElement get definingLibrary => definingLibrary3; | 5853 LibraryElement get definingLibrary => definingLibrary4; |
| 4930 AnalysisErrorListener get errorListener => errorListener3; | 5854 AnalysisErrorListener get errorListener => errorListener4; |
| 4931 Element lookup3(String name, LibraryElement referencingLibrary) => null; | 5855 Element lookup3(String name, LibraryElement referencingLibrary) => null; |
| 4932 } | 5856 } |
| 4933 class LibraryElementBuilderTest extends EngineTestCase { | 5857 class LibraryElementBuilderTest extends EngineTestCase { |
| 4934 /** | 5858 /** |
| 4935 * The source factory used to create {@link Source sources}. | 5859 * The source factory used to create {@link Source sources}. |
| 4936 */ | 5860 */ |
| 4937 SourceFactory _sourceFactory; | 5861 SourceFactory _sourceFactory; |
| 4938 void setUp() { | 5862 void setUp() { |
| 4939 _sourceFactory = new SourceFactory.con2([new FileUriResolver()]); | 5863 _sourceFactory = new SourceFactory.con2([new FileUriResolver()]); |
| 4940 } | 5864 } |
| 4941 void test_empty() { | 5865 void test_empty() { |
| 4942 Source librarySource = addSource("/lib.dart", "library lib;"); | 5866 Source librarySource = addSource("/lib.dart", "library lib;"); |
| 4943 LibraryElement element = buildLibrary(librarySource, []); | 5867 LibraryElement element = buildLibrary(librarySource, []); |
| 4944 JUnitTestCase.assertNotNull(element); | 5868 JUnitTestCase.assertNotNull(element); |
| 4945 JUnitTestCase.assertEquals("lib", element.name); | 5869 JUnitTestCase.assertEquals("lib", element.name); |
| 4946 JUnitTestCase.assertNull(element.entryPoint); | 5870 JUnitTestCase.assertNull(element.entryPoint); |
| 4947 EngineTestCase.assertLength(0, element.importedLibraries); | 5871 EngineTestCase.assertLength(0, element.importedLibraries); |
| 4948 EngineTestCase.assertLength(0, element.imports); | 5872 EngineTestCase.assertLength(0, element.imports); |
| 4949 JUnitTestCase.assertNull(element.library); | 5873 JUnitTestCase.assertSame(element, element.library); |
| 4950 EngineTestCase.assertLength(0, element.prefixes); | 5874 EngineTestCase.assertLength(0, element.prefixes); |
| 4951 EngineTestCase.assertLength(0, element.parts); | 5875 EngineTestCase.assertLength(0, element.parts); |
| 4952 CompilationUnitElement unit = element.definingCompilationUnit; | 5876 CompilationUnitElement unit = element.definingCompilationUnit; |
| 4953 JUnitTestCase.assertNotNull(unit); | 5877 JUnitTestCase.assertNotNull(unit); |
| 4954 JUnitTestCase.assertEquals("lib.dart", unit.name); | 5878 JUnitTestCase.assertEquals("lib.dart", unit.name); |
| 4955 JUnitTestCase.assertEquals(element, unit.library); | 5879 JUnitTestCase.assertEquals(element, unit.library); |
| 4956 EngineTestCase.assertLength(0, unit.accessors); | 5880 EngineTestCase.assertLength(0, unit.accessors); |
| 4957 EngineTestCase.assertLength(0, unit.functions); | 5881 EngineTestCase.assertLength(0, unit.functions); |
| 4958 EngineTestCase.assertLength(0, unit.functionTypeAliases); | 5882 EngineTestCase.assertLength(0, unit.functionTypeAliases); |
| 4959 EngineTestCase.assertLength(0, unit.types); | 5883 EngineTestCase.assertLength(0, unit.types); |
| 4960 EngineTestCase.assertLength(0, unit.topLevelVariables); | 5884 EngineTestCase.assertLength(0, unit.topLevelVariables); |
| 4961 } | 5885 } |
| 4962 void test_invalidUri_part() { | 5886 void test_invalidUri_part() { |
| 4963 Source librarySource = addSource("/lib.dart", EngineTestCase.createSource(["
library lib;", "", "part '\${'a'}.dart';"])); | 5887 Source librarySource = addSource("/lib.dart", EngineTestCase.createSource(["
library lib;", "", "part '\${'a'}.dart';"])); |
| 4964 LibraryElement element = buildLibrary(librarySource, [CompileTimeErrorCode.U
RI_WITH_INTERPOLATION]); | 5888 LibraryElement element = buildLibrary(librarySource, [CompileTimeErrorCode.U
RI_WITH_INTERPOLATION]); |
| 4965 JUnitTestCase.assertNotNull(element); | 5889 JUnitTestCase.assertNotNull(element); |
| 4966 } | 5890 } |
| 4967 void test_missingLibraryDirectiveWithPart() { | 5891 void test_missingLibraryDirectiveWithPart() { |
| 4968 addSource("/a.dart", EngineTestCase.createSource(["part of lib;"])); | 5892 addSource("/a.dart", EngineTestCase.createSource(["part of lib;"])); |
| 4969 Source librarySource = addSource("/lib.dart", EngineTestCase.createSource(["
part 'a.dart';"])); | 5893 Source librarySource = addSource("/lib.dart", EngineTestCase.createSource(["
part 'a.dart';"])); |
| 4970 LibraryElement element = buildLibrary(librarySource, [ResolverErrorCode.MISS
ING_LIBRARY_DIRECTIVE_WITH_PART]); | 5894 LibraryElement element = buildLibrary(librarySource, [ResolverErrorCode.MISS
ING_LIBRARY_DIRECTIVE_WITH_PART]); |
| 4971 JUnitTestCase.assertNotNull(element); | 5895 JUnitTestCase.assertNotNull(element); |
| 4972 } | 5896 } |
| 4973 void test_missingPartOfDirective() { | 5897 void test_missingPartOfDirective() { |
| 4974 addSource("/a.dart", "class A {}"); | 5898 addSource("/a.dart", "class A {}"); |
| 4975 Source librarySource = addSource("/lib.dart", EngineTestCase.createSource(["
library lib;", "", "part 'a.dart';"])); | 5899 Source librarySource = addSource("/lib.dart", EngineTestCase.createSource(["
library lib;", "", "part 'a.dart';"])); |
| 4976 LibraryElement element = buildLibrary(librarySource, [ResolverErrorCode.MISS
ING_PART_OF_DIRECTIVE]); | 5900 LibraryElement element = buildLibrary(librarySource, [CompileTimeErrorCode.P
ART_OF_NON_PART]); |
| 4977 JUnitTestCase.assertNotNull(element); | 5901 JUnitTestCase.assertNotNull(element); |
| 4978 } | 5902 } |
| 4979 void test_multipleFiles() { | 5903 void test_multipleFiles() { |
| 4980 Source librarySource = addSource("/lib.dart", EngineTestCase.createSource(["
library lib;", "part 'first.dart';", "part 'second.dart';", "", "class A {}"])); | 5904 Source librarySource = addSource("/lib.dart", EngineTestCase.createSource(["
library lib;", "part 'first.dart';", "part 'second.dart';", "", "class A {}"])); |
| 4981 addSource("/first.dart", EngineTestCase.createSource(["part of lib;", "class
B {}"])); | 5905 addSource("/first.dart", EngineTestCase.createSource(["part of lib;", "class
B {}"])); |
| 4982 addSource("/second.dart", EngineTestCase.createSource(["part of lib;", "clas
s C {}"])); | 5906 addSource("/second.dart", EngineTestCase.createSource(["part of lib;", "clas
s C {}"])); |
| 4983 LibraryElement element = buildLibrary(librarySource, []); | 5907 LibraryElement element = buildLibrary(librarySource, []); |
| 4984 JUnitTestCase.assertNotNull(element); | 5908 JUnitTestCase.assertNotNull(element); |
| 4985 List<CompilationUnitElement> sourcedUnits = element.parts; | 5909 List<CompilationUnitElement> sourcedUnits = element.parts; |
| 4986 EngineTestCase.assertLength(2, sourcedUnits); | 5910 EngineTestCase.assertLength(2, sourcedUnits); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 4999 JUnitTestCase.assertNotNull(element); | 5923 JUnitTestCase.assertNotNull(element); |
| 5000 assertTypes(element.definingCompilationUnit, ["A"]); | 5924 assertTypes(element.definingCompilationUnit, ["A"]); |
| 5001 } | 5925 } |
| 5002 /** | 5926 /** |
| 5003 * Add a source file to the content provider. The file path should be absolute
. | 5927 * Add a source file to the content provider. The file path should be absolute
. |
| 5004 * @param filePath the path of the file being added | 5928 * @param filePath the path of the file being added |
| 5005 * @param contents the contents to be returned by the content provider for the
specified file | 5929 * @param contents the contents to be returned by the content provider for the
specified file |
| 5006 * @return the source object representing the added file | 5930 * @return the source object representing the added file |
| 5007 */ | 5931 */ |
| 5008 Source addSource(String filePath, String contents) { | 5932 Source addSource(String filePath, String contents) { |
| 5009 Source source = new FileBasedSource.con1(_sourceFactory, FileUtilities2.crea
teFile(filePath)); | 5933 Source source = new FileBasedSource.con1(_sourceFactory.contentCache, FileUt
ilities2.createFile(filePath)); |
| 5010 _sourceFactory.setContents(source, contents); | 5934 _sourceFactory.setContents(source, contents); |
| 5011 return source; | 5935 return source; |
| 5012 } | 5936 } |
| 5013 /** | 5937 /** |
| 5014 * Ensure that there are elements representing all of the types in the given a
rray of type names. | 5938 * Ensure that there are elements representing all of the types in the given a
rray of type names. |
| 5015 * @param unit the compilation unit containing the types | 5939 * @param unit the compilation unit containing the types |
| 5016 * @param typeNames the names of the types that should be found | 5940 * @param typeNames the names of the types that should be found |
| 5017 */ | 5941 */ |
| 5018 void assertTypes(CompilationUnitElement unit, List<String> typeNames) { | 5942 void assertTypes(CompilationUnitElement unit, List<String> typeNames) { |
| 5019 JUnitTestCase.assertNotNull(unit); | 5943 JUnitTestCase.assertNotNull(unit); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 5036 /** | 5960 /** |
| 5037 * Build the element model for the library whose defining compilation unit has
the given source. | 5961 * Build the element model for the library whose defining compilation unit has
the given source. |
| 5038 * @param librarySource the source of the defining compilation unit for the li
brary | 5962 * @param librarySource the source of the defining compilation unit for the li
brary |
| 5039 * @param expectedErrorCodes the errors that are expected to be found while bu
ilding the element | 5963 * @param expectedErrorCodes the errors that are expected to be found while bu
ilding the element |
| 5040 * model | 5964 * model |
| 5041 * @return the element model that was built for the library | 5965 * @return the element model that was built for the library |
| 5042 * @throws Exception if the element model could not be built | 5966 * @throws Exception if the element model could not be built |
| 5043 */ | 5967 */ |
| 5044 LibraryElement buildLibrary(Source librarySource, List<ErrorCode> expectedErro
rCodes) { | 5968 LibraryElement buildLibrary(Source librarySource, List<ErrorCode> expectedErro
rCodes) { |
| 5045 AnalysisContextImpl context = new AnalysisContextImpl(); | 5969 AnalysisContextImpl context = new AnalysisContextImpl(); |
| 5046 context.sourceFactory = new SourceFactory.con2([new DartUriResolver(DartSdk.
defaultSdk), new FileUriResolver()]); | 5970 context.sourceFactory = new SourceFactory.con2([new DartUriResolver(Director
yBasedDartSdk.defaultSdk), new FileUriResolver()]); |
| 5047 GatheringErrorListener listener = new GatheringErrorListener(); | 5971 GatheringErrorListener listener = new GatheringErrorListener(); |
| 5048 LibraryResolver resolver = new LibraryResolver.con2(context, listener); | 5972 LibraryResolver resolver = new LibraryResolver.con2(context, listener); |
| 5049 LibraryElementBuilder builder = new LibraryElementBuilder(resolver); | 5973 LibraryElementBuilder builder = new LibraryElementBuilder(resolver); |
| 5050 Library library = resolver.createLibrary(librarySource) as Library; | 5974 Library library = resolver.createLibrary(librarySource) as Library; |
| 5051 LibraryElement element = builder.buildLibrary(library); | 5975 LibraryElement element = builder.buildLibrary(library); |
| 5052 listener.assertErrors2(expectedErrorCodes); | 5976 listener.assertErrors2(expectedErrorCodes); |
| 5053 return element; | 5977 return element; |
| 5054 } | 5978 } |
| 5055 static dartSuite() { | 5979 static dartSuite() { |
| 5056 _ut.group('LibraryElementBuilderTest', () { | 5980 _ut.group('LibraryElementBuilderTest', () { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 5079 runJUnitTest(__test, __test.test_singleFile); | 6003 runJUnitTest(__test, __test.test_singleFile); |
| 5080 }); | 6004 }); |
| 5081 }); | 6005 }); |
| 5082 } | 6006 } |
| 5083 } | 6007 } |
| 5084 class ScopeTest extends ResolverTestCase { | 6008 class ScopeTest extends ResolverTestCase { |
| 5085 void test_define_duplicate() { | 6009 void test_define_duplicate() { |
| 5086 LibraryElement definingLibrary = createTestLibrary(); | 6010 LibraryElement definingLibrary = createTestLibrary(); |
| 5087 GatheringErrorListener errorListener = new GatheringErrorListener(); | 6011 GatheringErrorListener errorListener = new GatheringErrorListener(); |
| 5088 ScopeTest_TestScope scope = new ScopeTest_TestScope(definingLibrary, errorLi
stener); | 6012 ScopeTest_TestScope scope = new ScopeTest_TestScope(definingLibrary, errorLi
stener); |
| 5089 VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.id
entifier2("v1")); | 6013 VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v1")); |
| 5090 VariableElement element2 = ElementFactory.localVariableElement(ASTFactory.id
entifier2("v1")); | 6014 VariableElement element2 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v1")); |
| 5091 scope.define(element1); | 6015 scope.define(element1); |
| 5092 scope.define(element2); | 6016 scope.define(element2); |
| 5093 errorListener.assertErrors3([ErrorSeverity.ERROR]); | 6017 errorListener.assertErrors3([ErrorSeverity.ERROR]); |
| 5094 } | 6018 } |
| 5095 void test_define_normal() { | 6019 void test_define_normal() { |
| 5096 LibraryElement definingLibrary = createTestLibrary(); | 6020 LibraryElement definingLibrary = createTestLibrary(); |
| 5097 GatheringErrorListener errorListener = new GatheringErrorListener(); | 6021 GatheringErrorListener errorListener = new GatheringErrorListener(); |
| 5098 ScopeTest_TestScope scope = new ScopeTest_TestScope(definingLibrary, errorLi
stener); | 6022 ScopeTest_TestScope scope = new ScopeTest_TestScope(definingLibrary, errorLi
stener); |
| 5099 VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.id
entifier2("v1")); | 6023 VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v1")); |
| 5100 VariableElement element2 = ElementFactory.localVariableElement(ASTFactory.id
entifier2("v2")); | 6024 VariableElement element2 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v2")); |
| 5101 scope.define(element1); | 6025 scope.define(element1); |
| 5102 scope.define(element2); | 6026 scope.define(element2); |
| 5103 errorListener.assertNoErrors(); | 6027 errorListener.assertNoErrors(); |
| 5104 } | 6028 } |
| 5105 void test_getDefiningLibrary() { | 6029 void test_getDefiningLibrary() { |
| 5106 LibraryElement definingLibrary = createTestLibrary(); | 6030 LibraryElement definingLibrary = createTestLibrary(); |
| 5107 Scope scope = new ScopeTest_TestScope(definingLibrary, null); | 6031 Scope scope = new ScopeTest_TestScope(definingLibrary, null); |
| 5108 JUnitTestCase.assertEquals(definingLibrary, scope.definingLibrary); | 6032 JUnitTestCase.assertEquals(definingLibrary, scope.definingLibrary); |
| 5109 } | 6033 } |
| 5110 void test_getErrorListener() { | 6034 void test_getErrorListener() { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5168 AnalysisErrorListener get errorListener => _errorListener; | 6092 AnalysisErrorListener get errorListener => _errorListener; |
| 5169 Element lookup3(String name, LibraryElement referencingLibrary) => localLookup
(name, referencingLibrary); | 6093 Element lookup3(String name, LibraryElement referencingLibrary) => localLookup
(name, referencingLibrary); |
| 5170 } | 6094 } |
| 5171 class SimpleResolverTest extends ResolverTestCase { | 6095 class SimpleResolverTest extends ResolverTestCase { |
| 5172 void fail_staticInvocation() { | 6096 void fail_staticInvocation() { |
| 5173 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " static int get g => (a,b) => 0;", "}", "class B {", " f() {", " A.g
(1,0);", " }", "}"])); | 6097 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " static int get g => (a,b) => 0;", "}", "class B {", " f() {", " A.g
(1,0);", " }", "}"])); |
| 5174 resolve(source, []); | 6098 resolve(source, []); |
| 5175 assertNoErrors(); | 6099 assertNoErrors(); |
| 5176 verify([source]); | 6100 verify([source]); |
| 5177 } | 6101 } |
| 6102 void test_class_definesCall() { |
| 6103 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int call(int x) { return x; }", "}", "int f(A a) {", " return a(0);",
"}"])); |
| 6104 resolve(source, []); |
| 6105 assertNoErrors(); |
| 6106 verify([source]); |
| 6107 } |
| 5178 void test_class_extends_implements() { | 6108 void test_class_extends_implements() { |
| 5179 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A extends B implements C {}", "class B {}", "class C {}"])); | 6109 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A extends B implements C {}", "class B {}", "class C {}"])); |
| 5180 resolve(source, []); | 6110 resolve(source, []); |
| 5181 assertNoErrors(); | 6111 assertNoErrors(); |
| 5182 verify([source]); | 6112 verify([source]); |
| 5183 } | 6113 } |
| 5184 void test_empty() { | 6114 void test_empty() { |
| 5185 Source source = addSource("/test.dart", ""); | 6115 Source source = addSource("/test.dart", ""); |
| 5186 resolve(source, []); | 6116 resolve(source, []); |
| 5187 assertNoErrors(); | 6117 assertNoErrors(); |
| 5188 verify([source]); | 6118 verify([source]); |
| 5189 } | 6119 } |
| 6120 void test_extractedMethodAsConstant() { |
| 6121 Source source = addSource("/test.dart", EngineTestCase.createSource(["abstra
ct class Comparable<T> {", " int compareTo(T other);", " static int compare(Co
mparable a, Comparable b) => a.compareTo(b);", "}", "class A {", " void sort([c
ompare = Comparable.compare]) {}", "}"])); |
| 6122 resolve(source, []); |
| 6123 assertNoErrors(); |
| 6124 verify([source]); |
| 6125 } |
| 5190 void test_forEachLoops_nonConflicting() { | 6126 void test_forEachLoops_nonConflicting() { |
| 5191 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " List list = [1,2,3];", " for (int x in list) {}", " for (int x in list) {
}", "}"])); | 6127 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " List list = [1,2,3];", " for (int x in list) {}", " for (int x in list) {
}", "}"])); |
| 5192 resolve(source, []); | 6128 resolve(source, []); |
| 5193 assertNoErrors(); | 6129 assertNoErrors(); |
| 5194 verify([source]); | 6130 verify([source]); |
| 5195 } | 6131 } |
| 5196 void test_forLoops_nonConflicting() { | 6132 void test_forLoops_nonConflicting() { |
| 5197 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " for (int i = 0; i < 3; i++) {", " }", " for (int i = 0; i < 3; i++) {", "
}", "}"])); | 6133 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " for (int i = 0; i < 3; i++) {", " }", " for (int i = 0; i < 3; i++) {", "
}", "}"])); |
| 5198 resolve(source, []); | 6134 resolve(source, []); |
| 5199 assertNoErrors(); | 6135 assertNoErrors(); |
| 5200 verify([source]); | 6136 verify([source]); |
| 5201 } | 6137 } |
| 5202 void test_functionTypeAlias() { | 6138 void test_functionTypeAlias() { |
| 5203 Source source = addSource("/test.dart", EngineTestCase.createSource(["typede
f bool P(e);", "class A {", " P p;", " m(e) {", " if (p(e)) {}", " }", "}"
])); | 6139 Source source = addSource("/test.dart", EngineTestCase.createSource(["typede
f bool P(e);", "class A {", " P p;", " m(e) {", " if (p(e)) {}", " }", "}"
])); |
| 5204 resolve(source, []); | 6140 resolve(source, []); |
| 5205 assertNoErrors(); | 6141 assertNoErrors(); |
| 5206 verify([source]); | 6142 verify([source]); |
| 5207 } | 6143 } |
| 5208 void test_getterAndSetterWithDifferentTypes() { | 6144 void test_getterAndSetterWithDifferentTypes() { |
| 5209 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int get f => 0;", " void set f(String s) {}", "}", "g (A a) {", " a.f
= a.f.toString();", "}"])); | 6145 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int get f => 0;", " void set f(String s) {}", "}", "g (A a) {", " a.f
= a.f.toString();", "}"])); |
| 5210 resolve(source, []); | 6146 resolve(source, []); |
| 5211 assertNoErrors(); | 6147 assertNoErrors(); |
| 5212 verify([source]); | 6148 verify([source]); |
| 5213 } | 6149 } |
| 6150 void test_importWithPrefix() { |
| 6151 addSource("/two.dart", EngineTestCase.createSource(["library two;", "f(int x
) {", " return x * x;", "}"])); |
| 6152 Source source = addSource("/one.dart", EngineTestCase.createSource(["library
one;", "import 'two.dart' as _two;", "main() {", " _two.f(0);", "}"])); |
| 6153 resolve(source, []); |
| 6154 assertNoErrors(); |
| 6155 verify([source]); |
| 6156 } |
| 5214 void test_indexExpression_typeParameters() { | 6157 void test_indexExpression_typeParameters() { |
| 5215 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " List<int> a;", " a[0];", " List<List<int>> b;", " b[0][0];", " List<Lis
t<List<int>>> c;", " c[0][0][0];", "}"])); | 6158 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " List<int> a;", " a[0];", " List<List<int>> b;", " b[0][0];", " List<Lis
t<List<int>>> c;", " c[0][0][0];", "}"])); |
| 5216 resolve(source, []); | 6159 resolve(source, []); |
| 5217 assertNoErrors(); | 6160 assertNoErrors(); |
| 5218 verify([source]); | 6161 verify([source]); |
| 5219 } | 6162 } |
| 5220 void test_indexExpression_typeParameters_invalidAssignmentWarning() { | 6163 void test_indexExpression_typeParameters_invalidAssignmentWarning() { |
| 5221 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " List<List<int>> b;", " b[0][0] = 'hi';", "}"])); | 6164 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " List<List<int>> b;", " b[0][0] = 'hi';", "}"])); |
| 5222 resolve(source, []); | 6165 resolve(source, []); |
| 5223 assertErrors([StaticTypeWarningCode.INVALID_ASSIGNMENT]); | 6166 assertErrors([StaticTypeWarningCode.INVALID_ASSIGNMENT]); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5290 verify([source]); | 6233 verify([source]); |
| 5291 } | 6234 } |
| 5292 void test_resolveAgainstNull() { | 6235 void test_resolveAgainstNull() { |
| 5293 Source source = addSource("/test.dart", EngineTestCase.createSource(["f(var
p) {", " return null == p;", "}"])); | 6236 Source source = addSource("/test.dart", EngineTestCase.createSource(["f(var
p) {", " return null == p;", "}"])); |
| 5294 resolve(source, []); | 6237 resolve(source, []); |
| 5295 assertNoErrors(); | 6238 assertNoErrors(); |
| 5296 verify([source]); | 6239 verify([source]); |
| 5297 } | 6240 } |
| 5298 static dartSuite() { | 6241 static dartSuite() { |
| 5299 _ut.group('SimpleResolverTest', () { | 6242 _ut.group('SimpleResolverTest', () { |
| 6243 _ut.test('test_class_definesCall', () { |
| 6244 final __test = new SimpleResolverTest(); |
| 6245 runJUnitTest(__test, __test.test_class_definesCall); |
| 6246 }); |
| 5300 _ut.test('test_class_extends_implements', () { | 6247 _ut.test('test_class_extends_implements', () { |
| 5301 final __test = new SimpleResolverTest(); | 6248 final __test = new SimpleResolverTest(); |
| 5302 runJUnitTest(__test, __test.test_class_extends_implements); | 6249 runJUnitTest(__test, __test.test_class_extends_implements); |
| 5303 }); | 6250 }); |
| 5304 _ut.test('test_empty', () { | 6251 _ut.test('test_empty', () { |
| 5305 final __test = new SimpleResolverTest(); | 6252 final __test = new SimpleResolverTest(); |
| 5306 runJUnitTest(__test, __test.test_empty); | 6253 runJUnitTest(__test, __test.test_empty); |
| 5307 }); | 6254 }); |
| 6255 _ut.test('test_extractedMethodAsConstant', () { |
| 6256 final __test = new SimpleResolverTest(); |
| 6257 runJUnitTest(__test, __test.test_extractedMethodAsConstant); |
| 6258 }); |
| 5308 _ut.test('test_forEachLoops_nonConflicting', () { | 6259 _ut.test('test_forEachLoops_nonConflicting', () { |
| 5309 final __test = new SimpleResolverTest(); | 6260 final __test = new SimpleResolverTest(); |
| 5310 runJUnitTest(__test, __test.test_forEachLoops_nonConflicting); | 6261 runJUnitTest(__test, __test.test_forEachLoops_nonConflicting); |
| 5311 }); | 6262 }); |
| 5312 _ut.test('test_forLoops_nonConflicting', () { | 6263 _ut.test('test_forLoops_nonConflicting', () { |
| 5313 final __test = new SimpleResolverTest(); | 6264 final __test = new SimpleResolverTest(); |
| 5314 runJUnitTest(__test, __test.test_forLoops_nonConflicting); | 6265 runJUnitTest(__test, __test.test_forLoops_nonConflicting); |
| 5315 }); | 6266 }); |
| 5316 _ut.test('test_functionTypeAlias', () { | 6267 _ut.test('test_functionTypeAlias', () { |
| 5317 final __test = new SimpleResolverTest(); | 6268 final __test = new SimpleResolverTest(); |
| 5318 runJUnitTest(__test, __test.test_functionTypeAlias); | 6269 runJUnitTest(__test, __test.test_functionTypeAlias); |
| 5319 }); | 6270 }); |
| 5320 _ut.test('test_getterAndSetterWithDifferentTypes', () { | 6271 _ut.test('test_getterAndSetterWithDifferentTypes', () { |
| 5321 final __test = new SimpleResolverTest(); | 6272 final __test = new SimpleResolverTest(); |
| 5322 runJUnitTest(__test, __test.test_getterAndSetterWithDifferentTypes); | 6273 runJUnitTest(__test, __test.test_getterAndSetterWithDifferentTypes); |
| 5323 }); | 6274 }); |
| 6275 _ut.test('test_importWithPrefix', () { |
| 6276 final __test = new SimpleResolverTest(); |
| 6277 runJUnitTest(__test, __test.test_importWithPrefix); |
| 6278 }); |
| 5324 _ut.test('test_indexExpression_typeParameters', () { | 6279 _ut.test('test_indexExpression_typeParameters', () { |
| 5325 final __test = new SimpleResolverTest(); | 6280 final __test = new SimpleResolverTest(); |
| 5326 runJUnitTest(__test, __test.test_indexExpression_typeParameters); | 6281 runJUnitTest(__test, __test.test_indexExpression_typeParameters); |
| 5327 }); | 6282 }); |
| 5328 _ut.test('test_indexExpression_typeParameters_invalidAssignmentWarning', (
) { | 6283 _ut.test('test_indexExpression_typeParameters_invalidAssignmentWarning', (
) { |
| 5329 final __test = new SimpleResolverTest(); | 6284 final __test = new SimpleResolverTest(); |
| 5330 runJUnitTest(__test, __test.test_indexExpression_typeParameters_invalidA
ssignmentWarning); | 6285 runJUnitTest(__test, __test.test_indexExpression_typeParameters_invalidA
ssignmentWarning); |
| 5331 }); | 6286 }); |
| 5332 _ut.test('test_invoke_dynamicThroughGetter', () { | 6287 _ut.test('test_invoke_dynamicThroughGetter', () { |
| 5333 final __test = new SimpleResolverTest(); | 6288 final __test = new SimpleResolverTest(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 5358 runJUnitTest(__test, __test.test_methodCascades_withSetter); | 6313 runJUnitTest(__test, __test.test_methodCascades_withSetter); |
| 5359 }); | 6314 }); |
| 5360 _ut.test('test_resolveAgainstNull', () { | 6315 _ut.test('test_resolveAgainstNull', () { |
| 5361 final __test = new SimpleResolverTest(); | 6316 final __test = new SimpleResolverTest(); |
| 5362 runJUnitTest(__test, __test.test_resolveAgainstNull); | 6317 runJUnitTest(__test, __test.test_resolveAgainstNull); |
| 5363 }); | 6318 }); |
| 5364 }); | 6319 }); |
| 5365 } | 6320 } |
| 5366 } | 6321 } |
| 5367 main() { | 6322 main() { |
| 5368 // ElementResolverTest.dartSuite(); | 6323 ElementResolverTest.dartSuite(); |
| 5369 // LibraryElementBuilderTest.dartSuite(); | 6324 LibraryElementBuilderTest.dartSuite(); |
| 5370 // LibraryTest.dartSuite(); | 6325 LibraryTest.dartSuite(); |
| 5371 // StaticTypeAnalyzerTest.dartSuite(); | 6326 StaticTypeAnalyzerTest.dartSuite(); |
| 5372 // TypeProviderImplTest.dartSuite(); | 6327 TypeOverrideManagerTest.dartSuite(); |
| 5373 // TypeResolverVisitorTest.dartSuite(); | 6328 TypeProviderImplTest.dartSuite(); |
| 5374 // EnclosedScopeTest.dartSuite(); | 6329 TypeResolverVisitorTest.dartSuite(); |
| 5375 // LibraryImportScopeTest.dartSuite(); | 6330 EnclosedScopeTest.dartSuite(); |
| 5376 // LibraryScopeTest.dartSuite(); | 6331 LibraryImportScopeTest.dartSuite(); |
| 5377 // ScopeTest.dartSuite(); | 6332 LibraryScopeTest.dartSuite(); |
| 5378 // CompileTimeErrorCodeTest.dartSuite(); | 6333 ScopeTest.dartSuite(); |
| 5379 // ErrorResolverTest.dartSuite(); | 6334 CompileTimeErrorCodeTest.dartSuite(); |
| 5380 // NonErrorResolverTest.dartSuite(); | 6335 ErrorResolverTest.dartSuite(); |
| 5381 // SimpleResolverTest.dartSuite(); | 6336 NonErrorResolverTest.dartSuite(); |
| 5382 // StaticTypeWarningCodeTest.dartSuite(); | 6337 SimpleResolverTest.dartSuite(); |
| 5383 // StaticWarningCodeTest.dartSuite(); | 6338 StaticTypeWarningCodeTest.dartSuite(); |
| 6339 StaticWarningCodeTest.dartSuite(); |
| 6340 TypePropagationTest.dartSuite(); |
| 5384 } | 6341 } |
| OLD | NEW |