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

Side by Side Diff: dart/frog/leg/tree_validator.dart

Issue 9241016: Fix two crashes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Update leg_only status Created 8 years, 11 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 | « dart/frog/leg/ssa/builder.dart ('k') | dart/frog/tests/leg_only/leg_only.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 class TreeValidatorTask extends CompilerTask { 5 class TreeValidatorTask extends CompilerTask {
6 TreeValidatorTask(Compiler compiler) : super(compiler); 6 TreeValidatorTask(Compiler compiler) : super(compiler);
7 7
8 void validate(Node tree) { 8 void validate(Node tree) {
9 assert(check(tree)); 9 assert(check(tree));
10 } 10 }
(...skipping 25 matching lines...) Expand all
36 36
37 visitSendSet(SendSet node) { 37 visitSendSet(SendSet node) {
38 final selector = node.selector; 38 final selector = node.selector;
39 final name = node.assignmentOperator.source.stringValue; 39 final name = node.assignmentOperator.source.stringValue;
40 final arguments = node.arguments; 40 final arguments = node.arguments;
41 41
42 expect(node, arguments !== null); 42 expect(node, arguments !== null);
43 expect(node, selector is Identifier, 'selector is not assignable'); 43 expect(node, selector is Identifier, 'selector is not assignable');
44 if (name === '++' || name === '--') { 44 if (name === '++' || name === '--') {
45 expect(node, node.assignmentOperator is Operator); 45 expect(node, node.assignmentOperator is Operator);
46 expect(node, node.arguments.isEmpty()); 46 if (node.isIndex) {
47 expect(node.arguments.tail.head, node.arguments.tail.isEmpty());
48 } else {
49 expect(node.arguments.head, node.arguments.isEmpty());
50 }
47 } else { 51 } else {
48 expect(node, !node.arguments.isEmpty()); 52 expect(node, !node.arguments.isEmpty());
49 } 53 }
50 } 54 }
51 } 55 }
52 56
53 class InvalidNodeError { 57 class InvalidNodeError {
54 final Node node; 58 final Node node;
55 final String message; 59 final String message;
56 InvalidNodeError(this.node, [this.message]); 60 InvalidNodeError(this.node, [this.message]);
57 61
58 toString() { 62 toString() {
59 String nodeString = new Unparser(true).unparse(node); 63 String nodeString = new Unparser(true).unparse(node);
60 String result = 'invalid node: $nodeString'; 64 String result = 'invalid node: $nodeString';
61 if (message !== null) result = '$result ($message)'; 65 if (message !== null) result = '$result ($message)';
62 return result; 66 return result;
63 } 67 }
64 } 68 }
OLDNEW
« no previous file with comments | « dart/frog/leg/ssa/builder.dart ('k') | dart/frog/tests/leg_only/leg_only.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698