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

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

Issue 10831285: Revert "Register toString dynamic invocation in the presence of string interpolation." (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 unified diff | Download patch | Annotate | Revision Log
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');
6
7 #import("../../../lib/compiler/implementation/leg.dart"); 5 #import("../../../lib/compiler/implementation/leg.dart");
8 #import("../../../lib/compiler/implementation/elements/elements.dart"); 6 #import("../../../lib/compiler/implementation/elements/elements.dart");
9 #import("../../../lib/compiler/implementation/tree/tree.dart"); 7 #import("../../../lib/compiler/implementation/tree/tree.dart");
10 #import("../../../lib/compiler/implementation/util/util.dart"); 8 #import("../../../lib/compiler/implementation/util/util.dart");
11 #import("compiler_helper.dart");
12 #import("mock_compiler.dart"); 9 #import("mock_compiler.dart");
13 #import("parser_helper.dart"); 10 #import("parser_helper.dart");
14 11
15 Node buildIdentifier(String name) => new Identifier(scan(name)); 12 Node buildIdentifier(String name) => new Identifier(scan(name));
16 13
17 Node buildInitialization(String name) => 14 Node buildInitialization(String name) =>
18 parseBodyCode('$name = 1', 15 parseBodyCode('$name = 1',
19 (parser, tokens) => parser.parseOptionallyInitializedIdentifier(tokens)); 16 (parser, tokens) => parser.parseOptionallyInitializedIdentifier(tokens));
20 17
21 createLocals(List variables) { 18 createLocals(List variables) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 // testOneInterface(); // Generates unexpected error message. 62 // testOneInterface(); // Generates unexpected error message.
66 // testTwoInterfaces(); // Generates unexpected error message. 63 // testTwoInterfaces(); // Generates unexpected error message.
67 testFunctionExpression(); 64 testFunctionExpression();
68 testNewExpression(); 65 testNewExpression();
69 testTopLevelFields(); 66 testTopLevelFields();
70 testClassHierarchy(); 67 testClassHierarchy();
71 testInitializers(); 68 testInitializers();
72 testThis(); 69 testThis();
73 testSuperCalls(); 70 testSuperCalls();
74 testTypeVariables(); 71 testTypeVariables();
75 testToString();
76 } 72 }
77 73
78 testTypeVariables() { 74 testTypeVariables() {
79 matchResolvedTypes(visitor, text, name, expectedElements) { 75 matchResolvedTypes(visitor, text, name, expectedElements) {
80 VariableDefinitions definition = parseStatement(text); 76 VariableDefinitions definition = parseStatement(text);
81 visitor.visit(definition.type); 77 visitor.visit(definition.type);
82 InterfaceType type = visitor.mapping.getType(definition.type); 78 InterfaceType type = visitor.mapping.getType(definition.type);
83 Expect.equals(definition.type.typeArguments.length(), 79 Expect.equals(definition.type.typeArguments.length(),
84 length(type.arguments)); 80 length(type.arguments));
85 int index = 0; 81 int index = 0;
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 length(Link link) => link.isEmpty() ? 0 : length(link.tail) + 1; 711 length(Link link) => link.isEmpty() ? 0 : length(link.tail) + 1;
716 712
717 at(Link link, int index) => (index == 0) ? link.head : at(link.tail, index - 1); 713 at(Link link, int index) => (index == 0) ? link.head : at(link.tail, index - 1);
718 714
719 List<String> asSortedStrings(Link link) { 715 List<String> asSortedStrings(Link link) {
720 List<String> result = <String>[]; 716 List<String> result = <String>[];
721 for (; !link.isEmpty(); link = link.tail) result.add(link.head.toString()); 717 for (; !link.isEmpty(); link = link.tail) result.add(link.head.toString());
722 result.sort((s1, s2) => s1.compareTo(s2)); 718 result.sort((s1, s2) => s1.compareTo(s2));
723 return result; 719 return result;
724 } 720 }
725
726 testToString() {
727 Uri uri = new Uri.fromComponents(scheme: 'source');
728 MockCompiler compiler = compilerFor(
729 @"class C { toString() => 'C'; } main() { '${new C()}'; }",
730 uri);
731 compiler.runCompiler(uri);
732
733 Element toStringMethod = findElement(compiler, 'C')
734 .lookupLocalMember(buildSourceString('toString'));
735 Expect.isNotNull(toStringMethod);
736
737 Expect.isNotNull(
738 compiler.enqueuer.resolution.getCachedElements(toStringMethod));
739 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/concrete_type_inference_test.dart ('k') | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698