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

Side by Side Diff: tests/compiler/dart2js/backend_dart/dart_printer_test.dart

Issue 1325843003: Add optional message to assert in Dart2js. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Address comments Created 5 years, 3 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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library dart_printer_test; 5 library dart_printer_test;
6 6
7 import 'dart:mirrors'; 7 import 'dart:mirrors';
8 import 'package:expect/expect.dart'; 8 import 'package:expect/expect.dart';
9 import 'package:compiler/src/constants/values.dart'; 9 import 'package:compiler/src/constants/values.dart';
10 import 'package:compiler/src/dart_backend/backend_ast_nodes.dart'; 10 import 'package:compiler/src/dart_backend/backend_ast_nodes.dart';
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 push(null); 576 push(null);
577 } 577 }
578 578
579 endForIn(Token await, Token begin, Token inKeyword, Token end) { 579 endForIn(Token await, Token begin, Token inKeyword, Token end) {
580 Statement body = pop(); 580 Statement body = pop();
581 Expression exp = pop(); 581 Expression exp = pop();
582 Node declaredIdentifier = pop(); 582 Node declaredIdentifier = pop();
583 push(new ForIn(declaredIdentifier, exp, body)); 583 push(new ForIn(declaredIdentifier, exp, body));
584 } 584 }
585 585
586 handleAssertStatement(Token assertKeyword, Token semicolonToken) { 586 handleAssertStatement(Token assertKeyword,
587 Token commaToken, Token semicolonToken) {
588 Expression message;
589 if (commaToken != null) message = pop();
587 Expression exp = pop(); 590 Expression exp = pop();
588 Expression call = new CallFunction(new Identifier("assert"), [exp]); 591 var arguments = [exp];
592 if (message != null) arguments.add(message);
593 Expression call = new CallFunction(new Identifier("assert"), arguments);
589 push(new ExpressionStatement(call)); 594 push(new ExpressionStatement(call));
590 } 595 }
591 596
592 endLabeledStatement(int labelCount) { 597 endLabeledStatement(int labelCount) {
593 Statement statement = pop(); 598 Statement statement = pop();
594 for (int i=0; i<labelCount; i++) { 599 for (int i=0; i<labelCount; i++) {
595 String label = pop(asName); 600 String label = pop(asName);
596 statement = new LabeledStatement(label, statement); 601 statement = new LabeledStatement(label, statement);
597 } 602 }
598 push(statement); 603 push(statement);
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 checkStatement("do while(x); while (y);"); 975 checkStatement("do while(x); while (y);");
971 checkStatement("{do; while(x); while (y);}"); 976 checkStatement("{do; while(x); while (y);}");
972 977
973 checkStatement('switch(x) { case 1: case 2: return y; }'); 978 checkStatement('switch(x) { case 1: case 2: return y; }');
974 checkStatement('switch(x) { default: return y; }'); 979 checkStatement('switch(x) { default: return y; }');
975 checkStatement('switch(x) { case 1: x=y; default: return y; }'); 980 checkStatement('switch(x) { case 1: x=y; default: return y; }');
976 checkStatement('switch(x) { case 1: x=y; y=z; break; default: return y; }'); 981 checkStatement('switch(x) { case 1: x=y; y=z; break; default: return y; }');
977 982
978 } 983 }
979 984
OLDNEW
« pkg/compiler/lib/src/ssa/builder.dart ('K') | « sdk/lib/core/errors.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698