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 "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
6 import 'parser_helper.dart'; | 6 import 'parser_helper.dart'; |
7 import '../../../sdk/lib/_internal/compiler/implementation/tree/tree.dart'; | 7 import '../../../sdk/lib/_internal/compiler/implementation/tree/tree.dart'; |
8 | 8 |
9 void testStatement(String statement) { | 9 void testStatement(String statement) { |
10 Node node = parseStatement(statement); | 10 Node node = parseStatement(statement); |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 Expect.stringEquals("a", sendSet.receiver.toString()); | 252 Expect.stringEquals("a", sendSet.receiver.toString()); |
253 Expect.stringEquals("b", sendSet.selector.toString()); | 253 Expect.stringEquals("b", sendSet.selector.toString()); |
254 Expect.stringEquals("++", sendSet.assignmentOperator.toString()); | 254 Expect.stringEquals("++", sendSet.assignmentOperator.toString()); |
255 Expect.isTrue(sendSet.arguments.isEmpty); | 255 Expect.isTrue(sendSet.arguments.isEmpty); |
256 } | 256 } |
257 | 257 |
258 void testOperatorParse() { | 258 void testOperatorParse() { |
259 FunctionExpression function = parseMember('operator -() => null;'); | 259 FunctionExpression function = parseMember('operator -() => null;'); |
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); |
263 Expect.stringEquals('-', name.selector.source.stringValue); | 263 Expect.stringEquals('-', name.selector.source); |
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 class Collector implements DiagnosticListener { | 269 class Collector implements DiagnosticListener { |
270 int token = -1; | 270 int token = -1; |
271 | 271 |
272 void cancel(String reason, {node, token, instruction, element}) { | 272 void cancel(String reason, {node, token, instruction, element}) { |
273 this.token = token.kind; | 273 this.token = token.kind; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 testWhileStatement(); | 329 testWhileStatement(); |
330 testConditionalExpression(); | 330 testConditionalExpression(); |
331 testAssignment(); | 331 testAssignment(); |
332 testIndex(); | 332 testIndex(); |
333 testPostfix(); | 333 testPostfix(); |
334 testOperatorParse(); | 334 testOperatorParse(); |
335 testMissingCloseParen(); | 335 testMissingCloseParen(); |
336 testMissingCloseBraceInClass(); | 336 testMissingCloseBraceInClass(); |
337 testUnmatchedAngleBracket(); | 337 testUnmatchedAngleBracket(); |
338 } | 338 } |
OLD | NEW |