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

Unified Diff: tests/compiler/dart2js/interceptor_test.dart

Issue 12087101: Turn getters and setters that we know are not intercepted into regular getter and setter calls. (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 side-by-side diff with in-line comments
Download patch
Index: tests/compiler/dart2js/interceptor_test.dart
===================================================================
--- tests/compiler/dart2js/interceptor_test.dart (revision 18037)
+++ tests/compiler/dart2js/interceptor_test.dart (working copy)
@@ -22,6 +22,16 @@
}
""";
+const String TEST_THREE = r"""
+ class A {
+ var length;
+ }
+ foo(a) {
+ print([]); // Make sure the array class is instantiated.
+ return new A().length + a.length;
+ }
+""";
+
main() {
var generated = compile(TEST_ONE, entry: 'foo');
// Check that the one shot interceptor got converted to a direct
@@ -33,4 +43,11 @@
generated = compile(TEST_TWO, entry: 'foo');
Expect.isTrue(generated.contains('\$.\$\$add(a, 42)'));
Expect.isTrue(generated.contains('myVariableName'));
+
+ // Check that we know when an intercepted getter name does not need
+ // to be intercepted;
kasperl 2013/02/04 13:39:03 The comment is fairly convoluted. ; -> .
ngeoffray 2013/02/04 14:51:07 Done.
+ generated = compile(TEST_THREE, entry: 'foo');
+ Expect.isFalse(generated.contains(r'get$length'));
+ Expect.isTrue(generated.contains(r'$.A$().length'));
+ Expect.isTrue(generated.contains(r'length(a)'));
}

Powered by Google App Engine
This is Rietveld 408576698