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

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

Issue 1342213003: Add optional message to assert in Dart2js - continued (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Add --assert-message flag 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 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 push(null); 580 push(null);
581 } 581 }
582 582
583 endForIn(Token await, Token begin, Token inKeyword, Token end) { 583 endForIn(Token await, Token begin, Token inKeyword, Token end) {
584 Statement body = pop(); 584 Statement body = pop();
585 Expression exp = pop(); 585 Expression exp = pop();
586 Node declaredIdentifier = pop(); 586 Node declaredIdentifier = pop();
587 push(new ForIn(declaredIdentifier, exp, body)); 587 push(new ForIn(declaredIdentifier, exp, body));
588 } 588 }
589 589
590 handleAssertStatement(Token assertKeyword, Token semicolonToken) { 590 handleAssertStatement(Token assertKeyword,
591 Token commaToken, Token semicolonToken) {
592 Expression message;
593 if (commaToken != null) message = pop();
591 Expression exp = pop(); 594 Expression exp = pop();
592 Expression call = new CallFunction(new Identifier("assert"), [exp]); 595 var arguments = [exp];
596 if (message != null) arguments.add(message);
597 Expression call = new CallFunction(new Identifier("assert"), arguments);
593 push(new ExpressionStatement(call)); 598 push(new ExpressionStatement(call));
594 } 599 }
595 600
596 endLabeledStatement(int labelCount) { 601 endLabeledStatement(int labelCount) {
597 Statement statement = pop(); 602 Statement statement = pop();
598 for (int i=0; i<labelCount; i++) { 603 for (int i=0; i<labelCount; i++) {
599 String label = pop(asName); 604 String label = pop(asName);
600 statement = new LabeledStatement(label, statement); 605 statement = new LabeledStatement(label, statement);
601 } 606 }
602 push(statement); 607 push(statement);
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 checkStatement("do while(x); while (y);"); 979 checkStatement("do while(x); while (y);");
975 checkStatement("{do; while(x); while (y);}"); 980 checkStatement("{do; while(x); while (y);}");
976 981
977 checkStatement('switch(x) { case 1: case 2: return y; }'); 982 checkStatement('switch(x) { case 1: case 2: return y; }');
978 checkStatement('switch(x) { default: return y; }'); 983 checkStatement('switch(x) { default: return y; }');
979 checkStatement('switch(x) { case 1: x=y; default: return y; }'); 984 checkStatement('switch(x) { case 1: x=y; default: return y; }');
980 checkStatement('switch(x) { case 1: x=y; y=z; break; default: return y; }'); 985 checkStatement('switch(x) { case 1: x=y; y=z; break; default: return y; }');
981 986
982 } 987 }
983 988
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/analyze_unused_dart2js_test.dart ('k') | tests/compiler/dart2js/js_backend_cps_ir.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698