| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library analyzer.test.generated.all_the_rest_test; | 5 library analyzer.test.generated.all_the_rest_test; |
| 6 | 6 |
| 7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
| 8 import 'package:analyzer/dart/ast/token.dart'; | 8 import 'package:analyzer/dart/ast/token.dart'; |
| 9 import 'package:analyzer/dart/element/element.dart'; | 9 import 'package:analyzer/dart/element/element.dart'; |
| 10 import 'package:analyzer/dart/element/type.dart'; | 10 import 'package:analyzer/dart/element/type.dart'; |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 } | 589 } |
| 590 | 590 |
| 591 void test_visitCatchClause() { | 591 void test_visitCatchClause() { |
| 592 // } catch (e, s) { | 592 // } catch (e, s) { |
| 593 ElementHolder holder = new ElementHolder(); | 593 ElementHolder holder = new ElementHolder(); |
| 594 ElementBuilder builder = _makeBuilder(holder); | 594 ElementBuilder builder = _makeBuilder(holder); |
| 595 String exceptionParameterName = "e"; | 595 String exceptionParameterName = "e"; |
| 596 String stackParameterName = "s"; | 596 String stackParameterName = "s"; |
| 597 CatchClause clause = | 597 CatchClause clause = |
| 598 AstFactory.catchClause2(exceptionParameterName, stackParameterName); | 598 AstFactory.catchClause2(exceptionParameterName, stackParameterName); |
| 599 _setNodeSourceRange(clause, 100, 110); |
| 599 clause.accept(builder); | 600 clause.accept(builder); |
| 600 | 601 |
| 601 List<LocalVariableElement> variables = holder.localVariables; | 602 List<LocalVariableElement> variables = holder.localVariables; |
| 602 expect(variables, hasLength(2)); | 603 expect(variables, hasLength(2)); |
| 603 VariableElement exceptionVariable = variables[0]; | 604 |
| 605 LocalVariableElement exceptionVariable = variables[0]; |
| 604 expect(exceptionVariable, isNotNull); | 606 expect(exceptionVariable, isNotNull); |
| 605 expect(exceptionVariable.name, exceptionParameterName); | 607 expect(exceptionVariable.name, exceptionParameterName); |
| 606 expect(exceptionVariable.hasImplicitType, isTrue); | 608 expect(exceptionVariable.hasImplicitType, isTrue); |
| 607 expect(exceptionVariable.isSynthetic, isFalse); | 609 expect(exceptionVariable.isSynthetic, isFalse); |
| 608 expect(exceptionVariable.isConst, isFalse); | 610 expect(exceptionVariable.isConst, isFalse); |
| 609 expect(exceptionVariable.isFinal, isFalse); | 611 expect(exceptionVariable.isFinal, isFalse); |
| 610 expect(exceptionVariable.initializer, isNull); | 612 expect(exceptionVariable.initializer, isNull); |
| 611 VariableElement stackVariable = variables[1]; | 613 _assertVisibleRange(exceptionVariable, 100, 110); |
| 614 |
| 615 LocalVariableElement stackVariable = variables[1]; |
| 612 expect(stackVariable, isNotNull); | 616 expect(stackVariable, isNotNull); |
| 613 expect(stackVariable.name, stackParameterName); | 617 expect(stackVariable.name, stackParameterName); |
| 614 expect(stackVariable.isSynthetic, isFalse); | 618 expect(stackVariable.isSynthetic, isFalse); |
| 615 expect(stackVariable.isConst, isFalse); | 619 expect(stackVariable.isConst, isFalse); |
| 616 expect(stackVariable.isFinal, isFalse); | 620 expect(stackVariable.isFinal, isFalse); |
| 617 expect(stackVariable.initializer, isNull); | 621 expect(stackVariable.initializer, isNull); |
| 622 _assertVisibleRange(stackVariable, 100, 110); |
| 618 } | 623 } |
| 619 | 624 |
| 620 void test_visitCatchClause_withType() { | 625 void test_visitCatchClause_withType() { |
| 621 // } on E catch (e) { | 626 // } on E catch (e) { |
| 622 ElementHolder holder = new ElementHolder(); | 627 ElementHolder holder = new ElementHolder(); |
| 623 ElementBuilder builder = _makeBuilder(holder); | 628 ElementBuilder builder = _makeBuilder(holder); |
| 624 String exceptionParameterName = "e"; | 629 String exceptionParameterName = "e"; |
| 625 CatchClause clause = AstFactory.catchClause4( | 630 CatchClause clause = AstFactory.catchClause4( |
| 626 AstFactory.typeName4('E'), exceptionParameterName); | 631 AstFactory.typeName4('E'), exceptionParameterName); |
| 627 clause.accept(builder); | 632 clause.accept(builder); |
| (...skipping 3671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4299 expect(UriKind.fromEncoding(0x70), same(UriKind.PACKAGE_URI)); | 4304 expect(UriKind.fromEncoding(0x70), same(UriKind.PACKAGE_URI)); |
| 4300 expect(UriKind.fromEncoding(0x58), same(null)); | 4305 expect(UriKind.fromEncoding(0x58), same(null)); |
| 4301 } | 4306 } |
| 4302 | 4307 |
| 4303 void test_getEncoding() { | 4308 void test_getEncoding() { |
| 4304 expect(UriKind.DART_URI.encoding, 0x64); | 4309 expect(UriKind.DART_URI.encoding, 0x64); |
| 4305 expect(UriKind.FILE_URI.encoding, 0x66); | 4310 expect(UriKind.FILE_URI.encoding, 0x66); |
| 4306 expect(UriKind.PACKAGE_URI.encoding, 0x70); | 4311 expect(UriKind.PACKAGE_URI.encoding, 0x70); |
| 4307 } | 4312 } |
| 4308 } | 4313 } |
| OLD | NEW |