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

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

Issue 574683002: Use ConstExp for storing constants. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixes and further implementation. Created 6 years, 2 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) 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 import '../compiler_helper.dart'; 5 import '../compiler_helper.dart';
6 import 'sexpr_unstringifier.dart'; 6 import 'sexpr_unstringifier.dart';
7 import 'dart:async'; 7 import 'dart:async';
8 import "package:async_helper/async_helper.dart"; 8 import "package:async_helper/async_helper.dart";
9 import "package:expect/expect.dart"; 9 import "package:expect/expect.dart";
10 import 'package:compiler/implementation/dart2jslib.dart'; 10 import 'package:compiler/implementation/dart2jslib.dart';
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 } 130 }
131 131
132 return sexprs; 132 return sexprs;
133 }); 133 });
134 } 134 }
135 135
136 /// Checks if the generated S-expressions can be processed by the unstringifier, 136 /// Checks if the generated S-expressions can be processed by the unstringifier,
137 /// returns the resulting definitions. 137 /// returns the resulting definitions.
138 List<FunctionDefinition> testUnstringifier(List<String> sexprs) { 138 List<FunctionDefinition> testUnstringifier(List<String> sexprs) {
139 return sexprs.map((String sexpr) { 139 return sexprs.map((String sexpr) {
140 final function = new SExpressionUnstringifier().unstringify(sexpr); 140 try {
141 Expect.isNotNull(function, "Unstringification failed:\n\n$sexpr"); 141 final function = new SExpressionUnstringifier().unstringify(sexpr);
142 return function; 142 Expect.isNotNull(function, "Unstringification failed:\n\n$sexpr");
143 return function;
144 } catch (e, s) {
karlklose 2014/09/25 08:43:25 Why this change? Is this debug code or is the stac
Johnni Winther 2014/09/29 08:24:44 On error the unstringifier now throws instead of a
145 print('$e\n$s');
146 Expect.fail('Error unstringifying "$sexpr": $e');
147 }
143 }).toList(); 148 }).toList();
144 } 149 }
145 150
146 void main() { 151 void main() {
147 final tokens = 152 final tokens =
148 [ "FunctionDefinition" 153 [ "FunctionDefinition"
149 , "IsTrue" 154 , "IsTrue"
150 155
151 // Expressions 156 // Expressions
152 , "Branch" 157 , "Branch"
(...skipping 21 matching lines...) Expand all
174 ]; 179 ];
175 180
176 asyncTest(() => testStringifier(CODE, tokens).then((List<String> sexprs) { 181 asyncTest(() => testStringifier(CODE, tokens).then((List<String> sexprs) {
177 final functions = testUnstringifier(sexprs); 182 final functions = testUnstringifier(sexprs);
178 183
179 // Ensure that 184 // Ensure that
180 // stringified(CODE) == stringified(unstringified(stringified(CODE))) 185 // stringified(CODE) == stringified(unstringified(stringified(CODE)))
181 Expect.listEquals(sexprs, stringifyAll(functions)); 186 Expect.listEquals(sexprs, stringifyAll(functions));
182 })); 187 }));
183 } 188 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698