Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(198)

Side by Side Diff: tests/compiler/dart2js/parser_test.dart

Issue 10836034: Properly parse operator declarations without return type. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « lib/compiler/implementation/tree/unparser.dart ('k') | tests/language/language.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 node = parseStatement("a.b++;"); 247 node = parseStatement("a.b++;");
248 // Should parse as: (a.b)++. 248 // Should parse as: (a.b)++.
249 expression = node.expression; 249 expression = node.expression;
250 Expect.isNotNull(sendSet = expression.asSendSet()); 250 Expect.isNotNull(sendSet = expression.asSendSet());
251 Expect.stringEquals("a", sendSet.receiver.toString()); 251 Expect.stringEquals("a", sendSet.receiver.toString());
252 Expect.stringEquals("b", sendSet.selector.toString()); 252 Expect.stringEquals("b", sendSet.selector.toString());
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() {
258 FunctionDeclaration node = parseStatement('operator negate() => null;');
259 FunctionExpression function = node.function;
260 Send name = function.name.asSend();
261 Expect.isNotNull(name);
262 Expect.stringEquals('operator', name.receiver.source.stringValue);
263 Expect.stringEquals('negate', name.selector.source.stringValue);
264 Expect.isTrue(function.parameters.isEmpty());
265 Expect.isNull(function.returnType);
266 Expect.isNull(function.getOrSet);
267 }
268
257 void main() { 269 void main() {
258 testGenericTypes(); 270 testGenericTypes();
259 // TODO(ahe): Enable this test when we handle library prefixes. 271 // TODO(ahe): Enable this test when we handle library prefixes.
260 // testPrefixedGenericTypes(); 272 // testPrefixedGenericTypes();
261 testUnaryExpression(); 273 testUnaryExpression();
262 testChainedMethodCalls(); 274 testChainedMethodCalls();
263 testFunctionStatement(); 275 testFunctionStatement();
264 testDoStatement(); 276 testDoStatement();
265 testWhileStatement(); 277 testWhileStatement();
266 testConditionalExpression(); 278 testConditionalExpression();
267 testAssignment(); 279 testAssignment();
268 testIndex(); 280 testIndex();
269 testPostfix(); 281 testPostfix();
282 testOperatorParse();
270 } 283 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/tree/unparser.dart ('k') | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698