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

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

Issue 10823293: Support resolution of indexed operators. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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/resolver_test.dart
diff --git a/tests/compiler/dart2js/resolver_test.dart b/tests/compiler/dart2js/resolver_test.dart
index 8de20aa63d6c0ea4ad0a8bd9479f5e0af020b3c6..a0e9b6fee3decf6d924e7730e10c71ff1856e491 100644
--- a/tests/compiler/dart2js/resolver_test.dart
+++ b/tests/compiler/dart2js/resolver_test.dart
@@ -73,6 +73,7 @@ main() {
testSuperCalls();
testTypeVariables();
testToString();
+ testIndexedOperator();
}
testTypeVariables() {
@@ -726,17 +727,43 @@ List<String> asSortedStrings(Link link) {
return result;
}
-testToString() {
+compileScript(String source, f(compiler)) {
kasperl 2012/08/14 07:13:13 Could this just return the compiler instead?
Anton Muhin 2012/08/14 11:34:44 Done.
Uri uri = new Uri.fromComponents(scheme: 'source');
- MockCompiler compiler = compilerFor(
- @"class C { toString() => 'C'; } main() { '${new C()}'; }",
- uri);
+ MockCompiler compiler = compilerFor(source, uri);
compiler.runCompiler(uri);
+ f(compiler);
+}
- Element toStringMethod = findElement(compiler, 'C')
- .lookupLocalMember(buildSourceString('toString'));
- Expect.isNotNull(toStringMethod);
+testToString() {
+ compileScript(@"class C { toString() => 'C'; } main() { '${new C()}'; }",
kasperl 2012/08/14 07:13:13 Maybe stuff the script code in a string variable t
Anton Muhin 2012/08/14 11:34:44 Hopefully obsolete after addressing your previous
+ (compiler) {
+ Element toStringMethod = findElement(compiler, 'C')
+ .lookupLocalMember(buildSourceString('toString'));
+ Expect.isNotNull(toStringMethod);
+
+ Expect.isNotNull(
+ compiler.enqueuer.resolution.getCachedElements(toStringMethod));
+ });
+}
- Expect.isNotNull(
- compiler.enqueuer.resolution.getCachedElements(toStringMethod));
+testIndexedOperator() {
+ compileScript(@"""
kasperl 2012/08/14 07:13:13 Separate string variable for the script code.
Anton Muhin 2012/08/14 11:34:44 Done.
+ class C {
+ operator[](ix) => ix;
+ operator[]=(ix, v) {}
+ }
+ main() { var c = new C(); c[0]++ ; }""",
+ (compiler) {
+ Element indexedOperator = findElement(compiler, 'C')
+ .lookupLocalMember(buildSourceString(@'operator$index'));
kasperl 2012/08/14 07:13:13 It would be nice if you didn't have to hardcode th
Anton Muhin 2012/08/14 11:34:44 Done.
+ Expect.isNotNull(indexedOperator);
+ Expect.isNotNull(
+ compiler.enqueuer.resolution.getCachedElements(indexedOperator));
+
+ Element indexedSetOperator = findElement(compiler, 'C')
+ .lookupLocalMember(buildSourceString(@'operator$indexSet'));
+ Expect.isNotNull(indexedOperator);
+ Expect.isNotNull(
+ compiler.enqueuer.resolution.getCachedElements(indexedSetOperator));
+ });
}
« lib/compiler/implementation/resolver.dart ('K') | « lib/compiler/implementation/resolver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698