| 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.ast_test; | 4 library engine.ast_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.dart'; | 10 import 'package:analyzer-experimental/src/generated/source.dart'; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 final __test = new NodeLocatorTest(); | 44 final __test = new NodeLocatorTest(); |
| 45 runJUnitTest(__test, __test.test_offset); | 45 runJUnitTest(__test, __test.test_offset); |
| 46 }); | 46 }); |
| 47 _ut.test('test_range', () { | 47 _ut.test('test_range', () { |
| 48 final __test = new NodeLocatorTest(); | 48 final __test = new NodeLocatorTest(); |
| 49 runJUnitTest(__test, __test.test_range); | 49 runJUnitTest(__test, __test.test_range); |
| 50 }); | 50 }); |
| 51 }); | 51 }); |
| 52 } | 52 } |
| 53 } | 53 } |
| 54 class IndexExpressionTest extends EngineTestCase { |
| 55 void test_inGetterContext_assignment_compound_left() { |
| 56 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r2("a"), ASTFactory.identifier2("b")); |
| 57 ASTFactory.assignmentExpression(expression, TokenType.PLUS_EQ, null); |
| 58 JUnitTestCase.assertTrue(expression.inGetterContext()); |
| 59 } |
| 60 void test_inGetterContext_assignment_simple_left() { |
| 61 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r2("a"), ASTFactory.identifier2("b")); |
| 62 ASTFactory.assignmentExpression(expression, TokenType.EQ, null); |
| 63 JUnitTestCase.assertFalse(expression.inGetterContext()); |
| 64 } |
| 65 void test_inGetterContext_nonAssignment() { |
| 66 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r2("a"), ASTFactory.identifier2("b")); |
| 67 ASTFactory.binaryExpression(expression, TokenType.PLUS, null); |
| 68 JUnitTestCase.assertTrue(expression.inGetterContext()); |
| 69 } |
| 70 void test_inSetterContext_assignment_compound_left() { |
| 71 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r2("a"), ASTFactory.identifier2("b")); |
| 72 ASTFactory.assignmentExpression(expression, TokenType.PLUS_EQ, null); |
| 73 JUnitTestCase.assertTrue(expression.inSetterContext()); |
| 74 } |
| 75 void test_inSetterContext_assignment_compound_right() { |
| 76 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r2("a"), ASTFactory.identifier2("b")); |
| 77 ASTFactory.assignmentExpression(null, TokenType.PLUS_EQ, expression); |
| 78 JUnitTestCase.assertFalse(expression.inSetterContext()); |
| 79 } |
| 80 void test_inSetterContext_assignment_simple_left() { |
| 81 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r2("a"), ASTFactory.identifier2("b")); |
| 82 ASTFactory.assignmentExpression(expression, TokenType.EQ, null); |
| 83 JUnitTestCase.assertTrue(expression.inSetterContext()); |
| 84 } |
| 85 void test_inSetterContext_assignment_simple_right() { |
| 86 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r2("a"), ASTFactory.identifier2("b")); |
| 87 ASTFactory.assignmentExpression(null, TokenType.EQ, expression); |
| 88 JUnitTestCase.assertFalse(expression.inSetterContext()); |
| 89 } |
| 90 void test_inSetterContext_nonAssignment() { |
| 91 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r2("a"), ASTFactory.identifier2("b")); |
| 92 ASTFactory.binaryExpression(expression, TokenType.PLUS, null); |
| 93 JUnitTestCase.assertFalse(expression.inSetterContext()); |
| 94 } |
| 95 void test_inSetterContext_postfix() { |
| 96 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r2("a"), ASTFactory.identifier2("b")); |
| 97 ASTFactory.postfixExpression(expression, TokenType.PLUS_PLUS); |
| 98 JUnitTestCase.assertTrue(expression.inSetterContext()); |
| 99 } |
| 100 void test_inSetterContext_prefix_bang() { |
| 101 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r2("a"), ASTFactory.identifier2("b")); |
| 102 ASTFactory.prefixExpression(TokenType.BANG, expression); |
| 103 JUnitTestCase.assertFalse(expression.inSetterContext()); |
| 104 } |
| 105 void test_inSetterContext_prefix_minusMinus() { |
| 106 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r2("a"), ASTFactory.identifier2("b")); |
| 107 ASTFactory.prefixExpression(TokenType.MINUS_MINUS, expression); |
| 108 JUnitTestCase.assertTrue(expression.inSetterContext()); |
| 109 } |
| 110 void test_inSetterContext_prefix_plusPlus() { |
| 111 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r2("a"), ASTFactory.identifier2("b")); |
| 112 ASTFactory.prefixExpression(TokenType.PLUS_PLUS, expression); |
| 113 JUnitTestCase.assertTrue(expression.inSetterContext()); |
| 114 } |
| 115 static dartSuite() { |
| 116 _ut.group('IndexExpressionTest', () { |
| 117 _ut.test('test_inGetterContext_assignment_compound_left', () { |
| 118 final __test = new IndexExpressionTest(); |
| 119 runJUnitTest(__test, __test.test_inGetterContext_assignment_compound_lef
t); |
| 120 }); |
| 121 _ut.test('test_inGetterContext_assignment_simple_left', () { |
| 122 final __test = new IndexExpressionTest(); |
| 123 runJUnitTest(__test, __test.test_inGetterContext_assignment_simple_left)
; |
| 124 }); |
| 125 _ut.test('test_inGetterContext_nonAssignment', () { |
| 126 final __test = new IndexExpressionTest(); |
| 127 runJUnitTest(__test, __test.test_inGetterContext_nonAssignment); |
| 128 }); |
| 129 _ut.test('test_inSetterContext_assignment_compound_left', () { |
| 130 final __test = new IndexExpressionTest(); |
| 131 runJUnitTest(__test, __test.test_inSetterContext_assignment_compound_lef
t); |
| 132 }); |
| 133 _ut.test('test_inSetterContext_assignment_compound_right', () { |
| 134 final __test = new IndexExpressionTest(); |
| 135 runJUnitTest(__test, __test.test_inSetterContext_assignment_compound_rig
ht); |
| 136 }); |
| 137 _ut.test('test_inSetterContext_assignment_simple_left', () { |
| 138 final __test = new IndexExpressionTest(); |
| 139 runJUnitTest(__test, __test.test_inSetterContext_assignment_simple_left)
; |
| 140 }); |
| 141 _ut.test('test_inSetterContext_assignment_simple_right', () { |
| 142 final __test = new IndexExpressionTest(); |
| 143 runJUnitTest(__test, __test.test_inSetterContext_assignment_simple_right
); |
| 144 }); |
| 145 _ut.test('test_inSetterContext_nonAssignment', () { |
| 146 final __test = new IndexExpressionTest(); |
| 147 runJUnitTest(__test, __test.test_inSetterContext_nonAssignment); |
| 148 }); |
| 149 _ut.test('test_inSetterContext_postfix', () { |
| 150 final __test = new IndexExpressionTest(); |
| 151 runJUnitTest(__test, __test.test_inSetterContext_postfix); |
| 152 }); |
| 153 _ut.test('test_inSetterContext_prefix_bang', () { |
| 154 final __test = new IndexExpressionTest(); |
| 155 runJUnitTest(__test, __test.test_inSetterContext_prefix_bang); |
| 156 }); |
| 157 _ut.test('test_inSetterContext_prefix_minusMinus', () { |
| 158 final __test = new IndexExpressionTest(); |
| 159 runJUnitTest(__test, __test.test_inSetterContext_prefix_minusMinus); |
| 160 }); |
| 161 _ut.test('test_inSetterContext_prefix_plusPlus', () { |
| 162 final __test = new IndexExpressionTest(); |
| 163 runJUnitTest(__test, __test.test_inSetterContext_prefix_plusPlus); |
| 164 }); |
| 165 }); |
| 166 } |
| 167 } |
| 54 /** | 168 /** |
| 55 * The class {@code ASTFactory} defines utility methods that can be used to crea
te AST nodes. The | 169 * The class {@code ASTFactory} defines utility methods that can be used to crea
te AST nodes. The |
| 56 * nodes that are created are complete in the sense that all of the tokens that
would have been | 170 * nodes that are created are complete in the sense that all of the tokens that
would have been |
| 57 * associated with the nodes by a parser are also created, but the token stream
is not constructed. | 171 * associated with the nodes by a parser are also created, but the token stream
is not constructed. |
| 172 * None of the nodes are resolved. |
| 173 * <p> |
| 174 * The general pattern is for the name of the factory method to be the same as t
he name of the class |
| 175 * of AST node being created. There are two notable exceptions. The first is for
methods creating |
| 176 * nodes that are part of a cascade expression. These methods are all prefixed w
ith 'cascaded'. The |
| 177 * second is places where a shorter name seemed unambiguous and easier to read,
such as using |
| 178 * 'identifier' rather than 'prefixedIdentifier', or 'integer' rather than 'inte
gerLiteral'. |
| 58 */ | 179 */ |
| 59 class ASTFactory { | 180 class ASTFactory { |
| 60 static AdjacentStrings adjacentStrings(List<StringLiteral> strings) => new Adj
acentStrings.full(list(strings)); | 181 static AdjacentStrings adjacentStrings(List<StringLiteral> strings) => new Adj
acentStrings.full(list(strings)); |
| 61 static Annotation annotation(Identifier name) => new Annotation.full(TokenFact
ory.token3(TokenType.AT), name, null, null, null); | 182 static Annotation annotation(Identifier name) => new Annotation.full(TokenFact
ory.token3(TokenType.AT), name, null, null, null); |
| 62 static Annotation annotation2(Identifier name, SimpleIdentifier constructorNam
e, ArgumentList arguments) => new Annotation.full(TokenFactory.token3(TokenType.
AT), name, TokenFactory.token3(TokenType.PERIOD), constructorName, arguments); | 183 static Annotation annotation2(Identifier name, SimpleIdentifier constructorNam
e, ArgumentList arguments) => new Annotation.full(TokenFactory.token3(TokenType.
AT), name, TokenFactory.token3(TokenType.PERIOD), constructorName, arguments); |
| 63 static ArgumentDefinitionTest argumentDefinitionTest(String identifier) => new
ArgumentDefinitionTest.full(TokenFactory.token3(TokenType.QUESTION), identifier
2(identifier)); | 184 static ArgumentDefinitionTest argumentDefinitionTest(String identifier) => new
ArgumentDefinitionTest.full(TokenFactory.token3(TokenType.QUESTION), identifier
2(identifier)); |
| 64 static ArgumentList argumentList(List<Expression> arguments) => new ArgumentLi
st.full(TokenFactory.token3(TokenType.OPEN_PAREN), list(arguments), TokenFactory
.token3(TokenType.CLOSE_PAREN)); | 185 static ArgumentList argumentList(List<Expression> arguments) => new ArgumentLi
st.full(TokenFactory.token3(TokenType.OPEN_PAREN), list(arguments), TokenFactory
.token3(TokenType.CLOSE_PAREN)); |
| 65 static AsExpression asExpression(Expression expression, TypeName type) => new
AsExpression.full(expression, TokenFactory.token(Keyword.AS), type); | 186 static AsExpression asExpression(Expression expression, TypeName type) => new
AsExpression.full(expression, TokenFactory.token(Keyword.AS), type); |
| 66 static AssertStatement assertStatement(Expression condition) => new AssertStat
ement.full(TokenFactory.token(Keyword.ASSERT), TokenFactory.token3(TokenType.OPE
N_PAREN), condition, TokenFactory.token3(TokenType.CLOSE_PAREN), TokenFactory.to
ken3(TokenType.SEMICOLON)); | 187 static AssertStatement assertStatement(Expression condition) => new AssertStat
ement.full(TokenFactory.token(Keyword.ASSERT), TokenFactory.token3(TokenType.OPE
N_PAREN), condition, TokenFactory.token3(TokenType.CLOSE_PAREN), TokenFactory.to
ken3(TokenType.SEMICOLON)); |
| 67 static AssignmentExpression assignmentExpression(Expression leftHandSide, Toke
nType operator, Expression rightHandSide) => new AssignmentExpression.full(leftH
andSide, TokenFactory.token3(operator), rightHandSide); | 188 static AssignmentExpression assignmentExpression(Expression leftHandSide, Toke
nType operator, Expression rightHandSide) => new AssignmentExpression.full(leftH
andSide, TokenFactory.token3(operator), rightHandSide); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 static ForEachStatement forEachStatement(SimpleFormalParameter loopParameter,
Expression iterator, Statement body) => new ForEachStatement.full(TokenFactory.t
oken(Keyword.FOR), TokenFactory.token3(TokenType.OPEN_PAREN), loopParameter, Tok
enFactory.token(Keyword.IN), iterator, TokenFactory.token3(TokenType.CLOSE_PAREN
), body); | 233 static ForEachStatement forEachStatement(SimpleFormalParameter loopParameter,
Expression iterator, Statement body) => new ForEachStatement.full(TokenFactory.t
oken(Keyword.FOR), TokenFactory.token3(TokenType.OPEN_PAREN), loopParameter, Tok
enFactory.token(Keyword.IN), iterator, TokenFactory.token3(TokenType.CLOSE_PAREN
), body); |
| 113 static FormalParameterList formalParameterList(List<FormalParameter> parameter
s) => new FormalParameterList.full(TokenFactory.token3(TokenType.OPEN_PAREN), li
st(parameters), null, null, TokenFactory.token3(TokenType.CLOSE_PAREN)); | 234 static FormalParameterList formalParameterList(List<FormalParameter> parameter
s) => new FormalParameterList.full(TokenFactory.token3(TokenType.OPEN_PAREN), li
st(parameters), null, null, TokenFactory.token3(TokenType.CLOSE_PAREN)); |
| 114 static ForStatement forStatement(Expression initialization, Expression conditi
on, List<Expression> updaters, Statement body) => new ForStatement.full(TokenFac
tory.token(Keyword.FOR), TokenFactory.token3(TokenType.OPEN_PAREN), null, initia
lization, TokenFactory.token3(TokenType.SEMICOLON), condition, TokenFactory.toke
n3(TokenType.SEMICOLON), updaters, TokenFactory.token3(TokenType.CLOSE_PAREN), b
ody); | 235 static ForStatement forStatement(Expression initialization, Expression conditi
on, List<Expression> updaters, Statement body) => new ForStatement.full(TokenFac
tory.token(Keyword.FOR), TokenFactory.token3(TokenType.OPEN_PAREN), null, initia
lization, TokenFactory.token3(TokenType.SEMICOLON), condition, TokenFactory.toke
n3(TokenType.SEMICOLON), updaters, TokenFactory.token3(TokenType.CLOSE_PAREN), b
ody); |
| 115 static ForStatement forStatement2(VariableDeclarationList variableList, Expres
sion condition, List<Expression> updaters, Statement body) => new ForStatement.f
ull(TokenFactory.token(Keyword.FOR), TokenFactory.token3(TokenType.OPEN_PAREN),
variableList, null, TokenFactory.token3(TokenType.SEMICOLON), condition, TokenFa
ctory.token3(TokenType.SEMICOLON), updaters, TokenFactory.token3(TokenType.CLOSE
_PAREN), body); | 236 static ForStatement forStatement2(VariableDeclarationList variableList, Expres
sion condition, List<Expression> updaters, Statement body) => new ForStatement.f
ull(TokenFactory.token(Keyword.FOR), TokenFactory.token3(TokenType.OPEN_PAREN),
variableList, null, TokenFactory.token3(TokenType.SEMICOLON), condition, TokenFa
ctory.token3(TokenType.SEMICOLON), updaters, TokenFactory.token3(TokenType.CLOSE
_PAREN), body); |
| 116 static FunctionDeclaration functionDeclaration(TypeName type, Keyword keyword,
String name, FunctionExpression functionExpression) => new FunctionDeclaration.
full(null, null, null, type, keyword == null ? null : TokenFactory.token(keyword
), identifier2(name), functionExpression); | 237 static FunctionDeclaration functionDeclaration(TypeName type, Keyword keyword,
String name, FunctionExpression functionExpression) => new FunctionDeclaration.
full(null, null, null, type, keyword == null ? null : TokenFactory.token(keyword
), identifier2(name), functionExpression); |
| 117 static FunctionDeclarationStatement functionDeclarationStatement(TypeName type
, Keyword keyword, String name, FunctionExpression functionExpression) => new Fu
nctionDeclarationStatement.full(functionDeclaration(type, keyword, name, functio
nExpression)); | 238 static FunctionDeclarationStatement functionDeclarationStatement(TypeName type
, Keyword keyword, String name, FunctionExpression functionExpression) => new Fu
nctionDeclarationStatement.full(functionDeclaration(type, keyword, name, functio
nExpression)); |
| 118 static FunctionExpression functionExpression() => new FunctionExpression.full(
formalParameterList([]), blockFunctionBody([])); | 239 static FunctionExpression functionExpression() => new FunctionExpression.full(
formalParameterList([]), blockFunctionBody([])); |
| 119 static FunctionExpression functionExpression2(FormalParameterList parameters,
FunctionBody body) => new FunctionExpression.full(parameters, body); | 240 static FunctionExpression functionExpression2(FormalParameterList parameters,
FunctionBody body) => new FunctionExpression.full(parameters, body); |
| 120 static FunctionExpressionInvocation functionExpressionInvocation(Expression fu
nction, List<Expression> arguments) => new FunctionExpressionInvocation.full(fun
ction, argumentList(arguments)); | 241 static FunctionExpressionInvocation functionExpressionInvocation(Expression fu
nction, List<Expression> arguments) => new FunctionExpressionInvocation.full(fun
ction, argumentList(arguments)); |
| 121 static FunctionTypedFormalParameter functionTypedFormalParameter(TypeName retu
rnType, String identifier, List<FormalParameter> parameters) => new FunctionType
dFormalParameter.full(null, null, returnType, identifier2(identifier), formalPar
ameterList(parameters)); | 242 static FunctionTypedFormalParameter functionTypedFormalParameter(TypeName retu
rnType, String identifier, List<FormalParameter> parameters) => new FunctionType
dFormalParameter.full(null, null, returnType, identifier2(identifier), formalPar
ameterList(parameters)); |
| 122 static PrefixedIdentifier identifier(SimpleIdentifier prefix, SimpleIdentifier
identifier8) => new PrefixedIdentifier.full(prefix, TokenFactory.token3(TokenTy
pe.PERIOD), identifier8); | 243 static HideCombinator hideCombinator(List<SimpleIdentifier> identifiers) => ne
w HideCombinator.full(TokenFactory.token2("hide"), list(identifiers)); |
| 244 static HideCombinator hideCombinator2(List<String> identifiers) { |
| 245 List<SimpleIdentifier> identifierList = new List<SimpleIdentifier>(); |
| 246 for (String identifier in identifiers) { |
| 247 identifierList.add(identifier2(identifier)); |
| 248 } |
| 249 return new HideCombinator.full(TokenFactory.token2("hide"), identifierList); |
| 250 } |
| 251 static PrefixedIdentifier identifier(SimpleIdentifier prefix, SimpleIdentifier
identifier10) => new PrefixedIdentifier.full(prefix, TokenFactory.token3(TokenT
ype.PERIOD), identifier10); |
| 123 static SimpleIdentifier identifier2(String lexeme) => new SimpleIdentifier.ful
l(TokenFactory.token4(TokenType.IDENTIFIER, lexeme)); | 252 static SimpleIdentifier identifier2(String lexeme) => new SimpleIdentifier.ful
l(TokenFactory.token4(TokenType.IDENTIFIER, lexeme)); |
| 124 static PrefixedIdentifier identifier3(String prefix, SimpleIdentifier identifi
er) => new PrefixedIdentifier.full(identifier2(prefix), TokenFactory.token3(Toke
nType.PERIOD), identifier); | 253 static PrefixedIdentifier identifier3(String prefix, SimpleIdentifier identifi
er) => new PrefixedIdentifier.full(identifier2(prefix), TokenFactory.token3(Toke
nType.PERIOD), identifier); |
| 125 static PrefixedIdentifier identifier4(String prefix, String identifier) => new
PrefixedIdentifier.full(identifier2(prefix), TokenFactory.token3(TokenType.PERI
OD), identifier2(identifier)); | 254 static PrefixedIdentifier identifier4(String prefix, String identifier) => new
PrefixedIdentifier.full(identifier2(prefix), TokenFactory.token3(TokenType.PERI
OD), identifier2(identifier)); |
| 126 static IfStatement ifStatement(Expression condition, Statement thenStatement)
=> ifStatement2(condition, thenStatement, null); | 255 static IfStatement ifStatement(Expression condition, Statement thenStatement)
=> ifStatement2(condition, thenStatement, null); |
| 127 static IfStatement ifStatement2(Expression condition, Statement thenStatement,
Statement elseStatement) => new IfStatement.full(TokenFactory.token(Keyword.IF)
, TokenFactory.token3(TokenType.OPEN_PAREN), condition, TokenFactory.token3(Toke
nType.CLOSE_PAREN), thenStatement, elseStatement == null ? null : TokenFactory.t
oken(Keyword.ELSE), elseStatement); | 256 static IfStatement ifStatement2(Expression condition, Statement thenStatement,
Statement elseStatement) => new IfStatement.full(TokenFactory.token(Keyword.IF)
, TokenFactory.token3(TokenType.OPEN_PAREN), condition, TokenFactory.token3(Toke
nType.CLOSE_PAREN), thenStatement, elseStatement == null ? null : TokenFactory.t
oken(Keyword.ELSE), elseStatement); |
| 128 static ImplementsClause implementsClause(List<TypeName> types) => new Implemen
tsClause.full(TokenFactory.token(Keyword.IMPLEMENTS), list(types)); | 257 static ImplementsClause implementsClause(List<TypeName> types) => new Implemen
tsClause.full(TokenFactory.token(Keyword.IMPLEMENTS), list(types)); |
| 129 static ImportDirective importDirective(List<Annotation> metadata, String uri,
String prefix, List<Combinator> combinators) => new ImportDirective.full(null, m
etadata, TokenFactory.token(Keyword.IMPORT), string2(uri), prefix == null ? null
: TokenFactory.token(Keyword.AS), prefix == null ? null : identifier2(prefix),
list(combinators), TokenFactory.token3(TokenType.SEMICOLON)); | 258 static ImportDirective importDirective(List<Annotation> metadata, String uri,
String prefix, List<Combinator> combinators) => new ImportDirective.full(null, m
etadata, TokenFactory.token(Keyword.IMPORT), string2(uri), prefix == null ? null
: TokenFactory.token(Keyword.AS), prefix == null ? null : identifier2(prefix),
list(combinators), TokenFactory.token3(TokenType.SEMICOLON)); |
| 130 static ImportDirective importDirective2(String uri, String prefix, List<Combin
ator> combinators) => importDirective(new List<Annotation>(), uri, prefix, combi
nators); | 259 static ImportDirective importDirective2(String uri, String prefix, List<Combin
ator> combinators) => importDirective(new List<Annotation>(), uri, prefix, combi
nators); |
| 131 static HideCombinator importHideCombinator(List<SimpleIdentifier> identifiers)
=> new HideCombinator.full(TokenFactory.token2("hide"), list(identifiers)); | |
| 132 static ShowCombinator importShowCombinator(List<SimpleIdentifier> identifiers)
=> new ShowCombinator.full(TokenFactory.token2("show"), list(identifiers)); | |
| 133 static IndexExpression indexExpression(Expression array, Expression index) =>
new IndexExpression.forTarget_full(array, TokenFactory.token3(TokenType.OPEN_SQU
ARE_BRACKET), index, TokenFactory.token3(TokenType.CLOSE_SQUARE_BRACKET)); | 260 static IndexExpression indexExpression(Expression array, Expression index) =>
new IndexExpression.forTarget_full(array, TokenFactory.token3(TokenType.OPEN_SQU
ARE_BRACKET), index, TokenFactory.token3(TokenType.CLOSE_SQUARE_BRACKET)); |
| 134 static InstanceCreationExpression instanceCreationExpression(Keyword keyword,
TypeName type, List<Expression> arguments) => instanceCreationExpression2(keywor
d, type, null, arguments); | 261 static InstanceCreationExpression instanceCreationExpression(Keyword keyword,
ConstructorName name, List<Expression> arguments) => new InstanceCreationExpress
ion.full(keyword == null ? null : TokenFactory.token(keyword), name, argumentLis
t(arguments)); |
| 135 static InstanceCreationExpression instanceCreationExpression2(Keyword keyword,
TypeName type, String identifier, List<Expression> arguments) => new InstanceCr
eationExpression.full(keyword == null ? null : TokenFactory.token(keyword), new
ConstructorName.full(type, identifier == null ? null : TokenFactory.token3(Token
Type.PERIOD), identifier == null ? null : identifier2(identifier)), argumentList
(arguments)); | 262 static InstanceCreationExpression instanceCreationExpression2(Keyword keyword,
TypeName type, List<Expression> arguments) => instanceCreationExpression3(keywo
rd, type, null, arguments); |
| 263 static InstanceCreationExpression instanceCreationExpression3(Keyword keyword,
TypeName type, String identifier, List<Expression> arguments) => instanceCreati
onExpression(keyword, new ConstructorName.full(type, identifier == null ? null :
TokenFactory.token3(TokenType.PERIOD), identifier == null ? null : identifier2(
identifier)), arguments); |
| 136 static IntegerLiteral integer(int value) => new IntegerLiteral.full(TokenFacto
ry.token4(TokenType.INT, value.toString()), value); | 264 static IntegerLiteral integer(int value) => new IntegerLiteral.full(TokenFacto
ry.token4(TokenType.INT, value.toString()), value); |
| 137 static InterpolationExpression interpolationExpression(Expression expression)
=> new InterpolationExpression.full(TokenFactory.token3(TokenType.STRING_INTERPO
LATION_EXPRESSION), expression, TokenFactory.token3(TokenType.CLOSE_CURLY_BRACKE
T)); | 265 static InterpolationExpression interpolationExpression(Expression expression)
=> new InterpolationExpression.full(TokenFactory.token3(TokenType.STRING_INTERPO
LATION_EXPRESSION), expression, TokenFactory.token3(TokenType.CLOSE_CURLY_BRACKE
T)); |
| 138 static InterpolationExpression interpolationExpression2(String identifier) =>
new InterpolationExpression.full(TokenFactory.token3(TokenType.STRING_INTERPOLAT
ION_IDENTIFIER), identifier2(identifier), null); | 266 static InterpolationExpression interpolationExpression2(String identifier) =>
new InterpolationExpression.full(TokenFactory.token3(TokenType.STRING_INTERPOLAT
ION_IDENTIFIER), identifier2(identifier), null); |
| 139 static InterpolationString interpolationString(String contents, String value)
=> new InterpolationString.full(TokenFactory.token2(contents), value); | 267 static InterpolationString interpolationString(String contents, String value)
=> new InterpolationString.full(TokenFactory.token2(contents), value); |
| 140 static IsExpression isExpression(Expression expression, bool negated, TypeName
type) => new IsExpression.full(expression, TokenFactory.token(Keyword.IS), nega
ted ? TokenFactory.token3(TokenType.BANG) : null, type); | 268 static IsExpression isExpression(Expression expression, bool negated, TypeName
type) => new IsExpression.full(expression, TokenFactory.token(Keyword.IS), nega
ted ? TokenFactory.token3(TokenType.BANG) : null, type); |
| 141 static Label label(String label4) => new Label.full(identifier2(label4), Token
Factory.token3(TokenType.COLON)); | 269 static Label label(String label5) => new Label.full(identifier2(label5), Token
Factory.token3(TokenType.COLON)); |
| 142 static LabeledStatement labeledStatement(List<Label> labels, Statement stateme
nt) => new LabeledStatement.full(labels, statement); | 270 static LabeledStatement labeledStatement(List<Label> labels, Statement stateme
nt) => new LabeledStatement.full(labels, statement); |
| 143 static LibraryDirective libraryDirective(List<Annotation> metadata, LibraryIde
ntifier libraryName) => new LibraryDirective.full(null, metadata, TokenFactory.t
oken(Keyword.LIBRARY), libraryName, TokenFactory.token3(TokenType.SEMICOLON)); | 271 static LibraryDirective libraryDirective(List<Annotation> metadata, LibraryIde
ntifier libraryName) => new LibraryDirective.full(null, metadata, TokenFactory.t
oken(Keyword.LIBRARY), libraryName, TokenFactory.token3(TokenType.SEMICOLON)); |
| 144 static LibraryDirective libraryDirective2(String libraryName) => libraryDirect
ive(new List<Annotation>(), libraryIdentifier2([libraryName])); | 272 static LibraryDirective libraryDirective2(String libraryName) => libraryDirect
ive(new List<Annotation>(), libraryIdentifier2([libraryName])); |
| 145 static LibraryIdentifier libraryIdentifier(List<SimpleIdentifier> components)
=> new LibraryIdentifier.full(list(components)); | 273 static LibraryIdentifier libraryIdentifier(List<SimpleIdentifier> components)
=> new LibraryIdentifier.full(list(components)); |
| 146 static LibraryIdentifier libraryIdentifier2(List<String> components) { | 274 static LibraryIdentifier libraryIdentifier2(List<String> components) { |
| 147 List<SimpleIdentifier> componentList = new List<SimpleIdentifier>(); | 275 List<SimpleIdentifier> componentList = new List<SimpleIdentifier>(); |
| 148 for (String component in components) { | 276 for (String component in components) { |
| 149 componentList.add(identifier2(component)); | 277 componentList.add(identifier2(component)); |
| 150 } | 278 } |
| 151 return new LibraryIdentifier.full(componentList); | 279 return new LibraryIdentifier.full(componentList); |
| 152 } | 280 } |
| 153 static List<Object> list(List<Object> elements) { | 281 static List<Object> list(List<Object> elements) { |
| 154 List<Object> elementList = new List(); | 282 List<Object> elementList = new List(); |
| 155 for (Object element in elements) { | 283 for (Object element in elements) { |
| 156 elementList.add(element); | 284 elementList.add(element); |
| 157 } | 285 } |
| 158 return elementList; | 286 return elementList; |
| 159 } | 287 } |
| 160 static ListLiteral listLiteral(List<Expression> elements) => listLiteral2(null
, null, elements); | 288 static ListLiteral listLiteral(List<Expression> elements) => listLiteral2(null
, null, elements); |
| 161 static ListLiteral listLiteral2(Keyword keyword, TypeArgumentList typeArgument
s, List<Expression> elements) => new ListLiteral.full(keyword == null ? null : T
okenFactory.token(keyword), null, TokenFactory.token3(TokenType.OPEN_SQUARE_BRAC
KET), list(elements), TokenFactory.token3(TokenType.CLOSE_SQUARE_BRACKET)); | 289 static ListLiteral listLiteral2(Keyword keyword, TypeArgumentList typeArgument
s, List<Expression> elements) => new ListLiteral.full(keyword == null ? null : T
okenFactory.token(keyword), null, TokenFactory.token3(TokenType.OPEN_SQUARE_BRAC
KET), list(elements), TokenFactory.token3(TokenType.CLOSE_SQUARE_BRACKET)); |
| 162 static MapLiteral mapLiteral(Keyword keyword, TypeArgumentList typeArguments,
List<MapLiteralEntry> entries) => new MapLiteral.full(keyword == null ? null : T
okenFactory.token(keyword), typeArguments, TokenFactory.token3(TokenType.OPEN_CU
RLY_BRACKET), list(entries), TokenFactory.token3(TokenType.CLOSE_CURLY_BRACKET))
; | 290 static MapLiteral mapLiteral(Keyword keyword, TypeArgumentList typeArguments,
List<MapLiteralEntry> entries) => new MapLiteral.full(keyword == null ? null : T
okenFactory.token(keyword), typeArguments, TokenFactory.token3(TokenType.OPEN_CU
RLY_BRACKET), list(entries), TokenFactory.token3(TokenType.CLOSE_CURLY_BRACKET))
; |
| 163 static MapLiteral mapLiteral2(List<MapLiteralEntry> entries) => mapLiteral(nul
l, null, entries); | 291 static MapLiteral mapLiteral2(List<MapLiteralEntry> entries) => mapLiteral(nul
l, null, entries); |
| 164 static MapLiteralEntry mapLiteralEntry(String key, Expression value) => new Ma
pLiteralEntry.full(string2(key), TokenFactory.token3(TokenType.COLON), value); | 292 static MapLiteralEntry mapLiteralEntry(String key, Expression value) => new Ma
pLiteralEntry.full(string2(key), TokenFactory.token3(TokenType.COLON), value); |
| 165 static MethodDeclaration methodDeclaration(Keyword modifier, TypeName returnTy
pe, Keyword property, Keyword operator, Identifier name, FormalParameterList par
ameters) => new MethodDeclaration.full(null, null, TokenFactory.token(Keyword.EX
TERNAL), modifier == null ? null : TokenFactory.token(modifier), returnType, pro
perty == null ? null : TokenFactory.token(property), operator == null ? null : T
okenFactory.token(operator), name, parameters, emptyFunctionBody()); | 293 static MethodDeclaration methodDeclaration(Keyword modifier, TypeName returnTy
pe, Keyword property, Keyword operator, SimpleIdentifier name, FormalParameterLi
st parameters) => new MethodDeclaration.full(null, null, TokenFactory.token(Keyw
ord.EXTERNAL), modifier == null ? null : TokenFactory.token(modifier), returnTyp
e, property == null ? null : TokenFactory.token(property), operator == null ? nu
ll : TokenFactory.token(operator), name, parameters, emptyFunctionBody()); |
| 166 static MethodDeclaration methodDeclaration2(Keyword modifier, TypeName returnT
ype, Keyword property, Keyword operator, Identifier name, FormalParameterList pa
rameters, FunctionBody body) => new MethodDeclaration.full(null, null, null, mod
ifier == null ? null : TokenFactory.token(modifier), returnType, property == nul
l ? null : TokenFactory.token(property), operator == null ? null : TokenFactory.
token(operator), name, parameters, body); | 294 static MethodDeclaration methodDeclaration2(Keyword modifier, TypeName returnT
ype, Keyword property, Keyword operator, SimpleIdentifier name, FormalParameterL
ist parameters, FunctionBody body) => new MethodDeclaration.full(null, null, nul
l, modifier == null ? null : TokenFactory.token(modifier), returnType, property
== null ? null : TokenFactory.token(property), operator == null ? null : TokenFa
ctory.token(operator), name, parameters, body); |
| 167 static MethodInvocation methodInvocation(Expression target, String methodName,
List<Expression> arguments) => new MethodInvocation.full(target, target == null
? null : TokenFactory.token3(TokenType.PERIOD), identifier2(methodName), argume
ntList(arguments)); | 295 static MethodInvocation methodInvocation(Expression target, String methodName,
List<Expression> arguments) => new MethodInvocation.full(target, target == null
? null : TokenFactory.token3(TokenType.PERIOD), identifier2(methodName), argume
ntList(arguments)); |
| 168 static MethodInvocation methodInvocation2(String methodName, List<Expression>
arguments) => methodInvocation(null, methodName, arguments); | 296 static MethodInvocation methodInvocation2(String methodName, List<Expression>
arguments) => methodInvocation(null, methodName, arguments); |
| 169 static NamedExpression namedExpression(String label5, Expression expression) =
> new NamedExpression.full(label(label5), expression); | 297 static NamedExpression namedExpression(String label6, Expression expression) =
> new NamedExpression.full(label(label6), expression); |
| 170 static DefaultFormalParameter namedFormalParameter(NormalFormalParameter param
eter, Expression expression) => new DefaultFormalParameter.full(parameter, Param
eterKind.NAMED, expression == null ? null : TokenFactory.token3(TokenType.COLON)
, expression); | 298 static DefaultFormalParameter namedFormalParameter(NormalFormalParameter param
eter, Expression expression) => new DefaultFormalParameter.full(parameter, Param
eterKind.NAMED, expression == null ? null : TokenFactory.token3(TokenType.COLON)
, expression); |
| 171 static NullLiteral nullLiteral() => new NullLiteral.full(TokenFactory.token(Ke
yword.NULL)); | 299 static NullLiteral nullLiteral() => new NullLiteral.full(TokenFactory.token(Ke
yword.NULL)); |
| 172 static ParenthesizedExpression parenthesizedExpression(Expression expression)
=> new ParenthesizedExpression.full(TokenFactory.token3(TokenType.OPEN_PAREN), e
xpression, TokenFactory.token3(TokenType.CLOSE_PAREN)); | 300 static ParenthesizedExpression parenthesizedExpression(Expression expression)
=> new ParenthesizedExpression.full(TokenFactory.token3(TokenType.OPEN_PAREN), e
xpression, TokenFactory.token3(TokenType.CLOSE_PAREN)); |
| 173 static PartDirective partDirective(List<Annotation> metadata, String url) => n
ew PartDirective.full(null, metadata, TokenFactory.token(Keyword.PART), string2(
url), TokenFactory.token3(TokenType.SEMICOLON)); | 301 static PartDirective partDirective(List<Annotation> metadata, String url) => n
ew PartDirective.full(null, metadata, TokenFactory.token(Keyword.PART), string2(
url), TokenFactory.token3(TokenType.SEMICOLON)); |
| 174 static PartDirective partDirective2(String url) => partDirective(new List<Anno
tation>(), url); | 302 static PartDirective partDirective2(String url) => partDirective(new List<Anno
tation>(), url); |
| 175 static PartOfDirective partOfDirective(LibraryIdentifier libraryName) => partO
fDirective2(new List<Annotation>(), libraryName); | 303 static PartOfDirective partOfDirective(LibraryIdentifier libraryName) => partO
fDirective2(new List<Annotation>(), libraryName); |
| 176 static PartOfDirective partOfDirective2(List<Annotation> metadata, LibraryIden
tifier libraryName) => new PartOfDirective.full(null, metadata, TokenFactory.tok
en(Keyword.PART), TokenFactory.token2("of"), libraryName, TokenFactory.token3(To
kenType.SEMICOLON)); | 304 static PartOfDirective partOfDirective2(List<Annotation> metadata, LibraryIden
tifier libraryName) => new PartOfDirective.full(null, metadata, TokenFactory.tok
en(Keyword.PART), TokenFactory.token2("of"), libraryName, TokenFactory.token3(To
kenType.SEMICOLON)); |
| 177 static DefaultFormalParameter positionalFormalParameter(NormalFormalParameter
parameter, Expression expression) => new DefaultFormalParameter.full(parameter,
ParameterKind.POSITIONAL, expression == null ? null : TokenFactory.token3(TokenT
ype.EQ), expression); | 305 static DefaultFormalParameter positionalFormalParameter(NormalFormalParameter
parameter, Expression expression) => new DefaultFormalParameter.full(parameter,
ParameterKind.POSITIONAL, expression == null ? null : TokenFactory.token3(TokenT
ype.EQ), expression); |
| 178 static PostfixExpression postfixExpression(Expression expression, TokenType op
erator) => new PostfixExpression.full(expression, TokenFactory.token3(operator))
; | 306 static PostfixExpression postfixExpression(Expression expression, TokenType op
erator) => new PostfixExpression.full(expression, TokenFactory.token3(operator))
; |
| 179 static PrefixExpression prefixExpression(TokenType operator, Expression expres
sion) => new PrefixExpression.full(TokenFactory.token3(operator), expression); | 307 static PrefixExpression prefixExpression(TokenType operator, Expression expres
sion) => new PrefixExpression.full(TokenFactory.token3(operator), expression); |
| 180 static PropertyAccess propertyAccess(Expression target, String propertyName) =
> new PropertyAccess.full(target, TokenFactory.token3(TokenType.PERIOD), identif
ier2(propertyName)); | 308 static PropertyAccess propertyAccess(Expression target, SimpleIdentifier prope
rtyName) => new PropertyAccess.full(target, TokenFactory.token3(TokenType.PERIOD
), propertyName); |
| 309 static PropertyAccess propertyAccess2(Expression target, String propertyName)
=> new PropertyAccess.full(target, TokenFactory.token3(TokenType.PERIOD), identi
fier2(propertyName)); |
| 181 static RedirectingConstructorInvocation redirectingConstructorInvocation(List<
Expression> arguments) => redirectingConstructorInvocation2(null, arguments); | 310 static RedirectingConstructorInvocation redirectingConstructorInvocation(List<
Expression> arguments) => redirectingConstructorInvocation2(null, arguments); |
| 182 static RedirectingConstructorInvocation redirectingConstructorInvocation2(Stri
ng constructorName, List<Expression> arguments) => new RedirectingConstructorInv
ocation.full(TokenFactory.token(Keyword.THIS), constructorName == null ? null :
TokenFactory.token3(TokenType.PERIOD), constructorName == null ? null : identifi
er2(constructorName), argumentList(arguments)); | 311 static RedirectingConstructorInvocation redirectingConstructorInvocation2(Stri
ng constructorName, List<Expression> arguments) => new RedirectingConstructorInv
ocation.full(TokenFactory.token(Keyword.THIS), constructorName == null ? null :
TokenFactory.token3(TokenType.PERIOD), constructorName == null ? null : identifi
er2(constructorName), argumentList(arguments)); |
| 183 static ReturnStatement returnStatement() => returnStatement2(null); | 312 static ReturnStatement returnStatement() => returnStatement2(null); |
| 184 static ReturnStatement returnStatement2(Expression expression) => new ReturnSt
atement.full(TokenFactory.token(Keyword.RETURN), expression, TokenFactory.token3
(TokenType.SEMICOLON)); | 313 static ReturnStatement returnStatement2(Expression expression) => new ReturnSt
atement.full(TokenFactory.token(Keyword.RETURN), expression, TokenFactory.token3
(TokenType.SEMICOLON)); |
| 185 static ScriptTag scriptTag(String scriptTag5) => new ScriptTag.full(TokenFacto
ry.token2(scriptTag5)); | 314 static ScriptTag scriptTag(String scriptTag5) => new ScriptTag.full(TokenFacto
ry.token2(scriptTag5)); |
| 315 static ShowCombinator showCombinator(List<SimpleIdentifier> identifiers) => ne
w ShowCombinator.full(TokenFactory.token2("show"), list(identifiers)); |
| 316 static ShowCombinator showCombinator2(List<String> identifiers) { |
| 317 List<SimpleIdentifier> identifierList = new List<SimpleIdentifier>(); |
| 318 for (String identifier in identifiers) { |
| 319 identifierList.add(identifier2(identifier)); |
| 320 } |
| 321 return new ShowCombinator.full(TokenFactory.token2("show"), identifierList); |
| 322 } |
| 186 static SimpleFormalParameter simpleFormalParameter(Keyword keyword, String par
ameterName) => simpleFormalParameter2(keyword, null, parameterName); | 323 static SimpleFormalParameter simpleFormalParameter(Keyword keyword, String par
ameterName) => simpleFormalParameter2(keyword, null, parameterName); |
| 187 static SimpleFormalParameter simpleFormalParameter2(Keyword keyword, TypeName
type, String parameterName) => new SimpleFormalParameter.full(null, null, keywor
d == null ? null : TokenFactory.token(keyword), type, identifier2(parameterName)
); | 324 static SimpleFormalParameter simpleFormalParameter2(Keyword keyword, TypeName
type, String parameterName) => new SimpleFormalParameter.full(null, null, keywor
d == null ? null : TokenFactory.token(keyword), type, identifier2(parameterName)
); |
| 188 static SimpleFormalParameter simpleFormalParameter3(String parameterName) => s
impleFormalParameter2(null, null, parameterName); | 325 static SimpleFormalParameter simpleFormalParameter3(String parameterName) => s
impleFormalParameter2(null, null, parameterName); |
| 189 static SimpleFormalParameter simpleFormalParameter4(TypeName type, String para
meterName) => simpleFormalParameter2(null, type, parameterName); | 326 static SimpleFormalParameter simpleFormalParameter4(TypeName type, String para
meterName) => simpleFormalParameter2(null, type, parameterName); |
| 190 static StringInterpolation string(List<InterpolationElement> elements) => new
StringInterpolation.full(list(elements)); | 327 static StringInterpolation string(List<InterpolationElement> elements) => new
StringInterpolation.full(list(elements)); |
| 191 static SimpleStringLiteral string2(String content) => new SimpleStringLiteral.
full(TokenFactory.token2("'${content}'"), content); | 328 static SimpleStringLiteral string2(String content) => new SimpleStringLiteral.
full(TokenFactory.token2("'${content}'"), content); |
| 192 static SuperConstructorInvocation superConstructorInvocation(List<Expression>
arguments) => superConstructorInvocation2(null, arguments); | 329 static SuperConstructorInvocation superConstructorInvocation(List<Expression>
arguments) => superConstructorInvocation2(null, arguments); |
| 193 static SuperConstructorInvocation superConstructorInvocation2(String name, Lis
t<Expression> arguments) => new SuperConstructorInvocation.full(TokenFactory.tok
en(Keyword.SUPER), name == null ? null : TokenFactory.token3(TokenType.PERIOD),
name == null ? null : identifier2(name), argumentList(arguments)); | 330 static SuperConstructorInvocation superConstructorInvocation2(String name, Lis
t<Expression> arguments) => new SuperConstructorInvocation.full(TokenFactory.tok
en(Keyword.SUPER), name == null ? null : TokenFactory.token3(TokenType.PERIOD),
name == null ? null : identifier2(name), argumentList(arguments)); |
| 194 static SuperExpression superExpression() => new SuperExpression.full(TokenFact
ory.token(Keyword.SUPER)); | 331 static SuperExpression superExpression() => new SuperExpression.full(TokenFact
ory.token(Keyword.SUPER)); |
| 195 static SwitchCase switchCase(Expression expression, List<Statement> statements
) => switchCase2(new List<Label>(), expression, statements); | 332 static SwitchCase switchCase(Expression expression, List<Statement> statements
) => switchCase2(new List<Label>(), expression, statements); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 208 static FunctionTypeAlias typeAlias(TypeName returnType, String name, TypeParam
eterList typeParameters, FormalParameterList parameters) => new FunctionTypeAlia
s.full(null, null, TokenFactory.token(Keyword.TYPEDEF), returnType, identifier2(
name), typeParameters, parameters, TokenFactory.token3(TokenType.SEMICOLON)); | 345 static FunctionTypeAlias typeAlias(TypeName returnType, String name, TypeParam
eterList typeParameters, FormalParameterList parameters) => new FunctionTypeAlia
s.full(null, null, TokenFactory.token(Keyword.TYPEDEF), returnType, identifier2(
name), typeParameters, parameters, TokenFactory.token3(TokenType.SEMICOLON)); |
| 209 static TypeArgumentList typeArgumentList(List<TypeName> typeNames) => new Type
ArgumentList.full(TokenFactory.token3(TokenType.LT), list(typeNames), TokenFacto
ry.token3(TokenType.GT)); | 346 static TypeArgumentList typeArgumentList(List<TypeName> typeNames) => new Type
ArgumentList.full(TokenFactory.token3(TokenType.LT), list(typeNames), TokenFacto
ry.token3(TokenType.GT)); |
| 210 /** | 347 /** |
| 211 * Create a type name whose name has been resolved to the given element and wh
ose type has been | 348 * Create a type name whose name has been resolved to the given element and wh
ose type has been |
| 212 * resolved to the type of the given element. | 349 * resolved to the type of the given element. |
| 213 * <p> | 350 * <p> |
| 214 * <b>Note:</b> This method does not correctly handle class elements that have
type parameters. | 351 * <b>Note:</b> This method does not correctly handle class elements that have
type parameters. |
| 215 * @param element the element defining the type represented by the type name | 352 * @param element the element defining the type represented by the type name |
| 216 * @return the type name that was created | 353 * @return the type name that was created |
| 217 */ | 354 */ |
| 218 static TypeName typeName(ClassElement element42, List<TypeName> arguments) { | 355 static TypeName typeName(ClassElement element49, List<TypeName> arguments) { |
| 219 SimpleIdentifier name19 = identifier2(element42.name); | 356 SimpleIdentifier name20 = identifier2(element49.name); |
| 220 name19.element = element42; | 357 name20.element = element49; |
| 221 TypeName typeName = typeName2(name19, arguments); | 358 TypeName typeName = typeName2(name20, arguments); |
| 222 typeName.type = element42.type; | 359 typeName.type = element49.type; |
| 223 return typeName; | 360 return typeName; |
| 224 } | 361 } |
| 225 static TypeName typeName2(Identifier name, List<TypeName> arguments) { | 362 static TypeName typeName2(Identifier name, List<TypeName> arguments) { |
| 226 if (arguments.length == 0) { | 363 if (arguments.length == 0) { |
| 227 return new TypeName.full(name, null); | 364 return new TypeName.full(name, null); |
| 228 } | 365 } |
| 229 return new TypeName.full(name, typeArgumentList(arguments)); | 366 return new TypeName.full(name, typeArgumentList(arguments)); |
| 230 } | 367 } |
| 231 static TypeName typeName3(String name, List<TypeName> arguments) { | 368 static TypeName typeName3(String name, List<TypeName> arguments) { |
| 232 if (arguments.length == 0) { | 369 if (arguments.length == 0) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 251 static VariableDeclarationStatement variableDeclarationStatement2(Keyword keyw
ord, List<VariableDeclaration> variables) => variableDeclarationStatement(keywor
d, null, variables); | 388 static VariableDeclarationStatement variableDeclarationStatement2(Keyword keyw
ord, List<VariableDeclaration> variables) => variableDeclarationStatement(keywor
d, null, variables); |
| 252 static WhileStatement whileStatement(Expression condition, Statement body) =>
new WhileStatement.full(TokenFactory.token(Keyword.WHILE), TokenFactory.token3(T
okenType.OPEN_PAREN), condition, TokenFactory.token3(TokenType.CLOSE_PAREN), bod
y); | 389 static WhileStatement whileStatement(Expression condition, Statement body) =>
new WhileStatement.full(TokenFactory.token(Keyword.WHILE), TokenFactory.token3(T
okenType.OPEN_PAREN), condition, TokenFactory.token3(TokenType.CLOSE_PAREN), bod
y); |
| 253 static WithClause withClause(List<TypeName> types) => new WithClause.full(Toke
nFactory.token(Keyword.WITH), list(types)); | 390 static WithClause withClause(List<TypeName> types) => new WithClause.full(Toke
nFactory.token(Keyword.WITH), list(types)); |
| 254 /** | 391 /** |
| 255 * Prevent the creation of instances of this class. | 392 * Prevent the creation of instances of this class. |
| 256 */ | 393 */ |
| 257 ASTFactory() { | 394 ASTFactory() { |
| 258 } | 395 } |
| 259 } | 396 } |
| 260 class SimpleIdentifierTest extends ParserTestCase { | 397 class SimpleIdentifierTest extends ParserTestCase { |
| 261 void test_inGetterContext_assignmentParent_notPure() { | 398 void test_inDeclarationContext_argumentDefinition() { |
| 262 SimpleIdentifier identifier = ASTFactory.identifier2("field"); | 399 SimpleIdentifier identifier14 = ASTFactory.argumentDefinitionTest("p").ident
ifier; |
| 263 ASTFactory.assignmentExpression(identifier, TokenType.PLUS_EQ, null); | 400 JUnitTestCase.assertFalse(identifier14.inDeclarationContext()); |
| 264 JUnitTestCase.assertTrue(identifier.inGetterContext()); | 401 } |
| 265 } | 402 void test_inDeclarationContext_catch_exception() { |
| 266 void test_inGetterContext_assignmentParent_pure() { | 403 SimpleIdentifier identifier = ASTFactory.catchClause("e", []).exceptionParam
eter; |
| 267 SimpleIdentifier identifier = ASTFactory.identifier2("field"); | 404 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); |
| 268 ASTFactory.assignmentExpression(identifier, TokenType.EQ, null); | 405 } |
| 269 JUnitTestCase.assertFalse(identifier.inGetterContext()); | 406 void test_inDeclarationContext_catch_stack() { |
| 270 } | 407 SimpleIdentifier identifier = ASTFactory.catchClause2("e", "s", []).stackTra
ceParameter; |
| 271 void test_inGetterContext_notAssignmentParent() { | 408 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); |
| 272 SimpleIdentifier identifier = ASTFactory.identifier2("field"); | 409 } |
| 273 ASTFactory.binaryExpression(identifier, TokenType.PLUS, null); | 410 void test_inDeclarationContext_classDeclaration() { |
| 274 JUnitTestCase.assertTrue(identifier.inGetterContext()); | 411 SimpleIdentifier identifier = ASTFactory.classDeclaration(null, "C", null, n
ull, null, null, []).name; |
| 275 } | 412 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); |
| 276 void test_inGetterContext_qualifier() { | 413 } |
| 277 SimpleIdentifier identifier = ASTFactory.identifier2("field"); | 414 void test_inDeclarationContext_classTypeAlias() { |
| 278 ASTFactory.identifier(identifier, null); | 415 SimpleIdentifier identifier = ASTFactory.classTypeAlias("C", null, null, nul
l, null, null).name; |
| 279 JUnitTestCase.assertTrue(identifier.inGetterContext()); | 416 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); |
| 280 } | 417 } |
| 281 void test_inGetterContext_whenQualified_false() { | 418 void test_inDeclarationContext_constructorDeclaration() { |
| 282 SimpleIdentifier identifier = ASTFactory.identifier2("field"); | 419 SimpleIdentifier identifier = ASTFactory.constructorDeclaration(ASTFactory.i
dentifier2("C"), "c", null, null).name; |
| 283 PrefixedIdentifier prefixedIdentifier = ASTFactory.identifier3("myPrefix", i
dentifier); | 420 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); |
| 284 ASTFactory.assignmentExpression(prefixedIdentifier, TokenType.PLUS_EQ, null)
; | 421 } |
| 285 JUnitTestCase.assertTrue(identifier.inGetterContext()); | 422 void test_inDeclarationContext_functionDeclaration() { |
| 286 } | 423 SimpleIdentifier identifier = ASTFactory.functionDeclaration(null, null, "f"
, null).name; |
| 287 void test_inGetterContext_whenQualified_true() { | 424 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); |
| 288 SimpleIdentifier identifier = ASTFactory.identifier2("field"); | 425 } |
| 289 PrefixedIdentifier prefixedIdentifier = ASTFactory.identifier3("myPrefix", i
dentifier); | 426 void test_inDeclarationContext_functionTypeAlias() { |
| 290 ASTFactory.assignmentExpression(prefixedIdentifier, TokenType.EQ, null); | 427 SimpleIdentifier identifier = ASTFactory.typeAlias(null, "F", null, null).na
me; |
| 291 JUnitTestCase.assertFalse(identifier.inGetterContext()); | 428 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); |
| 292 } | 429 } |
| 293 void test_inSetterContext_assignmentParent_leftEq() { | 430 void test_inDeclarationContext_label_false() { |
| 294 SimpleIdentifier identifier = ASTFactory.identifier2("field"); | 431 SimpleIdentifier identifier = ASTFactory.namedExpression("l", ASTFactory.int
eger(0)).name.label; |
| 295 ASTFactory.assignmentExpression(identifier, TokenType.EQ, null); | 432 JUnitTestCase.assertFalse(identifier.inDeclarationContext()); |
| 296 JUnitTestCase.assertTrue(identifier.inSetterContext()); | 433 } |
| 297 } | 434 void test_inDeclarationContext_label_true() { |
| 298 void test_inSetterContext_assignmentParent_leftPlusEq() { | 435 Label label2 = ASTFactory.label("l"); |
| 299 SimpleIdentifier identifier = ASTFactory.identifier2("field"); | 436 SimpleIdentifier identifier = label2.label; |
| 300 ASTFactory.assignmentExpression(identifier, TokenType.PLUS_EQ, null); | 437 ASTFactory.labeledStatement(ASTFactory.list([label2]), ASTFactory.emptyState
ment()); |
| 301 JUnitTestCase.assertTrue(identifier.inSetterContext()); | 438 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); |
| 302 } | 439 } |
| 303 void test_inSetterContext_assignmentParent_rightEq() { | 440 void test_inDeclarationContext_methodDeclaration() { |
| 304 SimpleIdentifier identifier = ASTFactory.identifier2("field"); | 441 SimpleIdentifier identifier = ASTFactory.identifier2("m"); |
| 305 ASTFactory.assignmentExpression(null, TokenType.EQ, identifier); | 442 ASTFactory.methodDeclaration2(null, null, null, null, identifier, null, null
); |
| 306 JUnitTestCase.assertFalse(identifier.inSetterContext()); | 443 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); |
| 307 } | 444 } |
| 308 void test_inSetterContext_assignmentParent_rightPlusEq() { | 445 void test_inDeclarationContext_normalFormalParameter() { |
| 309 SimpleIdentifier identifier = ASTFactory.identifier2("field"); | 446 SimpleIdentifier identifier15 = ASTFactory.simpleFormalParameter3("p").ident
ifier; |
| 310 ASTFactory.assignmentExpression(null, TokenType.PLUS_EQ, identifier); | 447 JUnitTestCase.assertTrue(identifier15.inDeclarationContext()); |
| 311 JUnitTestCase.assertFalse(identifier.inSetterContext()); | 448 } |
| 312 } | 449 void test_inDeclarationContext_typeParameter_bound() { |
| 313 void test_inSetterContext_notInterestingParent() { | 450 TypeName bound = ASTFactory.typeName3("A", []); |
| 314 SimpleIdentifier identifier = ASTFactory.identifier2("field"); | 451 SimpleIdentifier identifier = bound.name as SimpleIdentifier; |
| 315 ASTFactory.binaryExpression(identifier, null, null); | 452 ASTFactory.typeParameter2("E", bound); |
| 316 JUnitTestCase.assertFalse(identifier.inSetterContext()); | 453 JUnitTestCase.assertFalse(identifier.inDeclarationContext()); |
| 317 } | 454 } |
| 318 void test_inSetterContext_postfixParent() { | 455 void test_inDeclarationContext_typeParameter_name() { |
| 319 SimpleIdentifier identifier = ASTFactory.identifier2("field"); | 456 SimpleIdentifier identifier = ASTFactory.typeParameter("E").name; |
| 320 ASTFactory.postfixExpression(identifier, null); | 457 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); |
| 321 JUnitTestCase.assertTrue(identifier.inSetterContext()); | 458 } |
| 322 } | 459 void test_inDeclarationContext_variableDeclaration() { |
| 323 void test_inSetterContext_prefixParent_bang() { | 460 SimpleIdentifier identifier = ASTFactory.variableDeclaration("v").name; |
| 324 SimpleIdentifier identifier = ASTFactory.identifier2("field"); | 461 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); |
| 325 ASTFactory.prefixExpression(TokenType.BANG, identifier); | 462 } |
| 326 JUnitTestCase.assertFalse(identifier.inSetterContext()); | 463 void test_inGetterContext() { |
| 327 } | 464 for (WrapperKind wrapper in WrapperKind.values) { |
| 328 void test_inSetterContext_prefixParent_minusMinus() { | 465 for (AssignmentKind assignment in AssignmentKind.values) { |
| 329 SimpleIdentifier identifier = ASTFactory.identifier2("field"); | 466 SimpleIdentifier identifier = createIdentifier(wrapper, assignment); |
| 330 ASTFactory.prefixExpression(TokenType.MINUS_MINUS, identifier); | 467 if (identical(assignment, AssignmentKind.SIMPLE_LEFT) && wrapper != Wrap
perKind.PREFIXED_LEFT && wrapper != WrapperKind.PROPERTY_LEFT) { |
| 331 JUnitTestCase.assertTrue(identifier.inSetterContext()); | 468 if (identifier.inGetterContext()) { |
| 332 } | 469 JUnitTestCase.fail("Expected ${topMostNode(identifier).toSource()} t
o be false"); |
| 333 void test_inSetterContext_prefixParent_plusPlus() { | 470 } |
| 334 SimpleIdentifier identifier = ASTFactory.identifier2("field"); | 471 } else { |
| 335 ASTFactory.prefixExpression(TokenType.PLUS_PLUS, identifier); | 472 if (!identifier.inGetterContext()) { |
| 336 JUnitTestCase.assertTrue(identifier.inSetterContext()); | 473 JUnitTestCase.fail("Expected ${topMostNode(identifier).toSource()} t
o be true"); |
| 337 } | 474 } |
| 338 void test_inSetterContext_qualifier() { | 475 } |
| 339 SimpleIdentifier identifier = ASTFactory.identifier2("field"); | 476 } |
| 340 ASTFactory.identifier(identifier, null); | 477 } |
| 341 JUnitTestCase.assertFalse(identifier.inSetterContext()); | 478 } |
| 342 } | 479 void test_inSetterContext() { |
| 343 void test_inSetterContext_whenQualified_prefixParent_bang() { | 480 for (WrapperKind wrapper in WrapperKind.values) { |
| 344 SimpleIdentifier identifier = ASTFactory.identifier2("field"); | 481 for (AssignmentKind assignment in AssignmentKind.values) { |
| 345 PrefixedIdentifier prefixedIdentifier = ASTFactory.identifier3("myPrefix", i
dentifier); | 482 SimpleIdentifier identifier = createIdentifier(wrapper, assignment); |
| 346 ASTFactory.prefixExpression(TokenType.BANG, prefixedIdentifier); | 483 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)) { |
| 347 JUnitTestCase.assertFalse(identifier.inSetterContext()); | 484 if (identifier.inSetterContext()) { |
| 348 } | 485 JUnitTestCase.fail("Expected ${topMostNode(identifier).toSource()} t
o be false"); |
| 349 void test_inSetterContext_whenQualified_prefixParent_plusPlus() { | 486 } |
| 350 SimpleIdentifier identifier = ASTFactory.identifier2("field"); | 487 } else { |
| 351 PrefixedIdentifier prefixedIdentifier = ASTFactory.identifier3("myPrefix", i
dentifier); | 488 if (!identifier.inSetterContext()) { |
| 352 ASTFactory.prefixExpression(TokenType.PLUS_PLUS, prefixedIdentifier); | 489 JUnitTestCase.fail("Expected ${topMostNode(identifier).toSource()} t
o be true"); |
| 353 JUnitTestCase.assertTrue(identifier.inSetterContext()); | 490 } |
| 491 } |
| 492 } |
| 493 } |
| 494 } |
| 495 SimpleIdentifier createIdentifier(WrapperKind wrapper, AssignmentKind assignme
nt) { |
| 496 SimpleIdentifier identifier = ASTFactory.identifier2("a"); |
| 497 Expression expression = identifier; |
| 498 while (true) { |
| 499 if (wrapper == WrapperKind.PREFIXED_LEFT) { |
| 500 expression = ASTFactory.identifier(identifier, ASTFactory.identifier2("_
")); |
| 501 } else if (wrapper == WrapperKind.PREFIXED_RIGHT) { |
| 502 expression = ASTFactory.identifier(ASTFactory.identifier2("_"), identifi
er); |
| 503 } else if (wrapper == WrapperKind.PROPERTY_LEFT) { |
| 504 expression = ASTFactory.propertyAccess2(expression, "_"); |
| 505 } else if (wrapper == WrapperKind.PROPERTY_RIGHT) { |
| 506 expression = ASTFactory.propertyAccess(ASTFactory.identifier2("_"), iden
tifier); |
| 507 } |
| 508 break; |
| 509 } |
| 510 while (true) { |
| 511 if (assignment == AssignmentKind.BINARY) { |
| 512 ASTFactory.binaryExpression(expression, TokenType.PLUS, ASTFactory.ident
ifier2("_")); |
| 513 } else if (assignment == AssignmentKind.COMPOUND_LEFT) { |
| 514 ASTFactory.assignmentExpression(expression, TokenType.PLUS_EQ, ASTFactor
y.identifier2("_")); |
| 515 } else if (assignment == AssignmentKind.COMPOUND_RIGHT) { |
| 516 ASTFactory.assignmentExpression(ASTFactory.identifier2("_"), TokenType.P
LUS_EQ, expression); |
| 517 } else if (assignment == AssignmentKind.POSTFIX_INC) { |
| 518 ASTFactory.postfixExpression(expression, TokenType.PLUS_PLUS); |
| 519 } else if (assignment == AssignmentKind.PREFIX_DEC) { |
| 520 ASTFactory.prefixExpression(TokenType.MINUS_MINUS, expression); |
| 521 } else if (assignment == AssignmentKind.PREFIX_INC) { |
| 522 ASTFactory.prefixExpression(TokenType.PLUS_PLUS, expression); |
| 523 } else if (assignment == AssignmentKind.PREFIX_NOT) { |
| 524 ASTFactory.prefixExpression(TokenType.BANG, expression); |
| 525 } else if (assignment == AssignmentKind.SIMPLE_LEFT) { |
| 526 ASTFactory.assignmentExpression(expression, TokenType.EQ, ASTFactory.ide
ntifier2("_")); |
| 527 } else if (assignment == AssignmentKind.SIMPLE_RIGHT) { |
| 528 ASTFactory.assignmentExpression(ASTFactory.identifier2("_"), TokenType.E
Q, expression); |
| 529 } |
| 530 break; |
| 531 } |
| 532 return identifier; |
| 533 } |
| 534 /** |
| 535 * Return the top-most node in the AST structure containing the given identifi
er. |
| 536 * @param identifier the identifier in the AST structure being traversed |
| 537 * @return the root of the AST structure containing the identifier |
| 538 */ |
| 539 ASTNode topMostNode(SimpleIdentifier identifier) { |
| 540 ASTNode child = identifier; |
| 541 ASTNode parent18 = identifier.parent; |
| 542 while (parent18 != null) { |
| 543 child = parent18; |
| 544 parent18 = parent18.parent; |
| 545 } |
| 546 return child; |
| 354 } | 547 } |
| 355 static dartSuite() { | 548 static dartSuite() { |
| 356 _ut.group('SimpleIdentifierTest', () { | 549 _ut.group('SimpleIdentifierTest', () { |
| 357 _ut.test('test_inGetterContext_assignmentParent_notPure', () { | 550 _ut.test('test_inDeclarationContext_argumentDefinition', () { |
| 358 final __test = new SimpleIdentifierTest(); | 551 final __test = new SimpleIdentifierTest(); |
| 359 runJUnitTest(__test, __test.test_inGetterContext_assignmentParent_notPur
e); | 552 runJUnitTest(__test, __test.test_inDeclarationContext_argumentDefinition
); |
| 360 }); | 553 }); |
| 361 _ut.test('test_inGetterContext_assignmentParent_pure', () { | 554 _ut.test('test_inDeclarationContext_catch_exception', () { |
| 362 final __test = new SimpleIdentifierTest(); | 555 final __test = new SimpleIdentifierTest(); |
| 363 runJUnitTest(__test, __test.test_inGetterContext_assignmentParent_pure); | 556 runJUnitTest(__test, __test.test_inDeclarationContext_catch_exception); |
| 364 }); | 557 }); |
| 365 _ut.test('test_inGetterContext_notAssignmentParent', () { | 558 _ut.test('test_inDeclarationContext_catch_stack', () { |
| 366 final __test = new SimpleIdentifierTest(); | 559 final __test = new SimpleIdentifierTest(); |
| 367 runJUnitTest(__test, __test.test_inGetterContext_notAssignmentParent); | 560 runJUnitTest(__test, __test.test_inDeclarationContext_catch_stack); |
| 368 }); | 561 }); |
| 369 _ut.test('test_inGetterContext_qualifier', () { | 562 _ut.test('test_inDeclarationContext_classDeclaration', () { |
| 370 final __test = new SimpleIdentifierTest(); | 563 final __test = new SimpleIdentifierTest(); |
| 371 runJUnitTest(__test, __test.test_inGetterContext_qualifier); | 564 runJUnitTest(__test, __test.test_inDeclarationContext_classDeclaration); |
| 372 }); | 565 }); |
| 373 _ut.test('test_inGetterContext_whenQualified_false', () { | 566 _ut.test('test_inDeclarationContext_classTypeAlias', () { |
| 374 final __test = new SimpleIdentifierTest(); | 567 final __test = new SimpleIdentifierTest(); |
| 375 runJUnitTest(__test, __test.test_inGetterContext_whenQualified_false); | 568 runJUnitTest(__test, __test.test_inDeclarationContext_classTypeAlias); |
| 376 }); | 569 }); |
| 377 _ut.test('test_inGetterContext_whenQualified_true', () { | 570 _ut.test('test_inDeclarationContext_constructorDeclaration', () { |
| 378 final __test = new SimpleIdentifierTest(); | 571 final __test = new SimpleIdentifierTest(); |
| 379 runJUnitTest(__test, __test.test_inGetterContext_whenQualified_true); | 572 runJUnitTest(__test, __test.test_inDeclarationContext_constructorDeclara
tion); |
| 380 }); | 573 }); |
| 381 _ut.test('test_inSetterContext_assignmentParent_leftEq', () { | 574 _ut.test('test_inDeclarationContext_functionDeclaration', () { |
| 382 final __test = new SimpleIdentifierTest(); | 575 final __test = new SimpleIdentifierTest(); |
| 383 runJUnitTest(__test, __test.test_inSetterContext_assignmentParent_leftEq
); | 576 runJUnitTest(__test, __test.test_inDeclarationContext_functionDeclaratio
n); |
| 384 }); | 577 }); |
| 385 _ut.test('test_inSetterContext_assignmentParent_leftPlusEq', () { | 578 _ut.test('test_inDeclarationContext_functionTypeAlias', () { |
| 386 final __test = new SimpleIdentifierTest(); | 579 final __test = new SimpleIdentifierTest(); |
| 387 runJUnitTest(__test, __test.test_inSetterContext_assignmentParent_leftPl
usEq); | 580 runJUnitTest(__test, __test.test_inDeclarationContext_functionTypeAlias)
; |
| 388 }); | 581 }); |
| 389 _ut.test('test_inSetterContext_assignmentParent_rightEq', () { | 582 _ut.test('test_inDeclarationContext_label_false', () { |
| 390 final __test = new SimpleIdentifierTest(); | 583 final __test = new SimpleIdentifierTest(); |
| 391 runJUnitTest(__test, __test.test_inSetterContext_assignmentParent_rightE
q); | 584 runJUnitTest(__test, __test.test_inDeclarationContext_label_false); |
| 392 }); | 585 }); |
| 393 _ut.test('test_inSetterContext_assignmentParent_rightPlusEq', () { | 586 _ut.test('test_inDeclarationContext_label_true', () { |
| 394 final __test = new SimpleIdentifierTest(); | 587 final __test = new SimpleIdentifierTest(); |
| 395 runJUnitTest(__test, __test.test_inSetterContext_assignmentParent_rightP
lusEq); | 588 runJUnitTest(__test, __test.test_inDeclarationContext_label_true); |
| 396 }); | 589 }); |
| 397 _ut.test('test_inSetterContext_notInterestingParent', () { | 590 _ut.test('test_inDeclarationContext_methodDeclaration', () { |
| 398 final __test = new SimpleIdentifierTest(); | 591 final __test = new SimpleIdentifierTest(); |
| 399 runJUnitTest(__test, __test.test_inSetterContext_notInterestingParent); | 592 runJUnitTest(__test, __test.test_inDeclarationContext_methodDeclaration)
; |
| 400 }); | 593 }); |
| 401 _ut.test('test_inSetterContext_postfixParent', () { | 594 _ut.test('test_inDeclarationContext_normalFormalParameter', () { |
| 402 final __test = new SimpleIdentifierTest(); | 595 final __test = new SimpleIdentifierTest(); |
| 403 runJUnitTest(__test, __test.test_inSetterContext_postfixParent); | 596 runJUnitTest(__test, __test.test_inDeclarationContext_normalFormalParame
ter); |
| 404 }); | 597 }); |
| 405 _ut.test('test_inSetterContext_prefixParent_bang', () { | 598 _ut.test('test_inDeclarationContext_typeParameter_bound', () { |
| 406 final __test = new SimpleIdentifierTest(); | 599 final __test = new SimpleIdentifierTest(); |
| 407 runJUnitTest(__test, __test.test_inSetterContext_prefixParent_bang); | 600 runJUnitTest(__test, __test.test_inDeclarationContext_typeParameter_boun
d); |
| 408 }); | 601 }); |
| 409 _ut.test('test_inSetterContext_prefixParent_minusMinus', () { | 602 _ut.test('test_inDeclarationContext_typeParameter_name', () { |
| 410 final __test = new SimpleIdentifierTest(); | 603 final __test = new SimpleIdentifierTest(); |
| 411 runJUnitTest(__test, __test.test_inSetterContext_prefixParent_minusMinus
); | 604 runJUnitTest(__test, __test.test_inDeclarationContext_typeParameter_name
); |
| 412 }); | 605 }); |
| 413 _ut.test('test_inSetterContext_prefixParent_plusPlus', () { | 606 _ut.test('test_inDeclarationContext_variableDeclaration', () { |
| 414 final __test = new SimpleIdentifierTest(); | 607 final __test = new SimpleIdentifierTest(); |
| 415 runJUnitTest(__test, __test.test_inSetterContext_prefixParent_plusPlus); | 608 runJUnitTest(__test, __test.test_inDeclarationContext_variableDeclaratio
n); |
| 416 }); | 609 }); |
| 417 _ut.test('test_inSetterContext_qualifier', () { | 610 _ut.test('test_inGetterContext', () { |
| 418 final __test = new SimpleIdentifierTest(); | 611 final __test = new SimpleIdentifierTest(); |
| 419 runJUnitTest(__test, __test.test_inSetterContext_qualifier); | 612 runJUnitTest(__test, __test.test_inGetterContext); |
| 420 }); | 613 }); |
| 421 _ut.test('test_inSetterContext_whenQualified_prefixParent_bang', () { | 614 _ut.test('test_inSetterContext', () { |
| 422 final __test = new SimpleIdentifierTest(); | 615 final __test = new SimpleIdentifierTest(); |
| 423 runJUnitTest(__test, __test.test_inSetterContext_whenQualified_prefixPar
ent_bang); | 616 runJUnitTest(__test, __test.test_inSetterContext); |
| 424 }); | 617 }); |
| 425 _ut.test('test_inSetterContext_whenQualified_prefixParent_plusPlus', () { | 618 }); |
| 426 final __test = new SimpleIdentifierTest(); | 619 } |
| 427 runJUnitTest(__test, __test.test_inSetterContext_whenQualified_prefixPar
ent_plusPlus); | 620 } |
| 621 class AssignmentKind { |
| 622 static final AssignmentKind BINARY = new AssignmentKind('BINARY', 0); |
| 623 static final AssignmentKind COMPOUND_LEFT = new AssignmentKind('COMPOUND_LEFT'
, 1); |
| 624 static final AssignmentKind COMPOUND_RIGHT = new AssignmentKind('COMPOUND_RIGH
T', 2); |
| 625 static final AssignmentKind POSTFIX_INC = new AssignmentKind('POSTFIX_INC', 3)
; |
| 626 static final AssignmentKind PREFIX_DEC = new AssignmentKind('PREFIX_DEC', 4); |
| 627 static final AssignmentKind PREFIX_INC = new AssignmentKind('PREFIX_INC', 5); |
| 628 static final AssignmentKind PREFIX_NOT = new AssignmentKind('PREFIX_NOT', 6); |
| 629 static final AssignmentKind SIMPLE_LEFT = new AssignmentKind('SIMPLE_LEFT', 7)
; |
| 630 static final AssignmentKind SIMPLE_RIGHT = new AssignmentKind('SIMPLE_RIGHT',
8); |
| 631 static final AssignmentKind NONE = new AssignmentKind('NONE', 9); |
| 632 static final List<AssignmentKind> values = [BINARY, COMPOUND_LEFT, COMPOUND_RI
GHT, POSTFIX_INC, PREFIX_DEC, PREFIX_INC, PREFIX_NOT, SIMPLE_LEFT, SIMPLE_RIGHT,
NONE]; |
| 633 final String __name; |
| 634 final int __ordinal; |
| 635 AssignmentKind(this.__name, this.__ordinal) { |
| 636 } |
| 637 String toString() => __name; |
| 638 } |
| 639 class WrapperKind { |
| 640 static final WrapperKind PREFIXED_LEFT = new WrapperKind('PREFIXED_LEFT', 0); |
| 641 static final WrapperKind PREFIXED_RIGHT = new WrapperKind('PREFIXED_RIGHT', 1)
; |
| 642 static final WrapperKind PROPERTY_LEFT = new WrapperKind('PROPERTY_LEFT', 2); |
| 643 static final WrapperKind PROPERTY_RIGHT = new WrapperKind('PROPERTY_RIGHT', 3)
; |
| 644 static final WrapperKind NONE = new WrapperKind('NONE', 4); |
| 645 static final List<WrapperKind> values = [PREFIXED_LEFT, PREFIXED_RIGHT, PROPER
TY_LEFT, PROPERTY_RIGHT, NONE]; |
| 646 final String __name; |
| 647 final int __ordinal; |
| 648 WrapperKind(this.__name, this.__ordinal) { |
| 649 } |
| 650 String toString() => __name; |
| 651 } |
| 652 class ConstantEvaluatorTest extends ParserTestCase { |
| 653 void fail_constructor() { |
| 654 Object value = getConstantValue("?"); |
| 655 JUnitTestCase.assertEquals(null, value); |
| 656 } |
| 657 void fail_identifier_class() { |
| 658 Object value = getConstantValue("?"); |
| 659 JUnitTestCase.assertEquals(null, value); |
| 660 } |
| 661 void fail_identifier_function() { |
| 662 Object value = getConstantValue("?"); |
| 663 JUnitTestCase.assertEquals(null, value); |
| 664 } |
| 665 void fail_identifier_static() { |
| 666 Object value = getConstantValue("?"); |
| 667 JUnitTestCase.assertEquals(null, value); |
| 668 } |
| 669 void fail_identifier_staticMethod() { |
| 670 Object value = getConstantValue("?"); |
| 671 JUnitTestCase.assertEquals(null, value); |
| 672 } |
| 673 void fail_identifier_topLevel() { |
| 674 Object value = getConstantValue("?"); |
| 675 JUnitTestCase.assertEquals(null, value); |
| 676 } |
| 677 void fail_identifier_typeVariable() { |
| 678 Object value = getConstantValue("?"); |
| 679 JUnitTestCase.assertEquals(null, value); |
| 680 } |
| 681 void test_binary_bitAnd() { |
| 682 Object value = getConstantValue("74 & 42"); |
| 683 EngineTestCase.assertInstanceOf(int, value); |
| 684 JUnitTestCase.assertEquals(74 & 42, ((value as int))); |
| 685 } |
| 686 void test_binary_bitOr() { |
| 687 Object value = getConstantValue("74 | 42"); |
| 688 EngineTestCase.assertInstanceOf(int, value); |
| 689 JUnitTestCase.assertEquals(74 | 42, ((value as int))); |
| 690 } |
| 691 void test_binary_bitXor() { |
| 692 Object value = getConstantValue("74 ^ 42"); |
| 693 EngineTestCase.assertInstanceOf(int, value); |
| 694 JUnitTestCase.assertEquals(74 ^ 42, ((value as int))); |
| 695 } |
| 696 void test_binary_divide_double() { |
| 697 Object value = getConstantValue("3.2 / 2.3"); |
| 698 EngineTestCase.assertInstanceOf(double, value); |
| 699 JUnitTestCase.assertEquals(3.2 / 2.3, ((value as double))); |
| 700 } |
| 701 void test_binary_divide_integer() { |
| 702 Object value = getConstantValue("3 / 2"); |
| 703 EngineTestCase.assertInstanceOf(int, value); |
| 704 JUnitTestCase.assertEquals(1, ((value as int))); |
| 705 } |
| 706 void test_binary_equal_boolean() { |
| 707 Object value = getConstantValue("true == false"); |
| 708 JUnitTestCase.assertEquals(false, value); |
| 709 } |
| 710 void test_binary_equal_integer() { |
| 711 Object value = getConstantValue("2 == 3"); |
| 712 JUnitTestCase.assertEquals(false, value); |
| 713 } |
| 714 void test_binary_equal_invalidLeft() { |
| 715 Object value = getConstantValue("a == 3"); |
| 716 JUnitTestCase.assertEquals(ConstantEvaluator.NOT_A_CONSTANT, value); |
| 717 } |
| 718 void test_binary_equal_invalidRight() { |
| 719 Object value = getConstantValue("2 == a"); |
| 720 JUnitTestCase.assertEquals(ConstantEvaluator.NOT_A_CONSTANT, value); |
| 721 } |
| 722 void test_binary_equal_string() { |
| 723 Object value = getConstantValue("'a' == 'b'"); |
| 724 JUnitTestCase.assertEquals(false, value); |
| 725 } |
| 726 void test_binary_greaterThan() { |
| 727 Object value = getConstantValue("2 > 3"); |
| 728 JUnitTestCase.assertEquals(false, value); |
| 729 } |
| 730 void test_binary_greaterThanOrEqual() { |
| 731 Object value = getConstantValue("2 >= 3"); |
| 732 JUnitTestCase.assertEquals(false, value); |
| 733 } |
| 734 void test_binary_leftShift() { |
| 735 Object value = getConstantValue("16 << 2"); |
| 736 EngineTestCase.assertInstanceOf(int, value); |
| 737 JUnitTestCase.assertEquals(64, ((value as int))); |
| 738 } |
| 739 void test_binary_lessThan() { |
| 740 Object value = getConstantValue("2 < 3"); |
| 741 JUnitTestCase.assertEquals(true, value); |
| 742 } |
| 743 void test_binary_lessThanOrEqual() { |
| 744 Object value = getConstantValue("2 <= 3"); |
| 745 JUnitTestCase.assertEquals(true, value); |
| 746 } |
| 747 void test_binary_logicalAnd() { |
| 748 Object value = getConstantValue("true && false"); |
| 749 JUnitTestCase.assertEquals(false, value); |
| 750 } |
| 751 void test_binary_logicalOr() { |
| 752 Object value = getConstantValue("true || false"); |
| 753 JUnitTestCase.assertEquals(true, value); |
| 754 } |
| 755 void test_binary_minus_double() { |
| 756 Object value = getConstantValue("3.2 - 2.3"); |
| 757 EngineTestCase.assertInstanceOf(double, value); |
| 758 JUnitTestCase.assertEquals(3.2 - 2.3, ((value as double))); |
| 759 } |
| 760 void test_binary_minus_integer() { |
| 761 Object value = getConstantValue("3 - 2"); |
| 762 EngineTestCase.assertInstanceOf(int, value); |
| 763 JUnitTestCase.assertEquals(1, ((value as int))); |
| 764 } |
| 765 void test_binary_notEqual_boolean() { |
| 766 Object value = getConstantValue("true != false"); |
| 767 JUnitTestCase.assertEquals(true, value); |
| 768 } |
| 769 void test_binary_notEqual_integer() { |
| 770 Object value = getConstantValue("2 != 3"); |
| 771 JUnitTestCase.assertEquals(true, value); |
| 772 } |
| 773 void test_binary_notEqual_invalidLeft() { |
| 774 Object value = getConstantValue("a != 3"); |
| 775 JUnitTestCase.assertEquals(ConstantEvaluator.NOT_A_CONSTANT, value); |
| 776 } |
| 777 void test_binary_notEqual_invalidRight() { |
| 778 Object value = getConstantValue("2 != a"); |
| 779 JUnitTestCase.assertEquals(ConstantEvaluator.NOT_A_CONSTANT, value); |
| 780 } |
| 781 void test_binary_notEqual_string() { |
| 782 Object value = getConstantValue("'a' != 'b'"); |
| 783 JUnitTestCase.assertEquals(true, value); |
| 784 } |
| 785 void test_binary_plus_double() { |
| 786 Object value = getConstantValue("2.3 + 3.2"); |
| 787 EngineTestCase.assertInstanceOf(double, value); |
| 788 JUnitTestCase.assertEquals(2.3 + 3.2, ((value as double))); |
| 789 } |
| 790 void test_binary_plus_integer() { |
| 791 Object value = getConstantValue("2 + 3"); |
| 792 EngineTestCase.assertInstanceOf(int, value); |
| 793 JUnitTestCase.assertEquals(5, ((value as int))); |
| 794 } |
| 795 void test_binary_remainder_double() { |
| 796 Object value = getConstantValue("3.2 % 2.3"); |
| 797 EngineTestCase.assertInstanceOf(double, value); |
| 798 JUnitTestCase.assertEquals(3.2 % 2.3, ((value as double))); |
| 799 } |
| 800 void test_binary_remainder_integer() { |
| 801 Object value = getConstantValue("8 % 3"); |
| 802 EngineTestCase.assertInstanceOf(int, value); |
| 803 JUnitTestCase.assertEquals(2, ((value as int))); |
| 804 } |
| 805 void test_binary_rightShift() { |
| 806 Object value = getConstantValue("64 >> 2"); |
| 807 EngineTestCase.assertInstanceOf(int, value); |
| 808 JUnitTestCase.assertEquals(16, ((value as int))); |
| 809 } |
| 810 void test_binary_times_double() { |
| 811 Object value = getConstantValue("2.3 * 3.2"); |
| 812 EngineTestCase.assertInstanceOf(double, value); |
| 813 JUnitTestCase.assertEquals(2.3 * 3.2, ((value as double))); |
| 814 } |
| 815 void test_binary_times_integer() { |
| 816 Object value = getConstantValue("2 * 3"); |
| 817 EngineTestCase.assertInstanceOf(int, value); |
| 818 JUnitTestCase.assertEquals(6, ((value as int))); |
| 819 } |
| 820 void test_binary_truncatingDivide_double() { |
| 821 Object value = getConstantValue("3.2 ~/ 2.3"); |
| 822 EngineTestCase.assertInstanceOf(int, value); |
| 823 JUnitTestCase.assertEquals(1, ((value as int))); |
| 824 } |
| 825 void test_binary_truncatingDivide_integer() { |
| 826 Object value = getConstantValue("10 ~/ 3"); |
| 827 EngineTestCase.assertInstanceOf(int, value); |
| 828 JUnitTestCase.assertEquals(3, ((value as int))); |
| 829 } |
| 830 void test_literal_boolean_false() { |
| 831 Object value = getConstantValue("false"); |
| 832 JUnitTestCase.assertEquals(false, value); |
| 833 } |
| 834 void test_literal_boolean_true() { |
| 835 Object value = getConstantValue("true"); |
| 836 JUnitTestCase.assertEquals(true, value); |
| 837 } |
| 838 void test_literal_list() { |
| 839 Object value = getConstantValue("['a', 'b', 'c']"); |
| 840 EngineTestCase.assertInstanceOf(List, value); |
| 841 List<Object> list = value as List<Object>; |
| 842 JUnitTestCase.assertEquals(3, list.length); |
| 843 JUnitTestCase.assertEquals("a", list[0]); |
| 844 JUnitTestCase.assertEquals("b", list[1]); |
| 845 JUnitTestCase.assertEquals("c", list[2]); |
| 846 } |
| 847 void test_literal_map() { |
| 848 Object value = getConstantValue("{'a' : 'm', 'b' : 'n', 'c' : 'o'}"); |
| 849 EngineTestCase.assertInstanceOf(Map, value); |
| 850 Map<Object, Object> map = value as Map<Object, Object>; |
| 851 JUnitTestCase.assertEquals(3, map.length); |
| 852 JUnitTestCase.assertEquals("m", map["a"]); |
| 853 JUnitTestCase.assertEquals("n", map["b"]); |
| 854 JUnitTestCase.assertEquals("o", map["c"]); |
| 855 } |
| 856 void test_literal_null() { |
| 857 Object value = getConstantValue("null"); |
| 858 JUnitTestCase.assertEquals(null, value); |
| 859 } |
| 860 void test_literal_number_double() { |
| 861 Object value = getConstantValue("3.45"); |
| 862 EngineTestCase.assertInstanceOf(double, value); |
| 863 JUnitTestCase.assertEquals(3.45, ((value as double))); |
| 864 } |
| 865 void test_literal_number_integer() { |
| 866 Object value = getConstantValue("42"); |
| 867 EngineTestCase.assertInstanceOf(int, value); |
| 868 JUnitTestCase.assertEquals(42, ((value as int))); |
| 869 } |
| 870 void test_literal_string_adjacent() { |
| 871 Object value = getConstantValue("'abc' 'def'"); |
| 872 JUnitTestCase.assertEquals("abcdef", value); |
| 873 } |
| 874 void test_literal_string_interpolation_invalid() { |
| 875 Object value = getConstantValue("'a\${f()}c'"); |
| 876 JUnitTestCase.assertEquals(ConstantEvaluator.NOT_A_CONSTANT, value); |
| 877 } |
| 878 void test_literal_string_interpolation_valid() { |
| 879 Object value = getConstantValue("'a\${3}c'"); |
| 880 JUnitTestCase.assertEquals("a3c", value); |
| 881 } |
| 882 void test_literal_string_simple() { |
| 883 Object value = getConstantValue("'abc'"); |
| 884 JUnitTestCase.assertEquals("abc", value); |
| 885 } |
| 886 void test_parenthesizedExpression() { |
| 887 Object value = getConstantValue("('a')"); |
| 888 JUnitTestCase.assertEquals("a", value); |
| 889 } |
| 890 void test_unary_bitNot() { |
| 891 Object value = getConstantValue("~42"); |
| 892 EngineTestCase.assertInstanceOf(int, value); |
| 893 JUnitTestCase.assertEquals(~42, ((value as int))); |
| 894 } |
| 895 void test_unary_logicalNot() { |
| 896 Object value = getConstantValue("!true"); |
| 897 JUnitTestCase.assertEquals(false, value); |
| 898 } |
| 899 void test_unary_negated_double() { |
| 900 Object value = getConstantValue("-42.3"); |
| 901 EngineTestCase.assertInstanceOf(double, value); |
| 902 JUnitTestCase.assertEquals(-42.3, ((value as double))); |
| 903 } |
| 904 void test_unary_negated_integer() { |
| 905 Object value = getConstantValue("-42"); |
| 906 EngineTestCase.assertInstanceOf(int, value); |
| 907 JUnitTestCase.assertEquals(-42, ((value as int))); |
| 908 } |
| 909 Object getConstantValue(String source) => ParserTestCase.parseExpression(sourc
e, []).accept(new ConstantEvaluator()); |
| 910 static dartSuite() { |
| 911 _ut.group('ConstantEvaluatorTest', () { |
| 912 _ut.test('test_binary_bitAnd', () { |
| 913 final __test = new ConstantEvaluatorTest(); |
| 914 runJUnitTest(__test, __test.test_binary_bitAnd); |
| 915 }); |
| 916 _ut.test('test_binary_bitOr', () { |
| 917 final __test = new ConstantEvaluatorTest(); |
| 918 runJUnitTest(__test, __test.test_binary_bitOr); |
| 919 }); |
| 920 _ut.test('test_binary_bitXor', () { |
| 921 final __test = new ConstantEvaluatorTest(); |
| 922 runJUnitTest(__test, __test.test_binary_bitXor); |
| 923 }); |
| 924 _ut.test('test_binary_divide_double', () { |
| 925 final __test = new ConstantEvaluatorTest(); |
| 926 runJUnitTest(__test, __test.test_binary_divide_double); |
| 927 }); |
| 928 _ut.test('test_binary_divide_integer', () { |
| 929 final __test = new ConstantEvaluatorTest(); |
| 930 runJUnitTest(__test, __test.test_binary_divide_integer); |
| 931 }); |
| 932 _ut.test('test_binary_equal_boolean', () { |
| 933 final __test = new ConstantEvaluatorTest(); |
| 934 runJUnitTest(__test, __test.test_binary_equal_boolean); |
| 935 }); |
| 936 _ut.test('test_binary_equal_integer', () { |
| 937 final __test = new ConstantEvaluatorTest(); |
| 938 runJUnitTest(__test, __test.test_binary_equal_integer); |
| 939 }); |
| 940 _ut.test('test_binary_equal_invalidLeft', () { |
| 941 final __test = new ConstantEvaluatorTest(); |
| 942 runJUnitTest(__test, __test.test_binary_equal_invalidLeft); |
| 943 }); |
| 944 _ut.test('test_binary_equal_invalidRight', () { |
| 945 final __test = new ConstantEvaluatorTest(); |
| 946 runJUnitTest(__test, __test.test_binary_equal_invalidRight); |
| 947 }); |
| 948 _ut.test('test_binary_equal_string', () { |
| 949 final __test = new ConstantEvaluatorTest(); |
| 950 runJUnitTest(__test, __test.test_binary_equal_string); |
| 951 }); |
| 952 _ut.test('test_binary_greaterThan', () { |
| 953 final __test = new ConstantEvaluatorTest(); |
| 954 runJUnitTest(__test, __test.test_binary_greaterThan); |
| 955 }); |
| 956 _ut.test('test_binary_greaterThanOrEqual', () { |
| 957 final __test = new ConstantEvaluatorTest(); |
| 958 runJUnitTest(__test, __test.test_binary_greaterThanOrEqual); |
| 959 }); |
| 960 _ut.test('test_binary_leftShift', () { |
| 961 final __test = new ConstantEvaluatorTest(); |
| 962 runJUnitTest(__test, __test.test_binary_leftShift); |
| 963 }); |
| 964 _ut.test('test_binary_lessThan', () { |
| 965 final __test = new ConstantEvaluatorTest(); |
| 966 runJUnitTest(__test, __test.test_binary_lessThan); |
| 967 }); |
| 968 _ut.test('test_binary_lessThanOrEqual', () { |
| 969 final __test = new ConstantEvaluatorTest(); |
| 970 runJUnitTest(__test, __test.test_binary_lessThanOrEqual); |
| 971 }); |
| 972 _ut.test('test_binary_logicalAnd', () { |
| 973 final __test = new ConstantEvaluatorTest(); |
| 974 runJUnitTest(__test, __test.test_binary_logicalAnd); |
| 975 }); |
| 976 _ut.test('test_binary_logicalOr', () { |
| 977 final __test = new ConstantEvaluatorTest(); |
| 978 runJUnitTest(__test, __test.test_binary_logicalOr); |
| 979 }); |
| 980 _ut.test('test_binary_minus_double', () { |
| 981 final __test = new ConstantEvaluatorTest(); |
| 982 runJUnitTest(__test, __test.test_binary_minus_double); |
| 983 }); |
| 984 _ut.test('test_binary_minus_integer', () { |
| 985 final __test = new ConstantEvaluatorTest(); |
| 986 runJUnitTest(__test, __test.test_binary_minus_integer); |
| 987 }); |
| 988 _ut.test('test_binary_notEqual_boolean', () { |
| 989 final __test = new ConstantEvaluatorTest(); |
| 990 runJUnitTest(__test, __test.test_binary_notEqual_boolean); |
| 991 }); |
| 992 _ut.test('test_binary_notEqual_integer', () { |
| 993 final __test = new ConstantEvaluatorTest(); |
| 994 runJUnitTest(__test, __test.test_binary_notEqual_integer); |
| 995 }); |
| 996 _ut.test('test_binary_notEqual_invalidLeft', () { |
| 997 final __test = new ConstantEvaluatorTest(); |
| 998 runJUnitTest(__test, __test.test_binary_notEqual_invalidLeft); |
| 999 }); |
| 1000 _ut.test('test_binary_notEqual_invalidRight', () { |
| 1001 final __test = new ConstantEvaluatorTest(); |
| 1002 runJUnitTest(__test, __test.test_binary_notEqual_invalidRight); |
| 1003 }); |
| 1004 _ut.test('test_binary_notEqual_string', () { |
| 1005 final __test = new ConstantEvaluatorTest(); |
| 1006 runJUnitTest(__test, __test.test_binary_notEqual_string); |
| 1007 }); |
| 1008 _ut.test('test_binary_plus_double', () { |
| 1009 final __test = new ConstantEvaluatorTest(); |
| 1010 runJUnitTest(__test, __test.test_binary_plus_double); |
| 1011 }); |
| 1012 _ut.test('test_binary_plus_integer', () { |
| 1013 final __test = new ConstantEvaluatorTest(); |
| 1014 runJUnitTest(__test, __test.test_binary_plus_integer); |
| 1015 }); |
| 1016 _ut.test('test_binary_remainder_double', () { |
| 1017 final __test = new ConstantEvaluatorTest(); |
| 1018 runJUnitTest(__test, __test.test_binary_remainder_double); |
| 1019 }); |
| 1020 _ut.test('test_binary_remainder_integer', () { |
| 1021 final __test = new ConstantEvaluatorTest(); |
| 1022 runJUnitTest(__test, __test.test_binary_remainder_integer); |
| 1023 }); |
| 1024 _ut.test('test_binary_rightShift', () { |
| 1025 final __test = new ConstantEvaluatorTest(); |
| 1026 runJUnitTest(__test, __test.test_binary_rightShift); |
| 1027 }); |
| 1028 _ut.test('test_binary_times_double', () { |
| 1029 final __test = new ConstantEvaluatorTest(); |
| 1030 runJUnitTest(__test, __test.test_binary_times_double); |
| 1031 }); |
| 1032 _ut.test('test_binary_times_integer', () { |
| 1033 final __test = new ConstantEvaluatorTest(); |
| 1034 runJUnitTest(__test, __test.test_binary_times_integer); |
| 1035 }); |
| 1036 _ut.test('test_binary_truncatingDivide_double', () { |
| 1037 final __test = new ConstantEvaluatorTest(); |
| 1038 runJUnitTest(__test, __test.test_binary_truncatingDivide_double); |
| 1039 }); |
| 1040 _ut.test('test_binary_truncatingDivide_integer', () { |
| 1041 final __test = new ConstantEvaluatorTest(); |
| 1042 runJUnitTest(__test, __test.test_binary_truncatingDivide_integer); |
| 1043 }); |
| 1044 _ut.test('test_literal_boolean_false', () { |
| 1045 final __test = new ConstantEvaluatorTest(); |
| 1046 runJUnitTest(__test, __test.test_literal_boolean_false); |
| 1047 }); |
| 1048 _ut.test('test_literal_boolean_true', () { |
| 1049 final __test = new ConstantEvaluatorTest(); |
| 1050 runJUnitTest(__test, __test.test_literal_boolean_true); |
| 1051 }); |
| 1052 _ut.test('test_literal_list', () { |
| 1053 final __test = new ConstantEvaluatorTest(); |
| 1054 runJUnitTest(__test, __test.test_literal_list); |
| 1055 }); |
| 1056 _ut.test('test_literal_map', () { |
| 1057 final __test = new ConstantEvaluatorTest(); |
| 1058 runJUnitTest(__test, __test.test_literal_map); |
| 1059 }); |
| 1060 _ut.test('test_literal_null', () { |
| 1061 final __test = new ConstantEvaluatorTest(); |
| 1062 runJUnitTest(__test, __test.test_literal_null); |
| 1063 }); |
| 1064 _ut.test('test_literal_number_double', () { |
| 1065 final __test = new ConstantEvaluatorTest(); |
| 1066 runJUnitTest(__test, __test.test_literal_number_double); |
| 1067 }); |
| 1068 _ut.test('test_literal_number_integer', () { |
| 1069 final __test = new ConstantEvaluatorTest(); |
| 1070 runJUnitTest(__test, __test.test_literal_number_integer); |
| 1071 }); |
| 1072 _ut.test('test_literal_string_adjacent', () { |
| 1073 final __test = new ConstantEvaluatorTest(); |
| 1074 runJUnitTest(__test, __test.test_literal_string_adjacent); |
| 1075 }); |
| 1076 _ut.test('test_literal_string_interpolation_invalid', () { |
| 1077 final __test = new ConstantEvaluatorTest(); |
| 1078 runJUnitTest(__test, __test.test_literal_string_interpolation_invalid); |
| 1079 }); |
| 1080 _ut.test('test_literal_string_interpolation_valid', () { |
| 1081 final __test = new ConstantEvaluatorTest(); |
| 1082 runJUnitTest(__test, __test.test_literal_string_interpolation_valid); |
| 1083 }); |
| 1084 _ut.test('test_literal_string_simple', () { |
| 1085 final __test = new ConstantEvaluatorTest(); |
| 1086 runJUnitTest(__test, __test.test_literal_string_simple); |
| 1087 }); |
| 1088 _ut.test('test_parenthesizedExpression', () { |
| 1089 final __test = new ConstantEvaluatorTest(); |
| 1090 runJUnitTest(__test, __test.test_parenthesizedExpression); |
| 1091 }); |
| 1092 _ut.test('test_unary_bitNot', () { |
| 1093 final __test = new ConstantEvaluatorTest(); |
| 1094 runJUnitTest(__test, __test.test_unary_bitNot); |
| 1095 }); |
| 1096 _ut.test('test_unary_logicalNot', () { |
| 1097 final __test = new ConstantEvaluatorTest(); |
| 1098 runJUnitTest(__test, __test.test_unary_logicalNot); |
| 1099 }); |
| 1100 _ut.test('test_unary_negated_double', () { |
| 1101 final __test = new ConstantEvaluatorTest(); |
| 1102 runJUnitTest(__test, __test.test_unary_negated_double); |
| 1103 }); |
| 1104 _ut.test('test_unary_negated_integer', () { |
| 1105 final __test = new ConstantEvaluatorTest(); |
| 1106 runJUnitTest(__test, __test.test_unary_negated_integer); |
| 428 }); | 1107 }); |
| 429 }); | 1108 }); |
| 430 } | 1109 } |
| 431 } | 1110 } |
| 432 class ToSourceVisitorTest extends EngineTestCase { | 1111 class ToSourceVisitorTest extends EngineTestCase { |
| 433 void test_visitAdjacentStrings() { | 1112 void test_visitAdjacentStrings() { |
| 434 assertSource("'a' 'b'", ASTFactory.adjacentStrings([ASTFactory.string2("a"),
ASTFactory.string2("b")])); | 1113 assertSource("'a' 'b'", ASTFactory.adjacentStrings([ASTFactory.string2("a"),
ASTFactory.string2("b")])); |
| 435 } | 1114 } |
| 436 void test_visitAnnotation_constant() { | 1115 void test_visitAnnotation_constant() { |
| 437 assertSource("@A", ASTFactory.annotation(ASTFactory.identifier2("A"))); | 1116 assertSource("@A", ASTFactory.annotation(ASTFactory.identifier2("A"))); |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 void test_visitDoubleLiteral() { | 1340 void test_visitDoubleLiteral() { |
| 662 assertSource("4.2", ASTFactory.doubleLiteral(4.2)); | 1341 assertSource("4.2", ASTFactory.doubleLiteral(4.2)); |
| 663 } | 1342 } |
| 664 void test_visitEmptyFunctionBody() { | 1343 void test_visitEmptyFunctionBody() { |
| 665 assertSource(";", ASTFactory.emptyFunctionBody()); | 1344 assertSource(";", ASTFactory.emptyFunctionBody()); |
| 666 } | 1345 } |
| 667 void test_visitEmptyStatement() { | 1346 void test_visitEmptyStatement() { |
| 668 assertSource(";", ASTFactory.emptyStatement()); | 1347 assertSource(";", ASTFactory.emptyStatement()); |
| 669 } | 1348 } |
| 670 void test_visitExportDirective_combinator() { | 1349 void test_visitExportDirective_combinator() { |
| 671 assertSource("export 'a.dart' show A;", ASTFactory.exportDirective2("a.dart"
, [(ASTFactory.importShowCombinator([ASTFactory.identifier2("A")]) as Combinator
)])); | 1350 assertSource("export 'a.dart' show A;", ASTFactory.exportDirective2("a.dart"
, [(ASTFactory.showCombinator([ASTFactory.identifier2("A")]) as Combinator)])); |
| 672 } | 1351 } |
| 673 void test_visitExportDirective_combinators() { | 1352 void test_visitExportDirective_combinators() { |
| 674 assertSource("export 'a.dart' show A hide B;", ASTFactory.exportDirective2("
a.dart", [ASTFactory.importShowCombinator([ASTFactory.identifier2("A")]), ASTFac
tory.importHideCombinator([ASTFactory.identifier2("B")])])); | 1353 assertSource("export 'a.dart' show A hide B;", ASTFactory.exportDirective2("
a.dart", [ASTFactory.showCombinator([ASTFactory.identifier2("A")]), ASTFactory.h
ideCombinator([ASTFactory.identifier2("B")])])); |
| 675 } | 1354 } |
| 676 void test_visitExportDirective_minimal() { | 1355 void test_visitExportDirective_minimal() { |
| 677 assertSource("export 'a.dart';", ASTFactory.exportDirective2("a.dart", [])); | 1356 assertSource("export 'a.dart';", ASTFactory.exportDirective2("a.dart", [])); |
| 678 } | 1357 } |
| 679 void test_visitExpressionFunctionBody() { | 1358 void test_visitExpressionFunctionBody() { |
| 680 assertSource("=> a;", ASTFactory.expressionFunctionBody(ASTFactory.identifie
r2("a"))); | 1359 assertSource("=> a;", ASTFactory.expressionFunctionBody(ASTFactory.identifie
r2("a"))); |
| 681 } | 1360 } |
| 682 void test_visitExpressionStatement() { | 1361 void test_visitExpressionStatement() { |
| 683 assertSource("a;", ASTFactory.expressionStatement(ASTFactory.identifier2("a"
))); | 1362 assertSource("a;", ASTFactory.expressionStatement(ASTFactory.identifier2("a"
))); |
| 684 } | 1363 } |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 811 void test_visitIfStatement_withoutElse() { | 1490 void test_visitIfStatement_withoutElse() { |
| 812 assertSource("if (c) {}", ASTFactory.ifStatement(ASTFactory.identifier2("c")
, ASTFactory.block([]))); | 1491 assertSource("if (c) {}", ASTFactory.ifStatement(ASTFactory.identifier2("c")
, ASTFactory.block([]))); |
| 813 } | 1492 } |
| 814 void test_visitImplementsClause_multiple() { | 1493 void test_visitImplementsClause_multiple() { |
| 815 assertSource("implements A, B", ASTFactory.implementsClause([ASTFactory.type
Name3("A", []), ASTFactory.typeName3("B", [])])); | 1494 assertSource("implements A, B", ASTFactory.implementsClause([ASTFactory.type
Name3("A", []), ASTFactory.typeName3("B", [])])); |
| 816 } | 1495 } |
| 817 void test_visitImplementsClause_single() { | 1496 void test_visitImplementsClause_single() { |
| 818 assertSource("implements A", ASTFactory.implementsClause([ASTFactory.typeNam
e3("A", [])])); | 1497 assertSource("implements A", ASTFactory.implementsClause([ASTFactory.typeNam
e3("A", [])])); |
| 819 } | 1498 } |
| 820 void test_visitImportDirective_combinator() { | 1499 void test_visitImportDirective_combinator() { |
| 821 assertSource("import 'a.dart' show A;", ASTFactory.importDirective2("a.dart"
, null, [ASTFactory.importShowCombinator([ASTFactory.identifier2("A")])])); | 1500 assertSource("import 'a.dart' show A;", ASTFactory.importDirective2("a.dart"
, null, [ASTFactory.showCombinator([ASTFactory.identifier2("A")])])); |
| 822 } | 1501 } |
| 823 void test_visitImportDirective_combinators() { | 1502 void test_visitImportDirective_combinators() { |
| 824 assertSource("import 'a.dart' show A hide B;", ASTFactory.importDirective2("
a.dart", null, [ASTFactory.importShowCombinator([ASTFactory.identifier2("A")]),
ASTFactory.importHideCombinator([ASTFactory.identifier2("B")])])); | 1503 assertSource("import 'a.dart' show A hide B;", ASTFactory.importDirective2("
a.dart", null, [ASTFactory.showCombinator([ASTFactory.identifier2("A")]), ASTFac
tory.hideCombinator([ASTFactory.identifier2("B")])])); |
| 825 } | 1504 } |
| 826 void test_visitImportDirective_minimal() { | 1505 void test_visitImportDirective_minimal() { |
| 827 assertSource("import 'a.dart';", ASTFactory.importDirective2("a.dart", null,
[])); | 1506 assertSource("import 'a.dart';", ASTFactory.importDirective2("a.dart", null,
[])); |
| 828 } | 1507 } |
| 829 void test_visitImportDirective_prefix() { | 1508 void test_visitImportDirective_prefix() { |
| 830 assertSource("import 'a.dart' as p;", ASTFactory.importDirective2("a.dart",
"p", [])); | 1509 assertSource("import 'a.dart' as p;", ASTFactory.importDirective2("a.dart",
"p", [])); |
| 831 } | 1510 } |
| 832 void test_visitImportDirective_prefix_combinator() { | 1511 void test_visitImportDirective_prefix_combinator() { |
| 833 assertSource("import 'a.dart' as p show A;", ASTFactory.importDirective2("a.
dart", "p", [ASTFactory.importShowCombinator([ASTFactory.identifier2("A")])])); | 1512 assertSource("import 'a.dart' as p show A;", ASTFactory.importDirective2("a.
dart", "p", [ASTFactory.showCombinator([ASTFactory.identifier2("A")])])); |
| 834 } | 1513 } |
| 835 void test_visitImportDirective_prefix_combinators() { | 1514 void test_visitImportDirective_prefix_combinators() { |
| 836 assertSource("import 'a.dart' as p show A hide B;", ASTFactory.importDirecti
ve2("a.dart", "p", [ASTFactory.importShowCombinator([ASTFactory.identifier2("A")
]), ASTFactory.importHideCombinator([ASTFactory.identifier2("B")])])); | 1515 assertSource("import 'a.dart' as p show A hide B;", ASTFactory.importDirecti
ve2("a.dart", "p", [ASTFactory.showCombinator([ASTFactory.identifier2("A")]), AS
TFactory.hideCombinator([ASTFactory.identifier2("B")])])); |
| 837 } | 1516 } |
| 838 void test_visitImportHideCombinator_multiple() { | 1517 void test_visitImportHideCombinator_multiple() { |
| 839 assertSource("hide a, b", ASTFactory.importHideCombinator([ASTFactory.identi
fier2("a"), ASTFactory.identifier2("b")])); | 1518 assertSource("hide a, b", ASTFactory.hideCombinator([ASTFactory.identifier2(
"a"), ASTFactory.identifier2("b")])); |
| 840 } | 1519 } |
| 841 void test_visitImportHideCombinator_single() { | 1520 void test_visitImportHideCombinator_single() { |
| 842 assertSource("hide a", ASTFactory.importHideCombinator([ASTFactory.identifie
r2("a")])); | 1521 assertSource("hide a", ASTFactory.hideCombinator([ASTFactory.identifier2("a"
)])); |
| 843 } | 1522 } |
| 844 void test_visitImportShowCombinator_multiple() { | 1523 void test_visitImportShowCombinator_multiple() { |
| 845 assertSource("show a, b", ASTFactory.importShowCombinator([ASTFactory.identi
fier2("a"), ASTFactory.identifier2("b")])); | 1524 assertSource("show a, b", ASTFactory.showCombinator([ASTFactory.identifier2(
"a"), ASTFactory.identifier2("b")])); |
| 846 } | 1525 } |
| 847 void test_visitImportShowCombinator_single() { | 1526 void test_visitImportShowCombinator_single() { |
| 848 assertSource("show a", ASTFactory.importShowCombinator([ASTFactory.identifie
r2("a")])); | 1527 assertSource("show a", ASTFactory.showCombinator([ASTFactory.identifier2("a"
)])); |
| 849 } | 1528 } |
| 850 void test_visitIndexExpression() { | 1529 void test_visitIndexExpression() { |
| 851 assertSource("a[i]", ASTFactory.indexExpression(ASTFactory.identifier2("a"),
ASTFactory.identifier2("i"))); | 1530 assertSource("a[i]", ASTFactory.indexExpression(ASTFactory.identifier2("a"),
ASTFactory.identifier2("i"))); |
| 852 } | 1531 } |
| 1532 void test_visitInstanceCreationExpression_const() { |
| 1533 assertSource("const C()", ASTFactory.instanceCreationExpression2(Keyword.CON
ST, ASTFactory.typeName3("C", []), [])); |
| 1534 } |
| 853 void test_visitInstanceCreationExpression_named() { | 1535 void test_visitInstanceCreationExpression_named() { |
| 854 assertSource("new C.c()", ASTFactory.instanceCreationExpression2(Keyword.NEW
, ASTFactory.typeName3("C", []), "c", [])); | 1536 assertSource("new C.c()", ASTFactory.instanceCreationExpression3(Keyword.NEW
, ASTFactory.typeName3("C", []), "c", [])); |
| 855 } | 1537 } |
| 856 void test_visitInstanceCreationExpression_unnamed() { | 1538 void test_visitInstanceCreationExpression_unnamed() { |
| 857 assertSource("new C()", ASTFactory.instanceCreationExpression(Keyword.NEW, A
STFactory.typeName3("C", []), [])); | 1539 assertSource("new C()", ASTFactory.instanceCreationExpression2(Keyword.NEW,
ASTFactory.typeName3("C", []), [])); |
| 858 } | 1540 } |
| 859 void test_visitIntegerLiteral() { | 1541 void test_visitIntegerLiteral() { |
| 860 assertSource("42", ASTFactory.integer(42)); | 1542 assertSource("42", ASTFactory.integer(42)); |
| 861 } | 1543 } |
| 862 void test_visitInterpolationExpression_expression() { | 1544 void test_visitInterpolationExpression_expression() { |
| 863 assertSource("\${a}", ASTFactory.interpolationExpression(ASTFactory.identifi
er2("a"))); | 1545 assertSource("\${a}", ASTFactory.interpolationExpression(ASTFactory.identifi
er2("a"))); |
| 864 } | 1546 } |
| 865 void test_visitInterpolationExpression_identifier() { | 1547 void test_visitInterpolationExpression_identifier() { |
| 866 assertSource("\$a", ASTFactory.interpolationExpression2("a")); | 1548 assertSource("\$a", ASTFactory.interpolationExpression2("a")); |
| 867 } | 1549 } |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 982 void test_visitPostfixExpression() { | 1664 void test_visitPostfixExpression() { |
| 983 assertSource("a++", ASTFactory.postfixExpression(ASTFactory.identifier2("a")
, TokenType.PLUS_PLUS)); | 1665 assertSource("a++", ASTFactory.postfixExpression(ASTFactory.identifier2("a")
, TokenType.PLUS_PLUS)); |
| 984 } | 1666 } |
| 985 void test_visitPrefixedIdentifier() { | 1667 void test_visitPrefixedIdentifier() { |
| 986 assertSource("a.b", ASTFactory.identifier4("a", "b")); | 1668 assertSource("a.b", ASTFactory.identifier4("a", "b")); |
| 987 } | 1669 } |
| 988 void test_visitPrefixExpression() { | 1670 void test_visitPrefixExpression() { |
| 989 assertSource("-a", ASTFactory.prefixExpression(TokenType.MINUS, ASTFactory.i
dentifier2("a"))); | 1671 assertSource("-a", ASTFactory.prefixExpression(TokenType.MINUS, ASTFactory.i
dentifier2("a"))); |
| 990 } | 1672 } |
| 991 void test_visitPropertyAccess() { | 1673 void test_visitPropertyAccess() { |
| 992 assertSource("a.b", ASTFactory.propertyAccess(ASTFactory.identifier2("a"), "
b")); | 1674 assertSource("a.b", ASTFactory.propertyAccess2(ASTFactory.identifier2("a"),
"b")); |
| 993 } | 1675 } |
| 994 void test_visitRedirectingConstructorInvocation_named() { | 1676 void test_visitRedirectingConstructorInvocation_named() { |
| 995 assertSource("this.c()", ASTFactory.redirectingConstructorInvocation2("c", [
])); | 1677 assertSource("this.c()", ASTFactory.redirectingConstructorInvocation2("c", [
])); |
| 996 } | 1678 } |
| 997 void test_visitRedirectingConstructorInvocation_unnamed() { | 1679 void test_visitRedirectingConstructorInvocation_unnamed() { |
| 998 assertSource("this()", ASTFactory.redirectingConstructorInvocation([])); | 1680 assertSource("this()", ASTFactory.redirectingConstructorInvocation([])); |
| 999 } | 1681 } |
| 1000 void test_visitReturnStatement_expression() { | 1682 void test_visitReturnStatement_expression() { |
| 1001 assertSource("return a;", ASTFactory.returnStatement2(ASTFactory.identifier2
("a"))); | 1683 assertSource("return a;", ASTFactory.returnStatement2(ASTFactory.identifier2
("a"))); |
| 1002 } | 1684 } |
| (...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1718 runJUnitTest(__test, __test.test_visitImportShowCombinator_multiple); | 2400 runJUnitTest(__test, __test.test_visitImportShowCombinator_multiple); |
| 1719 }); | 2401 }); |
| 1720 _ut.test('test_visitImportShowCombinator_single', () { | 2402 _ut.test('test_visitImportShowCombinator_single', () { |
| 1721 final __test = new ToSourceVisitorTest(); | 2403 final __test = new ToSourceVisitorTest(); |
| 1722 runJUnitTest(__test, __test.test_visitImportShowCombinator_single); | 2404 runJUnitTest(__test, __test.test_visitImportShowCombinator_single); |
| 1723 }); | 2405 }); |
| 1724 _ut.test('test_visitIndexExpression', () { | 2406 _ut.test('test_visitIndexExpression', () { |
| 1725 final __test = new ToSourceVisitorTest(); | 2407 final __test = new ToSourceVisitorTest(); |
| 1726 runJUnitTest(__test, __test.test_visitIndexExpression); | 2408 runJUnitTest(__test, __test.test_visitIndexExpression); |
| 1727 }); | 2409 }); |
| 2410 _ut.test('test_visitInstanceCreationExpression_const', () { |
| 2411 final __test = new ToSourceVisitorTest(); |
| 2412 runJUnitTest(__test, __test.test_visitInstanceCreationExpression_const); |
| 2413 }); |
| 1728 _ut.test('test_visitInstanceCreationExpression_named', () { | 2414 _ut.test('test_visitInstanceCreationExpression_named', () { |
| 1729 final __test = new ToSourceVisitorTest(); | 2415 final __test = new ToSourceVisitorTest(); |
| 1730 runJUnitTest(__test, __test.test_visitInstanceCreationExpression_named); | 2416 runJUnitTest(__test, __test.test_visitInstanceCreationExpression_named); |
| 1731 }); | 2417 }); |
| 1732 _ut.test('test_visitInstanceCreationExpression_unnamed', () { | 2418 _ut.test('test_visitInstanceCreationExpression_unnamed', () { |
| 1733 final __test = new ToSourceVisitorTest(); | 2419 final __test = new ToSourceVisitorTest(); |
| 1734 runJUnitTest(__test, __test.test_visitInstanceCreationExpression_unnamed
); | 2420 runJUnitTest(__test, __test.test_visitInstanceCreationExpression_unnamed
); |
| 1735 }); | 2421 }); |
| 1736 _ut.test('test_visitIntegerLiteral', () { | 2422 _ut.test('test_visitIntegerLiteral', () { |
| 1737 final __test = new ToSourceVisitorTest(); | 2423 final __test = new ToSourceVisitorTest(); |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2120 _ut.test('test_visitWithClause_multiple', () { | 2806 _ut.test('test_visitWithClause_multiple', () { |
| 2121 final __test = new ToSourceVisitorTest(); | 2807 final __test = new ToSourceVisitorTest(); |
| 2122 runJUnitTest(__test, __test.test_visitWithClause_multiple); | 2808 runJUnitTest(__test, __test.test_visitWithClause_multiple); |
| 2123 }); | 2809 }); |
| 2124 _ut.test('test_visitWithClause_single', () { | 2810 _ut.test('test_visitWithClause_single', () { |
| 2125 final __test = new ToSourceVisitorTest(); | 2811 final __test = new ToSourceVisitorTest(); |
| 2126 runJUnitTest(__test, __test.test_visitWithClause_single); | 2812 runJUnitTest(__test, __test.test_visitWithClause_single); |
| 2127 }); | 2813 }); |
| 2128 }); | 2814 }); |
| 2129 } | 2815 } |
| 2130 } | |
| 2131 class IndexExpressionTest extends EngineTestCase { | |
| 2132 void test_inGetterContext_assignment_compound_left() { | |
| 2133 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r2("a"), ASTFactory.identifier2("b")); | |
| 2134 ASTFactory.assignmentExpression(expression, TokenType.PLUS_EQ, null); | |
| 2135 JUnitTestCase.assertTrue(expression.inGetterContext()); | |
| 2136 } | |
| 2137 void test_inGetterContext_assignment_simple_left() { | |
| 2138 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r2("a"), ASTFactory.identifier2("b")); | |
| 2139 ASTFactory.assignmentExpression(expression, TokenType.EQ, null); | |
| 2140 JUnitTestCase.assertFalse(expression.inGetterContext()); | |
| 2141 } | |
| 2142 void test_inGetterContext_nonAssignment() { | |
| 2143 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r2("a"), ASTFactory.identifier2("b")); | |
| 2144 ASTFactory.binaryExpression(expression, TokenType.PLUS, null); | |
| 2145 JUnitTestCase.assertTrue(expression.inGetterContext()); | |
| 2146 } | |
| 2147 void test_inSetterContext_assignment_compound_left() { | |
| 2148 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r2("a"), ASTFactory.identifier2("b")); | |
| 2149 ASTFactory.assignmentExpression(expression, TokenType.PLUS_EQ, null); | |
| 2150 JUnitTestCase.assertTrue(expression.inSetterContext()); | |
| 2151 } | |
| 2152 void test_inSetterContext_assignment_compound_right() { | |
| 2153 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r2("a"), ASTFactory.identifier2("b")); | |
| 2154 ASTFactory.assignmentExpression(null, TokenType.PLUS_EQ, expression); | |
| 2155 JUnitTestCase.assertFalse(expression.inSetterContext()); | |
| 2156 } | |
| 2157 void test_inSetterContext_assignment_simple_left() { | |
| 2158 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r2("a"), ASTFactory.identifier2("b")); | |
| 2159 ASTFactory.assignmentExpression(expression, TokenType.EQ, null); | |
| 2160 JUnitTestCase.assertTrue(expression.inSetterContext()); | |
| 2161 } | |
| 2162 void test_inSetterContext_assignment_simple_right() { | |
| 2163 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r2("a"), ASTFactory.identifier2("b")); | |
| 2164 ASTFactory.assignmentExpression(null, TokenType.EQ, expression); | |
| 2165 JUnitTestCase.assertFalse(expression.inSetterContext()); | |
| 2166 } | |
| 2167 void test_inSetterContext_nonAssignment() { | |
| 2168 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r2("a"), ASTFactory.identifier2("b")); | |
| 2169 ASTFactory.binaryExpression(expression, TokenType.PLUS, null); | |
| 2170 JUnitTestCase.assertFalse(expression.inSetterContext()); | |
| 2171 } | |
| 2172 void test_inSetterContext_postfix() { | |
| 2173 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r2("a"), ASTFactory.identifier2("b")); | |
| 2174 ASTFactory.postfixExpression(expression, TokenType.PLUS_PLUS); | |
| 2175 JUnitTestCase.assertTrue(expression.inSetterContext()); | |
| 2176 } | |
| 2177 void test_inSetterContext_prefix_bang() { | |
| 2178 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r2("a"), ASTFactory.identifier2("b")); | |
| 2179 ASTFactory.prefixExpression(TokenType.BANG, expression); | |
| 2180 JUnitTestCase.assertFalse(expression.inSetterContext()); | |
| 2181 } | |
| 2182 void test_inSetterContext_prefix_minusMinus() { | |
| 2183 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r2("a"), ASTFactory.identifier2("b")); | |
| 2184 ASTFactory.prefixExpression(TokenType.MINUS_MINUS, expression); | |
| 2185 JUnitTestCase.assertTrue(expression.inSetterContext()); | |
| 2186 } | |
| 2187 void test_inSetterContext_prefix_plusPlus() { | |
| 2188 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r2("a"), ASTFactory.identifier2("b")); | |
| 2189 ASTFactory.prefixExpression(TokenType.PLUS_PLUS, expression); | |
| 2190 JUnitTestCase.assertTrue(expression.inSetterContext()); | |
| 2191 } | |
| 2192 static dartSuite() { | |
| 2193 _ut.group('IndexExpressionTest', () { | |
| 2194 _ut.test('test_inGetterContext_assignment_compound_left', () { | |
| 2195 final __test = new IndexExpressionTest(); | |
| 2196 runJUnitTest(__test, __test.test_inGetterContext_assignment_compound_lef
t); | |
| 2197 }); | |
| 2198 _ut.test('test_inGetterContext_assignment_simple_left', () { | |
| 2199 final __test = new IndexExpressionTest(); | |
| 2200 runJUnitTest(__test, __test.test_inGetterContext_assignment_simple_left)
; | |
| 2201 }); | |
| 2202 _ut.test('test_inGetterContext_nonAssignment', () { | |
| 2203 final __test = new IndexExpressionTest(); | |
| 2204 runJUnitTest(__test, __test.test_inGetterContext_nonAssignment); | |
| 2205 }); | |
| 2206 _ut.test('test_inSetterContext_assignment_compound_left', () { | |
| 2207 final __test = new IndexExpressionTest(); | |
| 2208 runJUnitTest(__test, __test.test_inSetterContext_assignment_compound_lef
t); | |
| 2209 }); | |
| 2210 _ut.test('test_inSetterContext_assignment_compound_right', () { | |
| 2211 final __test = new IndexExpressionTest(); | |
| 2212 runJUnitTest(__test, __test.test_inSetterContext_assignment_compound_rig
ht); | |
| 2213 }); | |
| 2214 _ut.test('test_inSetterContext_assignment_simple_left', () { | |
| 2215 final __test = new IndexExpressionTest(); | |
| 2216 runJUnitTest(__test, __test.test_inSetterContext_assignment_simple_left)
; | |
| 2217 }); | |
| 2218 _ut.test('test_inSetterContext_assignment_simple_right', () { | |
| 2219 final __test = new IndexExpressionTest(); | |
| 2220 runJUnitTest(__test, __test.test_inSetterContext_assignment_simple_right
); | |
| 2221 }); | |
| 2222 _ut.test('test_inSetterContext_nonAssignment', () { | |
| 2223 final __test = new IndexExpressionTest(); | |
| 2224 runJUnitTest(__test, __test.test_inSetterContext_nonAssignment); | |
| 2225 }); | |
| 2226 _ut.test('test_inSetterContext_postfix', () { | |
| 2227 final __test = new IndexExpressionTest(); | |
| 2228 runJUnitTest(__test, __test.test_inSetterContext_postfix); | |
| 2229 }); | |
| 2230 _ut.test('test_inSetterContext_prefix_bang', () { | |
| 2231 final __test = new IndexExpressionTest(); | |
| 2232 runJUnitTest(__test, __test.test_inSetterContext_prefix_bang); | |
| 2233 }); | |
| 2234 _ut.test('test_inSetterContext_prefix_minusMinus', () { | |
| 2235 final __test = new IndexExpressionTest(); | |
| 2236 runJUnitTest(__test, __test.test_inSetterContext_prefix_minusMinus); | |
| 2237 }); | |
| 2238 _ut.test('test_inSetterContext_prefix_plusPlus', () { | |
| 2239 final __test = new IndexExpressionTest(); | |
| 2240 runJUnitTest(__test, __test.test_inSetterContext_prefix_plusPlus); | |
| 2241 }); | |
| 2242 }); | |
| 2243 } | |
| 2244 } | |
| 2245 class ConstantEvaluatorTest extends ParserTestCase { | |
| 2246 void fail_constructor() { | |
| 2247 Object value = getConstantValue("?"); | |
| 2248 JUnitTestCase.assertEquals(null, value); | |
| 2249 } | |
| 2250 void fail_identifier_class() { | |
| 2251 Object value = getConstantValue("?"); | |
| 2252 JUnitTestCase.assertEquals(null, value); | |
| 2253 } | |
| 2254 void fail_identifier_function() { | |
| 2255 Object value = getConstantValue("?"); | |
| 2256 JUnitTestCase.assertEquals(null, value); | |
| 2257 } | |
| 2258 void fail_identifier_static() { | |
| 2259 Object value = getConstantValue("?"); | |
| 2260 JUnitTestCase.assertEquals(null, value); | |
| 2261 } | |
| 2262 void fail_identifier_staticMethod() { | |
| 2263 Object value = getConstantValue("?"); | |
| 2264 JUnitTestCase.assertEquals(null, value); | |
| 2265 } | |
| 2266 void fail_identifier_topLevel() { | |
| 2267 Object value = getConstantValue("?"); | |
| 2268 JUnitTestCase.assertEquals(null, value); | |
| 2269 } | |
| 2270 void fail_identifier_typeVariable() { | |
| 2271 Object value = getConstantValue("?"); | |
| 2272 JUnitTestCase.assertEquals(null, value); | |
| 2273 } | |
| 2274 void test_binary_bitAnd() { | |
| 2275 Object value = getConstantValue("74 & 42"); | |
| 2276 EngineTestCase.assertInstanceOf(int, value); | |
| 2277 JUnitTestCase.assertEquals(74 & 42, ((value as int))); | |
| 2278 } | |
| 2279 void test_binary_bitOr() { | |
| 2280 Object value = getConstantValue("74 | 42"); | |
| 2281 EngineTestCase.assertInstanceOf(int, value); | |
| 2282 JUnitTestCase.assertEquals(74 | 42, ((value as int))); | |
| 2283 } | |
| 2284 void test_binary_bitXor() { | |
| 2285 Object value = getConstantValue("74 ^ 42"); | |
| 2286 EngineTestCase.assertInstanceOf(int, value); | |
| 2287 JUnitTestCase.assertEquals(74 ^ 42, ((value as int))); | |
| 2288 } | |
| 2289 void test_binary_divide_double() { | |
| 2290 Object value = getConstantValue("3.2 / 2.3"); | |
| 2291 EngineTestCase.assertInstanceOf(double, value); | |
| 2292 JUnitTestCase.assertEquals(3.2 / 2.3, ((value as double))); | |
| 2293 } | |
| 2294 void test_binary_divide_integer() { | |
| 2295 Object value = getConstantValue("3 / 2"); | |
| 2296 EngineTestCase.assertInstanceOf(int, value); | |
| 2297 JUnitTestCase.assertEquals(1, ((value as int))); | |
| 2298 } | |
| 2299 void test_binary_equal_boolean() { | |
| 2300 Object value = getConstantValue("true == false"); | |
| 2301 JUnitTestCase.assertEquals(false, value); | |
| 2302 } | |
| 2303 void test_binary_equal_integer() { | |
| 2304 Object value = getConstantValue("2 == 3"); | |
| 2305 JUnitTestCase.assertEquals(false, value); | |
| 2306 } | |
| 2307 void test_binary_equal_invalidLeft() { | |
| 2308 Object value = getConstantValue("a == 3"); | |
| 2309 JUnitTestCase.assertEquals(ConstantEvaluator.NOT_A_CONSTANT, value); | |
| 2310 } | |
| 2311 void test_binary_equal_invalidRight() { | |
| 2312 Object value = getConstantValue("2 == a"); | |
| 2313 JUnitTestCase.assertEquals(ConstantEvaluator.NOT_A_CONSTANT, value); | |
| 2314 } | |
| 2315 void test_binary_equal_string() { | |
| 2316 Object value = getConstantValue("'a' == 'b'"); | |
| 2317 JUnitTestCase.assertEquals(false, value); | |
| 2318 } | |
| 2319 void test_binary_greaterThan() { | |
| 2320 Object value = getConstantValue("2 > 3"); | |
| 2321 JUnitTestCase.assertEquals(false, value); | |
| 2322 } | |
| 2323 void test_binary_greaterThanOrEqual() { | |
| 2324 Object value = getConstantValue("2 >= 3"); | |
| 2325 JUnitTestCase.assertEquals(false, value); | |
| 2326 } | |
| 2327 void test_binary_leftShift() { | |
| 2328 Object value = getConstantValue("16 << 2"); | |
| 2329 EngineTestCase.assertInstanceOf(int, value); | |
| 2330 JUnitTestCase.assertEquals(64, ((value as int))); | |
| 2331 } | |
| 2332 void test_binary_lessThan() { | |
| 2333 Object value = getConstantValue("2 < 3"); | |
| 2334 JUnitTestCase.assertEquals(true, value); | |
| 2335 } | |
| 2336 void test_binary_lessThanOrEqual() { | |
| 2337 Object value = getConstantValue("2 <= 3"); | |
| 2338 JUnitTestCase.assertEquals(true, value); | |
| 2339 } | |
| 2340 void test_binary_logicalAnd() { | |
| 2341 Object value = getConstantValue("true && false"); | |
| 2342 JUnitTestCase.assertEquals(false, value); | |
| 2343 } | |
| 2344 void test_binary_logicalOr() { | |
| 2345 Object value = getConstantValue("true || false"); | |
| 2346 JUnitTestCase.assertEquals(true, value); | |
| 2347 } | |
| 2348 void test_binary_minus_double() { | |
| 2349 Object value = getConstantValue("3.2 - 2.3"); | |
| 2350 EngineTestCase.assertInstanceOf(double, value); | |
| 2351 JUnitTestCase.assertEquals(3.2 - 2.3, ((value as double))); | |
| 2352 } | |
| 2353 void test_binary_minus_integer() { | |
| 2354 Object value = getConstantValue("3 - 2"); | |
| 2355 EngineTestCase.assertInstanceOf(int, value); | |
| 2356 JUnitTestCase.assertEquals(1, ((value as int))); | |
| 2357 } | |
| 2358 void test_binary_notEqual_boolean() { | |
| 2359 Object value = getConstantValue("true != false"); | |
| 2360 JUnitTestCase.assertEquals(true, value); | |
| 2361 } | |
| 2362 void test_binary_notEqual_integer() { | |
| 2363 Object value = getConstantValue("2 != 3"); | |
| 2364 JUnitTestCase.assertEquals(true, value); | |
| 2365 } | |
| 2366 void test_binary_notEqual_invalidLeft() { | |
| 2367 Object value = getConstantValue("a != 3"); | |
| 2368 JUnitTestCase.assertEquals(ConstantEvaluator.NOT_A_CONSTANT, value); | |
| 2369 } | |
| 2370 void test_binary_notEqual_invalidRight() { | |
| 2371 Object value = getConstantValue("2 != a"); | |
| 2372 JUnitTestCase.assertEquals(ConstantEvaluator.NOT_A_CONSTANT, value); | |
| 2373 } | |
| 2374 void test_binary_notEqual_string() { | |
| 2375 Object value = getConstantValue("'a' != 'b'"); | |
| 2376 JUnitTestCase.assertEquals(true, value); | |
| 2377 } | |
| 2378 void test_binary_plus_double() { | |
| 2379 Object value = getConstantValue("2.3 + 3.2"); | |
| 2380 EngineTestCase.assertInstanceOf(double, value); | |
| 2381 JUnitTestCase.assertEquals(2.3 + 3.2, ((value as double))); | |
| 2382 } | |
| 2383 void test_binary_plus_integer() { | |
| 2384 Object value = getConstantValue("2 + 3"); | |
| 2385 EngineTestCase.assertInstanceOf(int, value); | |
| 2386 JUnitTestCase.assertEquals(5, ((value as int))); | |
| 2387 } | |
| 2388 void test_binary_remainder_double() { | |
| 2389 Object value = getConstantValue("3.2 % 2.3"); | |
| 2390 EngineTestCase.assertInstanceOf(double, value); | |
| 2391 JUnitTestCase.assertEquals(3.2 % 2.3, ((value as double))); | |
| 2392 } | |
| 2393 void test_binary_remainder_integer() { | |
| 2394 Object value = getConstantValue("8 % 3"); | |
| 2395 EngineTestCase.assertInstanceOf(int, value); | |
| 2396 JUnitTestCase.assertEquals(2, ((value as int))); | |
| 2397 } | |
| 2398 void test_binary_rightShift() { | |
| 2399 Object value = getConstantValue("64 >> 2"); | |
| 2400 EngineTestCase.assertInstanceOf(int, value); | |
| 2401 JUnitTestCase.assertEquals(16, ((value as int))); | |
| 2402 } | |
| 2403 void test_binary_times_double() { | |
| 2404 Object value = getConstantValue("2.3 * 3.2"); | |
| 2405 EngineTestCase.assertInstanceOf(double, value); | |
| 2406 JUnitTestCase.assertEquals(2.3 * 3.2, ((value as double))); | |
| 2407 } | |
| 2408 void test_binary_times_integer() { | |
| 2409 Object value = getConstantValue("2 * 3"); | |
| 2410 EngineTestCase.assertInstanceOf(int, value); | |
| 2411 JUnitTestCase.assertEquals(6, ((value as int))); | |
| 2412 } | |
| 2413 void test_binary_truncatingDivide_double() { | |
| 2414 Object value = getConstantValue("3.2 ~/ 2.3"); | |
| 2415 EngineTestCase.assertInstanceOf(int, value); | |
| 2416 JUnitTestCase.assertEquals(1, ((value as int))); | |
| 2417 } | |
| 2418 void test_binary_truncatingDivide_integer() { | |
| 2419 Object value = getConstantValue("10 ~/ 3"); | |
| 2420 EngineTestCase.assertInstanceOf(int, value); | |
| 2421 JUnitTestCase.assertEquals(3, ((value as int))); | |
| 2422 } | |
| 2423 void test_literal_boolean_false() { | |
| 2424 Object value = getConstantValue("false"); | |
| 2425 JUnitTestCase.assertEquals(false, value); | |
| 2426 } | |
| 2427 void test_literal_boolean_true() { | |
| 2428 Object value = getConstantValue("true"); | |
| 2429 JUnitTestCase.assertEquals(true, value); | |
| 2430 } | |
| 2431 void test_literal_list() { | |
| 2432 Object value = getConstantValue("['a', 'b', 'c']"); | |
| 2433 EngineTestCase.assertInstanceOf(List, value); | |
| 2434 List<Object> list = (value as List<Object>); | |
| 2435 JUnitTestCase.assertEquals(3, list.length); | |
| 2436 JUnitTestCase.assertEquals("a", list[0]); | |
| 2437 JUnitTestCase.assertEquals("b", list[1]); | |
| 2438 JUnitTestCase.assertEquals("c", list[2]); | |
| 2439 } | |
| 2440 void test_literal_map() { | |
| 2441 Object value = getConstantValue("{'a' : 'm', 'b' : 'n', 'c' : 'o'}"); | |
| 2442 EngineTestCase.assertInstanceOf(Map, value); | |
| 2443 Map<Object, Object> map = (value as Map<Object, Object>); | |
| 2444 JUnitTestCase.assertEquals(3, map.length); | |
| 2445 JUnitTestCase.assertEquals("m", map["a"]); | |
| 2446 JUnitTestCase.assertEquals("n", map["b"]); | |
| 2447 JUnitTestCase.assertEquals("o", map["c"]); | |
| 2448 } | |
| 2449 void test_literal_null() { | |
| 2450 Object value = getConstantValue("null"); | |
| 2451 JUnitTestCase.assertEquals(null, value); | |
| 2452 } | |
| 2453 void test_literal_number_double() { | |
| 2454 Object value = getConstantValue("3.45"); | |
| 2455 EngineTestCase.assertInstanceOf(double, value); | |
| 2456 JUnitTestCase.assertEquals(3.45, ((value as double))); | |
| 2457 } | |
| 2458 void test_literal_number_integer() { | |
| 2459 Object value = getConstantValue("42"); | |
| 2460 EngineTestCase.assertInstanceOf(int, value); | |
| 2461 JUnitTestCase.assertEquals(42, ((value as int))); | |
| 2462 } | |
| 2463 void test_literal_string_adjacent() { | |
| 2464 Object value = getConstantValue("'abc' 'def'"); | |
| 2465 JUnitTestCase.assertEquals("abcdef", value); | |
| 2466 } | |
| 2467 void test_literal_string_interpolation_invalid() { | |
| 2468 Object value = getConstantValue("'a\${f()}c'"); | |
| 2469 JUnitTestCase.assertEquals(ConstantEvaluator.NOT_A_CONSTANT, value); | |
| 2470 } | |
| 2471 void test_literal_string_interpolation_valid() { | |
| 2472 Object value = getConstantValue("'a\${3}c'"); | |
| 2473 JUnitTestCase.assertEquals("a3c", value); | |
| 2474 } | |
| 2475 void test_literal_string_simple() { | |
| 2476 Object value = getConstantValue("'abc'"); | |
| 2477 JUnitTestCase.assertEquals("abc", value); | |
| 2478 } | |
| 2479 void test_parenthesizedExpression() { | |
| 2480 Object value = getConstantValue("('a')"); | |
| 2481 JUnitTestCase.assertEquals("a", value); | |
| 2482 } | |
| 2483 void test_unary_bitNot() { | |
| 2484 Object value = getConstantValue("~42"); | |
| 2485 EngineTestCase.assertInstanceOf(int, value); | |
| 2486 JUnitTestCase.assertEquals(~42, ((value as int))); | |
| 2487 } | |
| 2488 void test_unary_logicalNot() { | |
| 2489 Object value = getConstantValue("!true"); | |
| 2490 JUnitTestCase.assertEquals(false, value); | |
| 2491 } | |
| 2492 void test_unary_negated_double() { | |
| 2493 Object value = getConstantValue("-42.3"); | |
| 2494 EngineTestCase.assertInstanceOf(double, value); | |
| 2495 JUnitTestCase.assertEquals(-42.3, ((value as double))); | |
| 2496 } | |
| 2497 void test_unary_negated_integer() { | |
| 2498 Object value = getConstantValue("-42"); | |
| 2499 EngineTestCase.assertInstanceOf(int, value); | |
| 2500 JUnitTestCase.assertEquals(-42, ((value as int))); | |
| 2501 } | |
| 2502 Object getConstantValue(String source) => ParserTestCase.parseExpression(sourc
e, []).accept(new ConstantEvaluator()); | |
| 2503 static dartSuite() { | |
| 2504 _ut.group('ConstantEvaluatorTest', () { | |
| 2505 _ut.test('test_binary_bitAnd', () { | |
| 2506 final __test = new ConstantEvaluatorTest(); | |
| 2507 runJUnitTest(__test, __test.test_binary_bitAnd); | |
| 2508 }); | |
| 2509 _ut.test('test_binary_bitOr', () { | |
| 2510 final __test = new ConstantEvaluatorTest(); | |
| 2511 runJUnitTest(__test, __test.test_binary_bitOr); | |
| 2512 }); | |
| 2513 _ut.test('test_binary_bitXor', () { | |
| 2514 final __test = new ConstantEvaluatorTest(); | |
| 2515 runJUnitTest(__test, __test.test_binary_bitXor); | |
| 2516 }); | |
| 2517 _ut.test('test_binary_divide_double', () { | |
| 2518 final __test = new ConstantEvaluatorTest(); | |
| 2519 runJUnitTest(__test, __test.test_binary_divide_double); | |
| 2520 }); | |
| 2521 _ut.test('test_binary_divide_integer', () { | |
| 2522 final __test = new ConstantEvaluatorTest(); | |
| 2523 runJUnitTest(__test, __test.test_binary_divide_integer); | |
| 2524 }); | |
| 2525 _ut.test('test_binary_equal_boolean', () { | |
| 2526 final __test = new ConstantEvaluatorTest(); | |
| 2527 runJUnitTest(__test, __test.test_binary_equal_boolean); | |
| 2528 }); | |
| 2529 _ut.test('test_binary_equal_integer', () { | |
| 2530 final __test = new ConstantEvaluatorTest(); | |
| 2531 runJUnitTest(__test, __test.test_binary_equal_integer); | |
| 2532 }); | |
| 2533 _ut.test('test_binary_equal_invalidLeft', () { | |
| 2534 final __test = new ConstantEvaluatorTest(); | |
| 2535 runJUnitTest(__test, __test.test_binary_equal_invalidLeft); | |
| 2536 }); | |
| 2537 _ut.test('test_binary_equal_invalidRight', () { | |
| 2538 final __test = new ConstantEvaluatorTest(); | |
| 2539 runJUnitTest(__test, __test.test_binary_equal_invalidRight); | |
| 2540 }); | |
| 2541 _ut.test('test_binary_equal_string', () { | |
| 2542 final __test = new ConstantEvaluatorTest(); | |
| 2543 runJUnitTest(__test, __test.test_binary_equal_string); | |
| 2544 }); | |
| 2545 _ut.test('test_binary_greaterThan', () { | |
| 2546 final __test = new ConstantEvaluatorTest(); | |
| 2547 runJUnitTest(__test, __test.test_binary_greaterThan); | |
| 2548 }); | |
| 2549 _ut.test('test_binary_greaterThanOrEqual', () { | |
| 2550 final __test = new ConstantEvaluatorTest(); | |
| 2551 runJUnitTest(__test, __test.test_binary_greaterThanOrEqual); | |
| 2552 }); | |
| 2553 _ut.test('test_binary_leftShift', () { | |
| 2554 final __test = new ConstantEvaluatorTest(); | |
| 2555 runJUnitTest(__test, __test.test_binary_leftShift); | |
| 2556 }); | |
| 2557 _ut.test('test_binary_lessThan', () { | |
| 2558 final __test = new ConstantEvaluatorTest(); | |
| 2559 runJUnitTest(__test, __test.test_binary_lessThan); | |
| 2560 }); | |
| 2561 _ut.test('test_binary_lessThanOrEqual', () { | |
| 2562 final __test = new ConstantEvaluatorTest(); | |
| 2563 runJUnitTest(__test, __test.test_binary_lessThanOrEqual); | |
| 2564 }); | |
| 2565 _ut.test('test_binary_logicalAnd', () { | |
| 2566 final __test = new ConstantEvaluatorTest(); | |
| 2567 runJUnitTest(__test, __test.test_binary_logicalAnd); | |
| 2568 }); | |
| 2569 _ut.test('test_binary_logicalOr', () { | |
| 2570 final __test = new ConstantEvaluatorTest(); | |
| 2571 runJUnitTest(__test, __test.test_binary_logicalOr); | |
| 2572 }); | |
| 2573 _ut.test('test_binary_minus_double', () { | |
| 2574 final __test = new ConstantEvaluatorTest(); | |
| 2575 runJUnitTest(__test, __test.test_binary_minus_double); | |
| 2576 }); | |
| 2577 _ut.test('test_binary_minus_integer', () { | |
| 2578 final __test = new ConstantEvaluatorTest(); | |
| 2579 runJUnitTest(__test, __test.test_binary_minus_integer); | |
| 2580 }); | |
| 2581 _ut.test('test_binary_notEqual_boolean', () { | |
| 2582 final __test = new ConstantEvaluatorTest(); | |
| 2583 runJUnitTest(__test, __test.test_binary_notEqual_boolean); | |
| 2584 }); | |
| 2585 _ut.test('test_binary_notEqual_integer', () { | |
| 2586 final __test = new ConstantEvaluatorTest(); | |
| 2587 runJUnitTest(__test, __test.test_binary_notEqual_integer); | |
| 2588 }); | |
| 2589 _ut.test('test_binary_notEqual_invalidLeft', () { | |
| 2590 final __test = new ConstantEvaluatorTest(); | |
| 2591 runJUnitTest(__test, __test.test_binary_notEqual_invalidLeft); | |
| 2592 }); | |
| 2593 _ut.test('test_binary_notEqual_invalidRight', () { | |
| 2594 final __test = new ConstantEvaluatorTest(); | |
| 2595 runJUnitTest(__test, __test.test_binary_notEqual_invalidRight); | |
| 2596 }); | |
| 2597 _ut.test('test_binary_notEqual_string', () { | |
| 2598 final __test = new ConstantEvaluatorTest(); | |
| 2599 runJUnitTest(__test, __test.test_binary_notEqual_string); | |
| 2600 }); | |
| 2601 _ut.test('test_binary_plus_double', () { | |
| 2602 final __test = new ConstantEvaluatorTest(); | |
| 2603 runJUnitTest(__test, __test.test_binary_plus_double); | |
| 2604 }); | |
| 2605 _ut.test('test_binary_plus_integer', () { | |
| 2606 final __test = new ConstantEvaluatorTest(); | |
| 2607 runJUnitTest(__test, __test.test_binary_plus_integer); | |
| 2608 }); | |
| 2609 _ut.test('test_binary_remainder_double', () { | |
| 2610 final __test = new ConstantEvaluatorTest(); | |
| 2611 runJUnitTest(__test, __test.test_binary_remainder_double); | |
| 2612 }); | |
| 2613 _ut.test('test_binary_remainder_integer', () { | |
| 2614 final __test = new ConstantEvaluatorTest(); | |
| 2615 runJUnitTest(__test, __test.test_binary_remainder_integer); | |
| 2616 }); | |
| 2617 _ut.test('test_binary_rightShift', () { | |
| 2618 final __test = new ConstantEvaluatorTest(); | |
| 2619 runJUnitTest(__test, __test.test_binary_rightShift); | |
| 2620 }); | |
| 2621 _ut.test('test_binary_times_double', () { | |
| 2622 final __test = new ConstantEvaluatorTest(); | |
| 2623 runJUnitTest(__test, __test.test_binary_times_double); | |
| 2624 }); | |
| 2625 _ut.test('test_binary_times_integer', () { | |
| 2626 final __test = new ConstantEvaluatorTest(); | |
| 2627 runJUnitTest(__test, __test.test_binary_times_integer); | |
| 2628 }); | |
| 2629 _ut.test('test_binary_truncatingDivide_double', () { | |
| 2630 final __test = new ConstantEvaluatorTest(); | |
| 2631 runJUnitTest(__test, __test.test_binary_truncatingDivide_double); | |
| 2632 }); | |
| 2633 _ut.test('test_binary_truncatingDivide_integer', () { | |
| 2634 final __test = new ConstantEvaluatorTest(); | |
| 2635 runJUnitTest(__test, __test.test_binary_truncatingDivide_integer); | |
| 2636 }); | |
| 2637 _ut.test('test_literal_boolean_false', () { | |
| 2638 final __test = new ConstantEvaluatorTest(); | |
| 2639 runJUnitTest(__test, __test.test_literal_boolean_false); | |
| 2640 }); | |
| 2641 _ut.test('test_literal_boolean_true', () { | |
| 2642 final __test = new ConstantEvaluatorTest(); | |
| 2643 runJUnitTest(__test, __test.test_literal_boolean_true); | |
| 2644 }); | |
| 2645 _ut.test('test_literal_list', () { | |
| 2646 final __test = new ConstantEvaluatorTest(); | |
| 2647 runJUnitTest(__test, __test.test_literal_list); | |
| 2648 }); | |
| 2649 _ut.test('test_literal_map', () { | |
| 2650 final __test = new ConstantEvaluatorTest(); | |
| 2651 runJUnitTest(__test, __test.test_literal_map); | |
| 2652 }); | |
| 2653 _ut.test('test_literal_null', () { | |
| 2654 final __test = new ConstantEvaluatorTest(); | |
| 2655 runJUnitTest(__test, __test.test_literal_null); | |
| 2656 }); | |
| 2657 _ut.test('test_literal_number_double', () { | |
| 2658 final __test = new ConstantEvaluatorTest(); | |
| 2659 runJUnitTest(__test, __test.test_literal_number_double); | |
| 2660 }); | |
| 2661 _ut.test('test_literal_number_integer', () { | |
| 2662 final __test = new ConstantEvaluatorTest(); | |
| 2663 runJUnitTest(__test, __test.test_literal_number_integer); | |
| 2664 }); | |
| 2665 _ut.test('test_literal_string_adjacent', () { | |
| 2666 final __test = new ConstantEvaluatorTest(); | |
| 2667 runJUnitTest(__test, __test.test_literal_string_adjacent); | |
| 2668 }); | |
| 2669 _ut.test('test_literal_string_interpolation_invalid', () { | |
| 2670 final __test = new ConstantEvaluatorTest(); | |
| 2671 runJUnitTest(__test, __test.test_literal_string_interpolation_invalid); | |
| 2672 }); | |
| 2673 _ut.test('test_literal_string_interpolation_valid', () { | |
| 2674 final __test = new ConstantEvaluatorTest(); | |
| 2675 runJUnitTest(__test, __test.test_literal_string_interpolation_valid); | |
| 2676 }); | |
| 2677 _ut.test('test_literal_string_simple', () { | |
| 2678 final __test = new ConstantEvaluatorTest(); | |
| 2679 runJUnitTest(__test, __test.test_literal_string_simple); | |
| 2680 }); | |
| 2681 _ut.test('test_parenthesizedExpression', () { | |
| 2682 final __test = new ConstantEvaluatorTest(); | |
| 2683 runJUnitTest(__test, __test.test_parenthesizedExpression); | |
| 2684 }); | |
| 2685 _ut.test('test_unary_bitNot', () { | |
| 2686 final __test = new ConstantEvaluatorTest(); | |
| 2687 runJUnitTest(__test, __test.test_unary_bitNot); | |
| 2688 }); | |
| 2689 _ut.test('test_unary_logicalNot', () { | |
| 2690 final __test = new ConstantEvaluatorTest(); | |
| 2691 runJUnitTest(__test, __test.test_unary_logicalNot); | |
| 2692 }); | |
| 2693 _ut.test('test_unary_negated_double', () { | |
| 2694 final __test = new ConstantEvaluatorTest(); | |
| 2695 runJUnitTest(__test, __test.test_unary_negated_double); | |
| 2696 }); | |
| 2697 _ut.test('test_unary_negated_integer', () { | |
| 2698 final __test = new ConstantEvaluatorTest(); | |
| 2699 runJUnitTest(__test, __test.test_unary_negated_integer); | |
| 2700 }); | |
| 2701 }); | |
| 2702 } | |
| 2703 } | 2816 } |
| 2704 main() { | 2817 main() { |
| 2705 ConstantEvaluatorTest.dartSuite(); | 2818 ConstantEvaluatorTest.dartSuite(); |
| 2706 NodeLocatorTest.dartSuite(); | 2819 NodeLocatorTest.dartSuite(); |
| 2707 ToSourceVisitorTest.dartSuite(); | 2820 ToSourceVisitorTest.dartSuite(); |
| 2708 IndexExpressionTest.dartSuite(); | 2821 IndexExpressionTest.dartSuite(); |
| 2709 SimpleIdentifierTest.dartSuite(); | 2822 SimpleIdentifierTest.dartSuite(); |
| 2710 } | 2823 } |
| OLD | NEW |