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

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

Issue 10809004: Attach source map positions to returns, sends, and some operators. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 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 | « lib/compiler/implementation/ssa/builder.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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('dart:uri'); 5 #import('dart:uri');
6 6
7 #import("../../../lib/compiler/implementation/leg.dart"); 7 #import("../../../lib/compiler/implementation/leg.dart");
8 #import('../../../lib/compiler/implementation/source_file.dart'); 8 #import('../../../lib/compiler/implementation/source_file.dart');
9 #import("mock_compiler.dart"); 9 #import("mock_compiler.dart");
10 #import('parser_helper.dart'); 10 #import('parser_helper.dart');
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 (s) => s); 46 (s) => s);
47 Expect.fail(message); 47 Expect.fail(message);
48 } 48 }
49 } 49 }
50 } 50 }
51 51
52 String FUNCTIONS_TEST = ''' 52 String FUNCTIONS_TEST = '''
53 @void main() { print(test(15)); @} 53 @void main() { print(test(15)); @}
54 @int test(int x) { return x; @}'''; 54 @int test(int x) { return x; @}''';
55 55
56 String RETURN_TEST = 'void main() { print(((x) { @return x; })(0)); }';
57
58 String NOT_TEST = 'void main() { ((x) { if (@!x) print(x); })(false); }';
59
60 String UNARY_TEST = 'void main() { ((x, y) { print(@-x + @~y); })(1,2); }';
61
62 String BINARY_TEST = 'void main() { ((x, y) { if (x @!== y) print(x @* y); })(1, 2); }';
63
64 String SEND_TEST = '''
65 void main() {
66 @staticSend(0);
67 NewSend o = new @NewSend();
68 @o.dynamicSend(0);
69 var closureSend = (x) { print(x); };
70 @closureSend(0);
71 }
72 void staticSend(x) { print(x); }
73 class NewSend { void dynamicSend(x) { print(x); } }
74 ''';
75
56 main() { 76 main() {
57 // These tests are fragile, since mappings for specific source locations 77 // These tests are fragile, since mappings for specific source locations
58 // could disappear due to various optimizations like code elimination, 78 // could disappear due to various optimizations like code elimination,
59 // function inlining, etc. If you broke the test, please try to rewrite it 79 // function inlining, etc. If you broke the test, please try to rewrite it
60 // so that the new code is not optimized, otherwise just remove the marker 80 // so that the new code is not optimized, otherwise just remove the marker
61 // from problematic location. 81 // from problematic location.
62 testSourceMapLocations(FUNCTIONS_TEST); 82 testSourceMapLocations(FUNCTIONS_TEST);
83 testSourceMapLocations(RETURN_TEST);
84 testSourceMapLocations(NOT_TEST);
85 testSourceMapLocations(UNARY_TEST);
86 testSourceMapLocations(BINARY_TEST);
87 testSourceMapLocations(SEND_TEST);
63 } 88 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/ssa/builder.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698