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

Side by Side Diff: tests/compiler/dart2js/interceptor_test.dart

Issue 12088019: Fix issue https://code.google.com/p/dart/issues/detail?id=8106: save the sourceElement in the one s… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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 | « sdk/lib/_internal/compiler/implementation/ssa/optimize.dart ('k') | no next file » | 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 6
7 const String TEST_ONE = r""" 7 const String TEST_ONE = r"""
8 foo(a) { 8 foo(a) {
9 // Make sure there is a bailout version. 9 // Make sure there is a bailout version.
10 foo(a); 10 foo(a);
11 // This will make a one shot interceptor that will be optimized in 11 // This will make a one shot interceptor that will be optimized in
12 // the non-bailout version because we know a is a number. 12 // the non-bailout version because we know a is a number.
13 return (a + 42).toString; 13 return (a + 42).toString;
14 } 14 }
15 """; 15 """;
16 16
17 const String TEST_TWO = r"""
18 foo(a) {
19 var myVariableName = a + 42;
20 print(myVariableName);
21 print(myVariableName);
22 }
23 """;
24
17 main() { 25 main() {
18 var generated = compile(TEST_ONE, entry: 'foo'); 26 var generated = compile(TEST_ONE, entry: 'foo');
19 // Check that the one shot interceptor got converted to a direct 27 // Check that the one shot interceptor got converted to a direct
20 // call to the interceptor object. 28 // call to the interceptor object.
21 Expect.isTrue(generated.contains('CONSTANT.get\$toString(a + 42);')); 29 Expect.isTrue(generated.contains('CONSTANT.get\$toString(a + 42);'));
30
31 // Check that one-shot interceptors preserve variable names, see
32 // https://code.google.com/p/dart/issues/detail?id=8106.
33 generated = compile(TEST_TWO, entry: 'foo');
34 Expect.isTrue(generated.contains('\$.\$\$add(a, 42)'));
35 Expect.isTrue(generated.contains('myVariableName'));
22 } 36 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/optimize.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698