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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/tree_validator.dart

Issue 12440035: Support optional function expression parameters in dart2js... and dart2dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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
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 part of dart2js; 5 part of dart2js;
6 6
7 class TreeValidatorTask extends CompilerTask { 7 class TreeValidatorTask extends CompilerTask {
8 TreeValidatorTask(Compiler compiler) : super(compiler); 8 TreeValidatorTask(Compiler compiler) : super(compiler);
9 9
10 void validate(Node tree) { 10 void validate(Node tree) {
(...skipping 24 matching lines...) Expand all
35 } 35 }
36 36
37 visitNode(Node node) {} 37 visitNode(Node node) {}
38 38
39 visitSendSet(SendSet node) { 39 visitSendSet(SendSet node) {
40 final selector = node.selector; 40 final selector = node.selector;
41 final name = node.assignmentOperator.source.stringValue; 41 final name = node.assignmentOperator.source.stringValue;
42 final arguments = node.arguments; 42 final arguments = node.arguments;
43 43
44 expect(node, arguments != null); 44 expect(node, arguments != null);
45 expect(node, selector is Identifier, 'selector is not assignable'); 45 expect(node,
46 selector is Identifier || selector is FunctionExpression,
47 'selector is not assignable');
46 if (identical(name, '++') || identical(name, '--')) { 48 if (identical(name, '++') || identical(name, '--')) {
47 expect(node, node.assignmentOperator is Operator); 49 expect(node, node.assignmentOperator is Operator);
48 if (node.isIndex) { 50 if (node.isIndex) {
49 expect(node.arguments.tail.head, node.arguments.tail.isEmpty); 51 expect(node.arguments.tail.head, node.arguments.tail.isEmpty);
50 } else { 52 } else {
51 expect(node.arguments.head, node.arguments.isEmpty); 53 expect(node.arguments.head, node.arguments.isEmpty);
52 } 54 }
53 } else { 55 } else {
54 expect(node, !node.arguments.isEmpty); 56 expect(node, !node.arguments.isEmpty);
55 } 57 }
(...skipping 13 matching lines...) Expand all
69 final String message; 71 final String message;
70 InvalidNodeError(this.node, [this.message]); 72 InvalidNodeError(this.node, [this.message]);
71 73
72 toString() { 74 toString() {
73 String nodeString = node.toDebugString(); 75 String nodeString = node.toDebugString();
74 String result = 'invalid node: $nodeString'; 76 String result = 'invalid node: $nodeString';
75 if (message != null) result = '$result ($message)'; 77 if (message != null) result = '$result ($message)';
76 return result; 78 return result;
77 } 79 }
78 } 80 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/resolution/members.dart ('k') | tests/co19/co19-dart2dart.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698