OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #import('parser_helper.dart'); | 5 #import('parser_helper.dart'); |
6 #import("../../../lib/compiler/implementation/tree/tree.dart"); | 6 #import("../../../lib/compiler/implementation/tree/tree.dart"); |
7 | 7 |
8 void testStatement(String statement) { | 8 void testStatement(String statement) { |
9 Node node = parseStatement(statement); | 9 Node node = parseStatement(statement); |
10 Expect.isNotNull(node.toString()); | 10 Expect.isNotNull(node.toString()); |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 Expect.stringEquals("++", sendSet.assignmentOperator.toString()); | 253 Expect.stringEquals("++", sendSet.assignmentOperator.toString()); |
254 Expect.isTrue(sendSet.arguments.isEmpty()); | 254 Expect.isTrue(sendSet.arguments.isEmpty()); |
255 } | 255 } |
256 | 256 |
257 void testOperatorParse() { | 257 void testOperatorParse() { |
258 FunctionDeclaration node = parseStatement('operator negate() => null;'); | 258 FunctionDeclaration node = parseStatement('operator negate() => null;'); |
259 FunctionExpression function = node.function; | 259 FunctionExpression function = node.function; |
260 Send name = function.name.asSend(); | 260 Send name = function.name.asSend(); |
261 Expect.isNotNull(name); | 261 Expect.isNotNull(name); |
262 Expect.stringEquals('operator', name.receiver.source.stringValue); | 262 Expect.stringEquals('operator', name.receiver.source.stringValue); |
263 Expect.equals(buildSourceString('negate'), name.selector.source); | 263 Expect.stringEquals('negate', name.selector.source.stringValue); |
264 Expect.isTrue(function.parameters.isEmpty()); | 264 Expect.isTrue(function.parameters.isEmpty()); |
265 Expect.isNull(function.returnType); | 265 Expect.isNull(function.returnType); |
266 Expect.isNull(function.getOrSet); | 266 Expect.isNull(function.getOrSet); |
267 } | 267 } |
268 | 268 |
269 void main() { | 269 void main() { |
270 testGenericTypes(); | 270 testGenericTypes(); |
271 // TODO(ahe): Enable this test when we handle library prefixes. | 271 // TODO(ahe): Enable this test when we handle library prefixes. |
272 // testPrefixedGenericTypes(); | 272 // testPrefixedGenericTypes(); |
273 testUnaryExpression(); | 273 testUnaryExpression(); |
274 testChainedMethodCalls(); | 274 testChainedMethodCalls(); |
275 testFunctionStatement(); | 275 testFunctionStatement(); |
276 testDoStatement(); | 276 testDoStatement(); |
277 testWhileStatement(); | 277 testWhileStatement(); |
278 testConditionalExpression(); | 278 testConditionalExpression(); |
279 testAssignment(); | 279 testAssignment(); |
280 testIndex(); | 280 testIndex(); |
281 testPostfix(); | 281 testPostfix(); |
282 testOperatorParse(); | 282 testOperatorParse(); |
283 } | 283 } |
OLD | NEW |