OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
7 | 7 |
8 library engine.all_the_rest_test; | 8 library engine.all_the_rest_test; |
9 | 9 |
10 import 'package:analyzer/file_system/physical_file_system.dart'; | 10 import 'package:analyzer/file_system/physical_file_system.dart'; |
(...skipping 5373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5384 declaration.accept(builder); | 5384 declaration.accept(builder); |
5385 List<FunctionElement> functions = holder.functions; | 5385 List<FunctionElement> functions = holder.functions; |
5386 expect(functions, hasLength(1)); | 5386 expect(functions, hasLength(1)); |
5387 FunctionElement function = functions[0]; | 5387 FunctionElement function = functions[0]; |
5388 expect(function, isNotNull); | 5388 expect(function, isNotNull); |
5389 expect(function.name, functionName); | 5389 expect(function.name, functionName); |
5390 expect(declaration.element, same(function)); | 5390 expect(declaration.element, same(function)); |
5391 expect(declaration.functionExpression.element, same(function)); | 5391 expect(declaration.functionExpression.element, same(function)); |
5392 expect(function.isExternal, isTrue); | 5392 expect(function.isExternal, isTrue); |
5393 expect(function.isSynthetic, isFalse); | 5393 expect(function.isSynthetic, isFalse); |
| 5394 expect(function.typeParameters, hasLength(0)); |
5394 } | 5395 } |
5395 | 5396 |
5396 void test_visitFunctionDeclaration_getter() { | 5397 void test_visitFunctionDeclaration_getter() { |
5397 ElementHolder holder = new ElementHolder(); | 5398 ElementHolder holder = new ElementHolder(); |
5398 ElementBuilder builder = new ElementBuilder(holder); | 5399 ElementBuilder builder = new ElementBuilder(holder); |
5399 String functionName = "f"; | 5400 String functionName = "f"; |
5400 FunctionDeclaration declaration = AstFactory.functionDeclaration(null, | 5401 FunctionDeclaration declaration = AstFactory.functionDeclaration(null, |
5401 Keyword.GET, functionName, AstFactory.functionExpression2( | 5402 Keyword.GET, functionName, AstFactory.functionExpression2( |
5402 AstFactory.formalParameterList(), AstFactory.blockFunctionBody2())); | 5403 AstFactory.formalParameterList(), AstFactory.blockFunctionBody2())); |
5403 declaration.accept(builder); | 5404 declaration.accept(builder); |
5404 List<PropertyAccessorElement> accessors = holder.accessors; | 5405 List<PropertyAccessorElement> accessors = holder.accessors; |
5405 expect(accessors, hasLength(1)); | 5406 expect(accessors, hasLength(1)); |
5406 PropertyAccessorElement accessor = accessors[0]; | 5407 PropertyAccessorElement accessor = accessors[0]; |
5407 expect(accessor, isNotNull); | 5408 expect(accessor, isNotNull); |
5408 expect(accessor.name, functionName); | 5409 expect(accessor.name, functionName); |
5409 expect(declaration.element, same(accessor)); | 5410 expect(declaration.element, same(accessor)); |
5410 expect(declaration.functionExpression.element, same(accessor)); | 5411 expect(declaration.functionExpression.element, same(accessor)); |
5411 expect(accessor.isGetter, isTrue); | 5412 expect(accessor.isGetter, isTrue); |
5412 expect(accessor.isExternal, isFalse); | 5413 expect(accessor.isExternal, isFalse); |
5413 expect(accessor.isSetter, isFalse); | 5414 expect(accessor.isSetter, isFalse); |
5414 expect(accessor.isSynthetic, isFalse); | 5415 expect(accessor.isSynthetic, isFalse); |
| 5416 expect(accessor.typeParameters, hasLength(0)); |
5415 PropertyInducingElement variable = accessor.variable; | 5417 PropertyInducingElement variable = accessor.variable; |
5416 EngineTestCase.assertInstanceOf((obj) => obj is TopLevelVariableElement, | 5418 EngineTestCase.assertInstanceOf((obj) => obj is TopLevelVariableElement, |
5417 TopLevelVariableElement, variable); | 5419 TopLevelVariableElement, variable); |
5418 expect(variable.isSynthetic, isTrue); | 5420 expect(variable.isSynthetic, isTrue); |
5419 } | 5421 } |
5420 | 5422 |
5421 void test_visitFunctionDeclaration_plain() { | 5423 void test_visitFunctionDeclaration_plain() { |
5422 ElementHolder holder = new ElementHolder(); | 5424 ElementHolder holder = new ElementHolder(); |
5423 ElementBuilder builder = new ElementBuilder(holder); | 5425 ElementBuilder builder = new ElementBuilder(holder); |
5424 String functionName = "f"; | 5426 String functionName = "f"; |
5425 FunctionDeclaration declaration = AstFactory.functionDeclaration(null, null, | 5427 FunctionDeclaration declaration = AstFactory.functionDeclaration(null, null, |
5426 functionName, AstFactory.functionExpression2( | 5428 functionName, AstFactory.functionExpression2( |
5427 AstFactory.formalParameterList(), AstFactory.blockFunctionBody2())); | 5429 AstFactory.formalParameterList(), AstFactory.blockFunctionBody2())); |
5428 declaration.accept(builder); | 5430 declaration.accept(builder); |
5429 List<FunctionElement> functions = holder.functions; | 5431 List<FunctionElement> functions = holder.functions; |
5430 expect(functions, hasLength(1)); | 5432 expect(functions, hasLength(1)); |
5431 FunctionElement function = functions[0]; | 5433 FunctionElement function = functions[0]; |
5432 expect(function, isNotNull); | 5434 expect(function, isNotNull); |
5433 expect(function.name, functionName); | 5435 expect(function.name, functionName); |
5434 expect(declaration.element, same(function)); | 5436 expect(declaration.element, same(function)); |
5435 expect(declaration.functionExpression.element, same(function)); | 5437 expect(declaration.functionExpression.element, same(function)); |
5436 expect(function.isExternal, isFalse); | 5438 expect(function.isExternal, isFalse); |
5437 expect(function.isSynthetic, isFalse); | 5439 expect(function.isSynthetic, isFalse); |
| 5440 expect(function.typeParameters, hasLength(0)); |
5438 } | 5441 } |
5439 | 5442 |
5440 void test_visitFunctionDeclaration_setter() { | 5443 void test_visitFunctionDeclaration_setter() { |
5441 ElementHolder holder = new ElementHolder(); | 5444 ElementHolder holder = new ElementHolder(); |
5442 ElementBuilder builder = new ElementBuilder(holder); | 5445 ElementBuilder builder = new ElementBuilder(holder); |
5443 String functionName = "f"; | 5446 String functionName = "f"; |
5444 FunctionDeclaration declaration = AstFactory.functionDeclaration(null, | 5447 FunctionDeclaration declaration = AstFactory.functionDeclaration(null, |
5445 Keyword.SET, functionName, AstFactory.functionExpression2( | 5448 Keyword.SET, functionName, AstFactory.functionExpression2( |
5446 AstFactory.formalParameterList(), AstFactory.blockFunctionBody2())); | 5449 AstFactory.formalParameterList(), AstFactory.blockFunctionBody2())); |
5447 declaration.accept(builder); | 5450 declaration.accept(builder); |
5448 List<PropertyAccessorElement> accessors = holder.accessors; | 5451 List<PropertyAccessorElement> accessors = holder.accessors; |
5449 expect(accessors, hasLength(1)); | 5452 expect(accessors, hasLength(1)); |
5450 PropertyAccessorElement accessor = accessors[0]; | 5453 PropertyAccessorElement accessor = accessors[0]; |
5451 expect(accessor, isNotNull); | 5454 expect(accessor, isNotNull); |
5452 expect(accessor.name, "$functionName="); | 5455 expect(accessor.name, "$functionName="); |
5453 expect(declaration.element, same(accessor)); | 5456 expect(declaration.element, same(accessor)); |
5454 expect(declaration.functionExpression.element, same(accessor)); | 5457 expect(declaration.functionExpression.element, same(accessor)); |
5455 expect(accessor.isGetter, isFalse); | 5458 expect(accessor.isGetter, isFalse); |
5456 expect(accessor.isExternal, isFalse); | 5459 expect(accessor.isExternal, isFalse); |
5457 expect(accessor.isSetter, isTrue); | 5460 expect(accessor.isSetter, isTrue); |
5458 expect(accessor.isSynthetic, isFalse); | 5461 expect(accessor.isSynthetic, isFalse); |
| 5462 expect(accessor.typeParameters, hasLength(0)); |
5459 PropertyInducingElement variable = accessor.variable; | 5463 PropertyInducingElement variable = accessor.variable; |
5460 EngineTestCase.assertInstanceOf((obj) => obj is TopLevelVariableElement, | 5464 EngineTestCase.assertInstanceOf((obj) => obj is TopLevelVariableElement, |
5461 TopLevelVariableElement, variable); | 5465 TopLevelVariableElement, variable); |
5462 expect(variable.isSynthetic, isTrue); | 5466 expect(variable.isSynthetic, isTrue); |
5463 } | 5467 } |
5464 | 5468 |
| 5469 void test_visitFunctionDeclaration_typeParameters() { |
| 5470 ElementHolder holder = new ElementHolder(); |
| 5471 ElementBuilder builder = new ElementBuilder(holder); |
| 5472 String functionName = 'f'; |
| 5473 String typeParameterName = 'E'; |
| 5474 FunctionExpression expression = AstFactory.functionExpression3( |
| 5475 AstFactory.typeParameterList([typeParameterName]), |
| 5476 AstFactory.formalParameterList(), AstFactory.blockFunctionBody2()); |
| 5477 FunctionDeclaration declaration = |
| 5478 AstFactory.functionDeclaration(null, null, functionName, expression); |
| 5479 declaration.accept(builder); |
| 5480 List<FunctionElement> functions = holder.functions; |
| 5481 expect(functions, hasLength(1)); |
| 5482 FunctionElement function = functions[0]; |
| 5483 expect(function, isNotNull); |
| 5484 expect(function.name, functionName); |
| 5485 expect(function.isExternal, isFalse); |
| 5486 expect(function.isSynthetic, isFalse); |
| 5487 expect(declaration.element, same(function)); |
| 5488 expect(expression.element, same(function)); |
| 5489 List<TypeParameterElement> typeParameters = function.typeParameters; |
| 5490 expect(typeParameters, hasLength(1)); |
| 5491 TypeParameterElement typeParameter = typeParameters[0]; |
| 5492 expect(typeParameter, isNotNull); |
| 5493 expect(typeParameter.name, typeParameterName); |
| 5494 } |
| 5495 |
5465 void test_visitFunctionExpression() { | 5496 void test_visitFunctionExpression() { |
5466 ElementHolder holder = new ElementHolder(); | 5497 ElementHolder holder = new ElementHolder(); |
5467 ElementBuilder builder = new ElementBuilder(holder); | 5498 ElementBuilder builder = new ElementBuilder(holder); |
5468 FunctionExpression expression = AstFactory.functionExpression2( | 5499 FunctionExpression expression = AstFactory.functionExpression2( |
5469 AstFactory.formalParameterList(), AstFactory.blockFunctionBody2()); | 5500 AstFactory.formalParameterList(), AstFactory.blockFunctionBody2()); |
5470 expression.accept(builder); | 5501 expression.accept(builder); |
5471 List<FunctionElement> functions = holder.functions; | 5502 List<FunctionElement> functions = holder.functions; |
5472 expect(functions, hasLength(1)); | 5503 expect(functions, hasLength(1)); |
5473 FunctionElement function = functions[0]; | 5504 FunctionElement function = functions[0]; |
5474 expect(function, isNotNull); | 5505 expect(function, isNotNull); |
5475 expect(expression.element, same(function)); | 5506 expect(expression.element, same(function)); |
5476 expect(function.isSynthetic, isFalse); | 5507 expect(function.isSynthetic, isFalse); |
| 5508 expect(function.typeParameters, hasLength(0)); |
5477 } | 5509 } |
5478 | 5510 |
5479 void test_visitFunctionTypeAlias() { | 5511 void test_visitFunctionTypeAlias() { |
5480 ElementHolder holder = new ElementHolder(); | 5512 ElementHolder holder = new ElementHolder(); |
5481 ElementBuilder builder = new ElementBuilder(holder); | 5513 ElementBuilder builder = new ElementBuilder(holder); |
5482 String aliasName = "F"; | 5514 String aliasName = "F"; |
5483 String parameterName = "E"; | 5515 String parameterName = "E"; |
5484 FunctionTypeAlias aliasNode = AstFactory.typeAlias( | 5516 FunctionTypeAlias aliasNode = AstFactory.typeAlias( |
5485 null, aliasName, AstFactory.typeParameterList([parameterName]), null); | 5517 null, aliasName, AstFactory.typeParameterList([parameterName]), null); |
5486 aliasNode.accept(builder); | 5518 aliasNode.accept(builder); |
(...skipping 21 matching lines...) Expand all Loading... |
5508 List<ParameterElement> parameters = holder.parameters; | 5540 List<ParameterElement> parameters = holder.parameters; |
5509 expect(parameters, hasLength(1)); | 5541 expect(parameters, hasLength(1)); |
5510 ParameterElement parameter = parameters[0]; | 5542 ParameterElement parameter = parameters[0]; |
5511 expect(parameter, isNotNull); | 5543 expect(parameter, isNotNull); |
5512 expect(parameter.name, parameterName); | 5544 expect(parameter.name, parameterName); |
5513 expect(parameter.initializer, isNull); | 5545 expect(parameter.initializer, isNull); |
5514 expect(parameter.isConst, isFalse); | 5546 expect(parameter.isConst, isFalse); |
5515 expect(parameter.isFinal, isFalse); | 5547 expect(parameter.isFinal, isFalse); |
5516 expect(parameter.isSynthetic, isFalse); | 5548 expect(parameter.isSynthetic, isFalse); |
5517 expect(parameter.parameterKind, ParameterKind.REQUIRED); | 5549 expect(parameter.parameterKind, ParameterKind.REQUIRED); |
5518 { | 5550 SourceRange visibleRange = parameter.visibleRange; |
5519 SourceRange visibleRange = parameter.visibleRange; | 5551 expect(100, visibleRange.offset); |
5520 expect(100, visibleRange.offset); | 5552 expect(110, visibleRange.end); |
5521 expect(110, visibleRange.end); | 5553 } |
5522 } | 5554 |
| 5555 void test_visitFunctionTypedFormalParameter_withTypeParameters() { |
| 5556 ElementHolder holder = new ElementHolder(); |
| 5557 ElementBuilder builder = new ElementBuilder(holder); |
| 5558 String parameterName = "p"; |
| 5559 FunctionTypedFormalParameter formalParameter = |
| 5560 AstFactory.functionTypedFormalParameter(null, parameterName); |
| 5561 formalParameter.typeParameters = AstFactory.typeParameterList(['F']); |
| 5562 _useParameterInMethod(formalParameter, 100, 110); |
| 5563 formalParameter.accept(builder); |
| 5564 List<ParameterElement> parameters = holder.parameters; |
| 5565 expect(parameters, hasLength(1)); |
| 5566 ParameterElement parameter = parameters[0]; |
| 5567 expect(parameter, isNotNull); |
| 5568 expect(parameter.name, parameterName); |
| 5569 expect(parameter.initializer, isNull); |
| 5570 expect(parameter.isConst, isFalse); |
| 5571 expect(parameter.isFinal, isFalse); |
| 5572 expect(parameter.isSynthetic, isFalse); |
| 5573 expect(parameter.parameterKind, ParameterKind.REQUIRED); |
| 5574 expect(parameter.typeParameters, hasLength(1)); |
| 5575 SourceRange visibleRange = parameter.visibleRange; |
| 5576 expect(100, visibleRange.offset); |
| 5577 expect(110, visibleRange.end); |
5523 } | 5578 } |
5524 | 5579 |
5525 void test_visitLabeledStatement() { | 5580 void test_visitLabeledStatement() { |
5526 ElementHolder holder = new ElementHolder(); | 5581 ElementHolder holder = new ElementHolder(); |
5527 ElementBuilder builder = new ElementBuilder(holder); | 5582 ElementBuilder builder = new ElementBuilder(holder); |
5528 String labelName = "l"; | 5583 String labelName = "l"; |
5529 LabeledStatement statement = AstFactory.labeledStatement( | 5584 LabeledStatement statement = AstFactory.labeledStatement( |
5530 [AstFactory.label2(labelName)], AstFactory.breakStatement()); | 5585 [AstFactory.label2(labelName)], AstFactory.breakStatement()); |
5531 statement.accept(builder); | 5586 statement.accept(builder); |
5532 List<LabelElement> labels = holder.labels; | 5587 List<LabelElement> labels = holder.labels; |
(...skipping 14 matching lines...) Expand all Loading... |
5547 methodDeclaration.accept(builder); | 5602 methodDeclaration.accept(builder); |
5548 List<MethodElement> methods = holder.methods; | 5603 List<MethodElement> methods = holder.methods; |
5549 expect(methods, hasLength(1)); | 5604 expect(methods, hasLength(1)); |
5550 MethodElement method = methods[0]; | 5605 MethodElement method = methods[0]; |
5551 expect(method, isNotNull); | 5606 expect(method, isNotNull); |
5552 expect(method.name, methodName); | 5607 expect(method.name, methodName); |
5553 expect(method.functions, hasLength(0)); | 5608 expect(method.functions, hasLength(0)); |
5554 expect(method.labels, hasLength(0)); | 5609 expect(method.labels, hasLength(0)); |
5555 expect(method.localVariables, hasLength(0)); | 5610 expect(method.localVariables, hasLength(0)); |
5556 expect(method.parameters, hasLength(0)); | 5611 expect(method.parameters, hasLength(0)); |
| 5612 expect(method.typeParameters, hasLength(0)); |
5557 expect(method.isAbstract, isTrue); | 5613 expect(method.isAbstract, isTrue); |
5558 expect(method.isExternal, isFalse); | 5614 expect(method.isExternal, isFalse); |
5559 expect(method.isStatic, isFalse); | 5615 expect(method.isStatic, isFalse); |
5560 expect(method.isSynthetic, isFalse); | 5616 expect(method.isSynthetic, isFalse); |
5561 } | 5617 } |
5562 | 5618 |
5563 void test_visitMethodDeclaration_external() { | 5619 void test_visitMethodDeclaration_external() { |
5564 ElementHolder holder = new ElementHolder(); | 5620 ElementHolder holder = new ElementHolder(); |
5565 ElementBuilder builder = new ElementBuilder(holder); | 5621 ElementBuilder builder = new ElementBuilder(holder); |
5566 String methodName = "m"; | 5622 String methodName = "m"; |
5567 MethodDeclaration methodDeclaration = AstFactory.methodDeclaration2(null, | 5623 MethodDeclaration methodDeclaration = AstFactory.methodDeclaration2(null, |
5568 null, null, null, AstFactory.identifier3(methodName), | 5624 null, null, null, AstFactory.identifier3(methodName), |
5569 AstFactory.formalParameterList(), AstFactory.emptyFunctionBody()); | 5625 AstFactory.formalParameterList(), AstFactory.emptyFunctionBody()); |
5570 methodDeclaration.externalKeyword = | 5626 methodDeclaration.externalKeyword = |
5571 TokenFactory.tokenFromKeyword(Keyword.EXTERNAL); | 5627 TokenFactory.tokenFromKeyword(Keyword.EXTERNAL); |
5572 methodDeclaration.accept(builder); | 5628 methodDeclaration.accept(builder); |
5573 List<MethodElement> methods = holder.methods; | 5629 List<MethodElement> methods = holder.methods; |
5574 expect(methods, hasLength(1)); | 5630 expect(methods, hasLength(1)); |
5575 MethodElement method = methods[0]; | 5631 MethodElement method = methods[0]; |
5576 expect(method, isNotNull); | 5632 expect(method, isNotNull); |
5577 expect(method.name, methodName); | 5633 expect(method.name, methodName); |
5578 expect(method.functions, hasLength(0)); | 5634 expect(method.functions, hasLength(0)); |
5579 expect(method.labels, hasLength(0)); | 5635 expect(method.labels, hasLength(0)); |
5580 expect(method.localVariables, hasLength(0)); | 5636 expect(method.localVariables, hasLength(0)); |
5581 expect(method.parameters, hasLength(0)); | 5637 expect(method.parameters, hasLength(0)); |
| 5638 expect(method.typeParameters, hasLength(0)); |
5582 expect(method.isAbstract, isFalse); | 5639 expect(method.isAbstract, isFalse); |
5583 expect(method.isExternal, isTrue); | 5640 expect(method.isExternal, isTrue); |
5584 expect(method.isStatic, isFalse); | 5641 expect(method.isStatic, isFalse); |
5585 expect(method.isSynthetic, isFalse); | 5642 expect(method.isSynthetic, isFalse); |
5586 } | 5643 } |
5587 | 5644 |
5588 void test_visitMethodDeclaration_getter() { | 5645 void test_visitMethodDeclaration_getter() { |
5589 ElementHolder holder = new ElementHolder(); | 5646 ElementHolder holder = new ElementHolder(); |
5590 ElementBuilder builder = new ElementBuilder(holder); | 5647 ElementBuilder builder = new ElementBuilder(holder); |
5591 String methodName = "m"; | 5648 String methodName = "m"; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5684 methodDeclaration.accept(builder); | 5741 methodDeclaration.accept(builder); |
5685 List<MethodElement> methods = holder.methods; | 5742 List<MethodElement> methods = holder.methods; |
5686 expect(methods, hasLength(1)); | 5743 expect(methods, hasLength(1)); |
5687 MethodElement method = methods[0]; | 5744 MethodElement method = methods[0]; |
5688 expect(method, isNotNull); | 5745 expect(method, isNotNull); |
5689 expect(method.name, methodName); | 5746 expect(method.name, methodName); |
5690 expect(method.functions, hasLength(0)); | 5747 expect(method.functions, hasLength(0)); |
5691 expect(method.labels, hasLength(0)); | 5748 expect(method.labels, hasLength(0)); |
5692 expect(method.localVariables, hasLength(0)); | 5749 expect(method.localVariables, hasLength(0)); |
5693 expect(method.parameters, hasLength(0)); | 5750 expect(method.parameters, hasLength(0)); |
| 5751 expect(method.typeParameters, hasLength(0)); |
5694 expect(method.isAbstract, isFalse); | 5752 expect(method.isAbstract, isFalse); |
5695 expect(method.isExternal, isFalse); | 5753 expect(method.isExternal, isFalse); |
5696 expect(method.isStatic, isFalse); | 5754 expect(method.isStatic, isFalse); |
5697 expect(method.isSynthetic, isFalse); | 5755 expect(method.isSynthetic, isFalse); |
5698 } | 5756 } |
5699 | 5757 |
5700 void test_visitMethodDeclaration_operator() { | 5758 void test_visitMethodDeclaration_operator() { |
5701 ElementHolder holder = new ElementHolder(); | 5759 ElementHolder holder = new ElementHolder(); |
5702 ElementBuilder builder = new ElementBuilder(holder); | 5760 ElementBuilder builder = new ElementBuilder(holder); |
5703 String methodName = "+"; | 5761 String methodName = "+"; |
5704 MethodDeclaration methodDeclaration = AstFactory.methodDeclaration2(null, | 5762 MethodDeclaration methodDeclaration = AstFactory.methodDeclaration2(null, |
5705 null, null, Keyword.OPERATOR, AstFactory.identifier3(methodName), | 5763 null, null, Keyword.OPERATOR, AstFactory.identifier3(methodName), |
5706 AstFactory | 5764 AstFactory |
5707 .formalParameterList([AstFactory.simpleFormalParameter3("addend")]), | 5765 .formalParameterList([AstFactory.simpleFormalParameter3("addend")]), |
5708 AstFactory.blockFunctionBody2()); | 5766 AstFactory.blockFunctionBody2()); |
5709 methodDeclaration.accept(builder); | 5767 methodDeclaration.accept(builder); |
5710 List<MethodElement> methods = holder.methods; | 5768 List<MethodElement> methods = holder.methods; |
5711 expect(methods, hasLength(1)); | 5769 expect(methods, hasLength(1)); |
5712 MethodElement method = methods[0]; | 5770 MethodElement method = methods[0]; |
5713 expect(method, isNotNull); | 5771 expect(method, isNotNull); |
5714 expect(method.name, methodName); | 5772 expect(method.name, methodName); |
5715 expect(method.functions, hasLength(0)); | 5773 expect(method.functions, hasLength(0)); |
5716 expect(method.labels, hasLength(0)); | 5774 expect(method.labels, hasLength(0)); |
5717 expect(method.localVariables, hasLength(0)); | 5775 expect(method.localVariables, hasLength(0)); |
5718 expect(method.parameters, hasLength(1)); | 5776 expect(method.parameters, hasLength(1)); |
| 5777 expect(method.typeParameters, hasLength(0)); |
5719 expect(method.isAbstract, isFalse); | 5778 expect(method.isAbstract, isFalse); |
5720 expect(method.isExternal, isFalse); | 5779 expect(method.isExternal, isFalse); |
5721 expect(method.isStatic, isFalse); | 5780 expect(method.isStatic, isFalse); |
5722 expect(method.isSynthetic, isFalse); | 5781 expect(method.isSynthetic, isFalse); |
5723 } | 5782 } |
5724 | 5783 |
5725 void test_visitMethodDeclaration_setter() { | 5784 void test_visitMethodDeclaration_setter() { |
5726 ElementHolder holder = new ElementHolder(); | 5785 ElementHolder holder = new ElementHolder(); |
5727 ElementBuilder builder = new ElementBuilder(holder); | 5786 ElementBuilder builder = new ElementBuilder(holder); |
5728 String methodName = "m"; | 5787 String methodName = "m"; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5824 methodDeclaration.accept(builder); | 5883 methodDeclaration.accept(builder); |
5825 List<MethodElement> methods = holder.methods; | 5884 List<MethodElement> methods = holder.methods; |
5826 expect(methods, hasLength(1)); | 5885 expect(methods, hasLength(1)); |
5827 MethodElement method = methods[0]; | 5886 MethodElement method = methods[0]; |
5828 expect(method, isNotNull); | 5887 expect(method, isNotNull); |
5829 expect(method.name, methodName); | 5888 expect(method.name, methodName); |
5830 expect(method.functions, hasLength(0)); | 5889 expect(method.functions, hasLength(0)); |
5831 expect(method.labels, hasLength(0)); | 5890 expect(method.labels, hasLength(0)); |
5832 expect(method.localVariables, hasLength(0)); | 5891 expect(method.localVariables, hasLength(0)); |
5833 expect(method.parameters, hasLength(0)); | 5892 expect(method.parameters, hasLength(0)); |
| 5893 expect(method.typeParameters, hasLength(0)); |
5834 expect(method.isAbstract, isFalse); | 5894 expect(method.isAbstract, isFalse); |
5835 expect(method.isExternal, isFalse); | 5895 expect(method.isExternal, isFalse); |
5836 expect(method.isStatic, isTrue); | 5896 expect(method.isStatic, isTrue); |
5837 expect(method.isSynthetic, isFalse); | 5897 expect(method.isSynthetic, isFalse); |
5838 } | 5898 } |
5839 | 5899 |
| 5900 void test_visitMethodDeclaration_typeParameters() { |
| 5901 ElementHolder holder = new ElementHolder(); |
| 5902 ElementBuilder builder = new ElementBuilder(holder); |
| 5903 String methodName = "m"; |
| 5904 MethodDeclaration methodDeclaration = AstFactory.methodDeclaration2(null, |
| 5905 null, null, null, AstFactory.identifier3(methodName), |
| 5906 AstFactory.formalParameterList(), AstFactory.blockFunctionBody2()); |
| 5907 methodDeclaration.typeParameters = AstFactory.typeParameterList(['E']); |
| 5908 methodDeclaration.accept(builder); |
| 5909 List<MethodElement> methods = holder.methods; |
| 5910 expect(methods, hasLength(1)); |
| 5911 MethodElement method = methods[0]; |
| 5912 expect(method, isNotNull); |
| 5913 expect(method.name, methodName); |
| 5914 expect(method.functions, hasLength(0)); |
| 5915 expect(method.labels, hasLength(0)); |
| 5916 expect(method.localVariables, hasLength(0)); |
| 5917 expect(method.parameters, hasLength(0)); |
| 5918 expect(method.typeParameters, hasLength(1)); |
| 5919 expect(method.isAbstract, isFalse); |
| 5920 expect(method.isExternal, isFalse); |
| 5921 expect(method.isStatic, isFalse); |
| 5922 expect(method.isSynthetic, isFalse); |
| 5923 } |
| 5924 |
5840 void test_visitMethodDeclaration_withMembers() { | 5925 void test_visitMethodDeclaration_withMembers() { |
5841 ElementHolder holder = new ElementHolder(); | 5926 ElementHolder holder = new ElementHolder(); |
5842 ElementBuilder builder = new ElementBuilder(holder); | 5927 ElementBuilder builder = new ElementBuilder(holder); |
5843 String methodName = "m"; | 5928 String methodName = "m"; |
5844 String parameterName = "p"; | 5929 String parameterName = "p"; |
5845 String localVariableName = "v"; | 5930 String localVariableName = "v"; |
5846 String labelName = "l"; | 5931 String labelName = "l"; |
5847 String exceptionParameterName = "e"; | 5932 String exceptionParameterName = "e"; |
5848 MethodDeclaration methodDeclaration = AstFactory.methodDeclaration2(null, | 5933 MethodDeclaration methodDeclaration = AstFactory.methodDeclaration2(null, |
5849 null, null, null, AstFactory.identifier3(methodName), AstFactory | 5934 null, null, null, AstFactory.identifier3(methodName), AstFactory |
5850 .formalParameterList( | 5935 .formalParameterList( |
5851 [AstFactory.simpleFormalParameter3(parameterName)]), AstFactory | 5936 [AstFactory.simpleFormalParameter3(parameterName)]), AstFactory |
5852 .blockFunctionBody2([ | 5937 .blockFunctionBody2([ |
5853 AstFactory.variableDeclarationStatement2( | 5938 AstFactory.variableDeclarationStatement2( |
5854 Keyword.VAR, [AstFactory.variableDeclaration(localVariableName)]), | 5939 Keyword.VAR, [AstFactory.variableDeclaration(localVariableName)]), |
5855 AstFactory.tryStatement2(AstFactory.block([ | 5940 AstFactory.tryStatement2(AstFactory.block([ |
5856 AstFactory.labeledStatement( | 5941 AstFactory.labeledStatement( |
5857 [AstFactory.label2(labelName)], AstFactory.returnStatement()) | 5942 [AstFactory.label2(labelName)], AstFactory.returnStatement()) |
5858 ]), [AstFactory.catchClause(exceptionParameterName)]) | 5943 ]), [AstFactory.catchClause(exceptionParameterName)]) |
5859 ])); | 5944 ])); |
5860 methodDeclaration.accept(builder); | 5945 methodDeclaration.accept(builder); |
5861 List<MethodElement> methods = holder.methods; | 5946 List<MethodElement> methods = holder.methods; |
5862 expect(methods, hasLength(1)); | 5947 expect(methods, hasLength(1)); |
5863 MethodElement method = methods[0]; | 5948 MethodElement method = methods[0]; |
5864 expect(method, isNotNull); | 5949 expect(method, isNotNull); |
5865 expect(method.name, methodName); | 5950 expect(method.name, methodName); |
| 5951 expect(method.typeParameters, hasLength(0)); |
5866 expect(method.isAbstract, isFalse); | 5952 expect(method.isAbstract, isFalse); |
5867 expect(method.isExternal, isFalse); | 5953 expect(method.isExternal, isFalse); |
5868 expect(method.isStatic, isFalse); | 5954 expect(method.isStatic, isFalse); |
5869 expect(method.isSynthetic, isFalse); | 5955 expect(method.isSynthetic, isFalse); |
5870 List<VariableElement> parameters = method.parameters; | 5956 List<VariableElement> parameters = method.parameters; |
5871 expect(parameters, hasLength(1)); | 5957 expect(parameters, hasLength(1)); |
5872 VariableElement parameter = parameters[0]; | 5958 VariableElement parameter = parameters[0]; |
5873 expect(parameter, isNotNull); | 5959 expect(parameter, isNotNull); |
5874 expect(parameter.name, parameterName); | 5960 expect(parameter.name, parameterName); |
5875 List<VariableElement> localVariables = method.localVariables; | 5961 List<VariableElement> localVariables = method.localVariables; |
(...skipping 2724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8600 if (_expectedExternalScriptName == null) { | 8686 if (_expectedExternalScriptName == null) { |
8601 expect(scriptSource, isNull, reason: "script $scriptIndex"); | 8687 expect(scriptSource, isNull, reason: "script $scriptIndex"); |
8602 } else { | 8688 } else { |
8603 expect(scriptSource, isNotNull, reason: "script $scriptIndex"); | 8689 expect(scriptSource, isNotNull, reason: "script $scriptIndex"); |
8604 String actualExternalScriptName = scriptSource.shortName; | 8690 String actualExternalScriptName = scriptSource.shortName; |
8605 expect(actualExternalScriptName, _expectedExternalScriptName, | 8691 expect(actualExternalScriptName, _expectedExternalScriptName, |
8606 reason: "script $scriptIndex"); | 8692 reason: "script $scriptIndex"); |
8607 } | 8693 } |
8608 } | 8694 } |
8609 } | 8695 } |
OLD | NEW |