| 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.ast_test; | 8 library engine.ast_test; |
| 9 | 9 |
| 10 import 'package:analyzer/src/generated/java_core.dart'; | 10 import 'package:analyzer/src/generated/java_core.dart'; |
| (...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 811 | 811 |
| 812 void test_inDeclarationContext_variableDeclaration() { | 812 void test_inDeclarationContext_variableDeclaration() { |
| 813 SimpleIdentifier identifier = AstFactory.variableDeclaration("v").name; | 813 SimpleIdentifier identifier = AstFactory.variableDeclaration("v").name; |
| 814 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); | 814 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); |
| 815 } | 815 } |
| 816 | 816 |
| 817 void test_inGetterContext() { | 817 void test_inGetterContext() { |
| 818 for (WrapperKind wrapper in WrapperKind.values) { | 818 for (WrapperKind wrapper in WrapperKind.values) { |
| 819 for (AssignmentKind assignment in AssignmentKind.values) { | 819 for (AssignmentKind assignment in AssignmentKind.values) { |
| 820 SimpleIdentifier identifier = _createIdentifier(wrapper, assignment); | 820 SimpleIdentifier identifier = _createIdentifier(wrapper, assignment); |
| 821 if (identical(assignment, AssignmentKind.SIMPLE_LEFT) && wrapper != Wrap
perKind.PREFIXED_LEFT && wrapper != WrapperKind.PROPERTY_LEFT) { | 821 if (assignment == AssignmentKind.SIMPLE_LEFT && wrapper != WrapperKind.P
REFIXED_LEFT && wrapper != WrapperKind.PROPERTY_LEFT) { |
| 822 if (identifier.inGetterContext()) { | 822 if (identifier.inGetterContext()) { |
| 823 JUnitTestCase.fail("Expected ${_topMostNode(identifier).toSource()}
to be false"); | 823 JUnitTestCase.fail("Expected ${_topMostNode(identifier).toSource()}
to be false"); |
| 824 } | 824 } |
| 825 } else { | 825 } else { |
| 826 if (!identifier.inGetterContext()) { | 826 if (!identifier.inGetterContext()) { |
| 827 JUnitTestCase.fail("Expected ${_topMostNode(identifier).toSource()}
to be true"); | 827 JUnitTestCase.fail("Expected ${_topMostNode(identifier).toSource()}
to be true"); |
| 828 } | 828 } |
| 829 } | 829 } |
| 830 } | 830 } |
| 831 } | 831 } |
| 832 } | 832 } |
| 833 | 833 |
| 834 void test_inReferenceContext() { | 834 void test_inReferenceContext() { |
| 835 SimpleIdentifier identifier = AstFactory.identifier3("id"); | 835 SimpleIdentifier identifier = AstFactory.identifier3("id"); |
| 836 AstFactory.namedExpression(AstFactory.label(identifier), AstFactory.identifi
er3("_")); | 836 AstFactory.namedExpression(AstFactory.label(identifier), AstFactory.identifi
er3("_")); |
| 837 JUnitTestCase.assertFalse(identifier.inGetterContext()); | 837 JUnitTestCase.assertFalse(identifier.inGetterContext()); |
| 838 JUnitTestCase.assertFalse(identifier.inSetterContext()); | 838 JUnitTestCase.assertFalse(identifier.inSetterContext()); |
| 839 } | 839 } |
| 840 | 840 |
| 841 void test_inSetterContext() { | 841 void test_inSetterContext() { |
| 842 for (WrapperKind wrapper in WrapperKind.values) { | 842 for (WrapperKind wrapper in WrapperKind.values) { |
| 843 for (AssignmentKind assignment in AssignmentKind.values) { | 843 for (AssignmentKind assignment in AssignmentKind.values) { |
| 844 SimpleIdentifier identifier = _createIdentifier(wrapper, assignment); | 844 SimpleIdentifier identifier = _createIdentifier(wrapper, assignment); |
| 845 if (identical(wrapper, WrapperKind.PREFIXED_LEFT) || identical(wrapper,
WrapperKind.PROPERTY_LEFT) || identical(assignment, AssignmentKind.BINARY) || id
entical(assignment, AssignmentKind.COMPOUND_RIGHT) || identical(assignment, Assi
gnmentKind.PREFIX_NOT) || identical(assignment, AssignmentKind.SIMPLE_RIGHT) ||
identical(assignment, AssignmentKind.NONE)) { | 845 if (wrapper == WrapperKind.PREFIXED_LEFT || wrapper == WrapperKind.PROPE
RTY_LEFT || assignment == AssignmentKind.BINARY || assignment == AssignmentKind.
COMPOUND_RIGHT || assignment == AssignmentKind.PREFIX_NOT || assignment == Assig
nmentKind.SIMPLE_RIGHT || assignment == AssignmentKind.NONE) { |
| 846 if (identifier.inSetterContext()) { | 846 if (identifier.inSetterContext()) { |
| 847 JUnitTestCase.fail("Expected ${_topMostNode(identifier).toSource()}
to be false"); | 847 JUnitTestCase.fail("Expected ${_topMostNode(identifier).toSource()}
to be false"); |
| 848 } | 848 } |
| 849 } else { | 849 } else { |
| 850 if (!identifier.inSetterContext()) { | 850 if (!identifier.inSetterContext()) { |
| 851 JUnitTestCase.fail("Expected ${_topMostNode(identifier).toSource()}
to be true"); | 851 JUnitTestCase.fail("Expected ${_topMostNode(identifier).toSource()}
to be true"); |
| 852 } | 852 } |
| 853 } | 853 } |
| 854 } | 854 } |
| 855 } | 855 } |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 993 }); | 993 }); |
| 994 _ut.test('test_inSetterContext', () { | 994 _ut.test('test_inSetterContext', () { |
| 995 final __test = new SimpleIdentifierTest(); | 995 final __test = new SimpleIdentifierTest(); |
| 996 runJUnitTest(__test, __test.test_inSetterContext); | 996 runJUnitTest(__test, __test.test_inSetterContext); |
| 997 }); | 997 }); |
| 998 }); | 998 }); |
| 999 } | 999 } |
| 1000 } | 1000 } |
| 1001 | 1001 |
| 1002 class AssignmentKind extends Enum<AssignmentKind> { | 1002 class AssignmentKind extends Enum<AssignmentKind> { |
| 1003 static final AssignmentKind BINARY = new AssignmentKind('BINARY', 0); | 1003 static const AssignmentKind BINARY = const AssignmentKind('BINARY', 0); |
| 1004 | 1004 |
| 1005 static final AssignmentKind COMPOUND_LEFT = new AssignmentKind('COMPOUND_LEFT'
, 1); | 1005 static const AssignmentKind COMPOUND_LEFT = const AssignmentKind('COMPOUND_LEF
T', 1); |
| 1006 | 1006 |
| 1007 static final AssignmentKind COMPOUND_RIGHT = new AssignmentKind('COMPOUND_RIGH
T', 2); | 1007 static const AssignmentKind COMPOUND_RIGHT = const AssignmentKind('COMPOUND_RI
GHT', 2); |
| 1008 | 1008 |
| 1009 static final AssignmentKind POSTFIX_INC = new AssignmentKind('POSTFIX_INC', 3)
; | 1009 static const AssignmentKind POSTFIX_INC = const AssignmentKind('POSTFIX_INC',
3); |
| 1010 | 1010 |
| 1011 static final AssignmentKind PREFIX_DEC = new AssignmentKind('PREFIX_DEC', 4); | 1011 static const AssignmentKind PREFIX_DEC = const AssignmentKind('PREFIX_DEC', 4)
; |
| 1012 | 1012 |
| 1013 static final AssignmentKind PREFIX_INC = new AssignmentKind('PREFIX_INC', 5); | 1013 static const AssignmentKind PREFIX_INC = const AssignmentKind('PREFIX_INC', 5)
; |
| 1014 | 1014 |
| 1015 static final AssignmentKind PREFIX_NOT = new AssignmentKind('PREFIX_NOT', 6); | 1015 static const AssignmentKind PREFIX_NOT = const AssignmentKind('PREFIX_NOT', 6)
; |
| 1016 | 1016 |
| 1017 static final AssignmentKind SIMPLE_LEFT = new AssignmentKind('SIMPLE_LEFT', 7)
; | 1017 static const AssignmentKind SIMPLE_LEFT = const AssignmentKind('SIMPLE_LEFT',
7); |
| 1018 | 1018 |
| 1019 static final AssignmentKind SIMPLE_RIGHT = new AssignmentKind('SIMPLE_RIGHT',
8); | 1019 static const AssignmentKind SIMPLE_RIGHT = const AssignmentKind('SIMPLE_RIGHT'
, 8); |
| 1020 | 1020 |
| 1021 static final AssignmentKind NONE = new AssignmentKind('NONE', 9); | 1021 static const AssignmentKind NONE = const AssignmentKind('NONE', 9); |
| 1022 | 1022 |
| 1023 static final List<AssignmentKind> values = [ | 1023 static const List<AssignmentKind> values = const [ |
| 1024 BINARY, | 1024 BINARY, |
| 1025 COMPOUND_LEFT, | 1025 COMPOUND_LEFT, |
| 1026 COMPOUND_RIGHT, | 1026 COMPOUND_RIGHT, |
| 1027 POSTFIX_INC, | 1027 POSTFIX_INC, |
| 1028 PREFIX_DEC, | 1028 PREFIX_DEC, |
| 1029 PREFIX_INC, | 1029 PREFIX_INC, |
| 1030 PREFIX_NOT, | 1030 PREFIX_NOT, |
| 1031 SIMPLE_LEFT, | 1031 SIMPLE_LEFT, |
| 1032 SIMPLE_RIGHT, | 1032 SIMPLE_RIGHT, |
| 1033 NONE]; | 1033 NONE]; |
| 1034 | 1034 |
| 1035 AssignmentKind(String name, int ordinal) : super(name, ordinal); | 1035 const AssignmentKind(String name, int ordinal) : super(name, ordinal); |
| 1036 } | 1036 } |
| 1037 | 1037 |
| 1038 class WrapperKind extends Enum<WrapperKind> { | 1038 class WrapperKind extends Enum<WrapperKind> { |
| 1039 static final WrapperKind PREFIXED_LEFT = new WrapperKind('PREFIXED_LEFT', 0); | 1039 static const WrapperKind PREFIXED_LEFT = const WrapperKind('PREFIXED_LEFT', 0)
; |
| 1040 | 1040 |
| 1041 static final WrapperKind PREFIXED_RIGHT = new WrapperKind('PREFIXED_RIGHT', 1)
; | 1041 static const WrapperKind PREFIXED_RIGHT = const WrapperKind('PREFIXED_RIGHT',
1); |
| 1042 | 1042 |
| 1043 static final WrapperKind PROPERTY_LEFT = new WrapperKind('PROPERTY_LEFT', 2); | 1043 static const WrapperKind PROPERTY_LEFT = const WrapperKind('PROPERTY_LEFT', 2)
; |
| 1044 | 1044 |
| 1045 static final WrapperKind PROPERTY_RIGHT = new WrapperKind('PROPERTY_RIGHT', 3)
; | 1045 static const WrapperKind PROPERTY_RIGHT = const WrapperKind('PROPERTY_RIGHT',
3); |
| 1046 | 1046 |
| 1047 static final WrapperKind NONE = new WrapperKind('NONE', 4); | 1047 static const WrapperKind NONE = const WrapperKind('NONE', 4); |
| 1048 | 1048 |
| 1049 static final List<WrapperKind> values = [ | 1049 static const List<WrapperKind> values = const [ |
| 1050 PREFIXED_LEFT, | 1050 PREFIXED_LEFT, |
| 1051 PREFIXED_RIGHT, | 1051 PREFIXED_RIGHT, |
| 1052 PROPERTY_LEFT, | 1052 PROPERTY_LEFT, |
| 1053 PROPERTY_RIGHT, | 1053 PROPERTY_RIGHT, |
| 1054 NONE]; | 1054 NONE]; |
| 1055 | 1055 |
| 1056 WrapperKind(String name, int ordinal) : super(name, ordinal); | 1056 const WrapperKind(String name, int ordinal) : super(name, ordinal); |
| 1057 } | 1057 } |
| 1058 | 1058 |
| 1059 class BreadthFirstVisitorTest extends ParserTestCase { | 1059 class BreadthFirstVisitorTest extends ParserTestCase { |
| 1060 void testIt() { | 1060 void testIt() { |
| 1061 String source = EngineTestCase.createSource([ | 1061 String source = EngineTestCase.createSource([ |
| 1062 "class A {", | 1062 "class A {", |
| 1063 " bool get g => true;", | 1063 " bool get g => true;", |
| 1064 "}", | 1064 "}", |
| 1065 "class B {", | 1065 "class B {", |
| 1066 " int f() {", | 1066 " int f() {", |
| (...skipping 3172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4239 NodeLocatorTest.dartSuite(); | 4239 NodeLocatorTest.dartSuite(); |
| 4240 ToSourceVisitorTest.dartSuite(); | 4240 ToSourceVisitorTest.dartSuite(); |
| 4241 BreadthFirstVisitorTest.dartSuite(); | 4241 BreadthFirstVisitorTest.dartSuite(); |
| 4242 ClassDeclarationTest.dartSuite(); | 4242 ClassDeclarationTest.dartSuite(); |
| 4243 IndexExpressionTest.dartSuite(); | 4243 IndexExpressionTest.dartSuite(); |
| 4244 NodeListTest.dartSuite(); | 4244 NodeListTest.dartSuite(); |
| 4245 SimpleIdentifierTest.dartSuite(); | 4245 SimpleIdentifierTest.dartSuite(); |
| 4246 SimpleStringLiteralTest.dartSuite(); | 4246 SimpleStringLiteralTest.dartSuite(); |
| 4247 VariableDeclarationTest.dartSuite(); | 4247 VariableDeclarationTest.dartSuite(); |
| 4248 } | 4248 } |
| OLD | NEW |