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

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

Issue 17759007: First pass at asynchronous input loading in dart2js. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments Created 7 years, 3 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) 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 'package:expect/expect.dart'; 5 import 'package:expect/expect.dart';
6 import "package:async_helper/async_helper.dart";
6 import 'compiler_helper.dart'; 7 import 'compiler_helper.dart';
7 import 'parser_helper.dart'; 8 import 'parser_helper.dart';
8 9
9 const String TEST = """ 10 const String TEST = """
10 11
11 class A { 12 class A {
12 get foo => 'string'; 13 get foo => 'string';
13 set foo(value) {} 14 set foo(value) {}
14 operator[](index) => 'string'; 15 operator[](index) => 'string';
15 operator[]=(index, value) {} 16 operator[]=(index, value) {}
16 17
17 returnDynamic1() => foo--; 18 returnDynamic1() => foo--;
18 returnNum1() => --foo; 19 returnNum1() => --foo;
19 returnNum2() => foo -= 42; 20 returnNum2() => foo -= 42;
20 21
21 returnDynamic2() => this[index]--; 22 returnDynamic2() => this[index]--;
22 returnNum3() => --this[index]; 23 returnNum3() => --this[index];
23 returnNum4() => this[index] -= 42; 24 returnNum4() => this[index] -= 42;
24 25
25 returnDynamic3() => this.bar--; 26 returnDynamic3() => this.bar--;
26 returnNum5() => --this.bar; 27 returnNum5() => --this.bar;
(...skipping 29 matching lines...) Expand all
56 ..returnDynamic1() 57 ..returnDynamic1()
57 ..returnDynamic2() 58 ..returnDynamic2()
58 ..returnDynamic3() 59 ..returnDynamic3()
59 ..returnDynamic4(); 60 ..returnDynamic4();
60 } 61 }
61 """; 62 """;
62 63
63 void main() { 64 void main() {
64 Uri uri = new Uri(scheme: 'source'); 65 Uri uri = new Uri(scheme: 'source');
65 var compiler = compilerFor(TEST, uri); 66 var compiler = compilerFor(TEST, uri);
66 compiler.runCompiler(uri); 67 asyncTest(() => compiler.runCompiler(uri).then((_) {
67 var typesTask = compiler.typesTask; 68 var typesTask = compiler.typesTask;
68 var typesInferrer = typesTask.typesInferrer; 69 var typesInferrer = typesTask.typesInferrer;
69 70
70 checkReturnInClass(String className, String methodName, type) { 71 checkReturnInClass(String className, String methodName, type) {
71 var cls = findElement(compiler, className); 72 var cls = findElement(compiler, className);
72 var element = cls.lookupLocalMember(buildSourceString(methodName)); 73 var element = cls.lookupLocalMember(buildSourceString(methodName));
73 Expect.equals(type, 74 Expect.equals(type,
74 typesInferrer.getReturnTypeOfElement(element).simplify(compiler)); 75 typesInferrer.getReturnTypeOfElement(element).simplify(compiler));
75 } 76 }
76 77
77 var subclassOfInterceptor = 78 var subclassOfInterceptor =
78 findTypeMask(compiler, 'Interceptor', 'nonNullSubclass'); 79 findTypeMask(compiler, 'Interceptor', 'nonNullSubclass');
79 80
80 checkReturnInClass('A', 'returnNum1', typesTask.numType); 81 checkReturnInClass('A', 'returnNum1', typesTask.numType);
81 checkReturnInClass('A', 'returnNum2', typesTask.numType); 82 checkReturnInClass('A', 'returnNum2', typesTask.numType);
82 checkReturnInClass('A', 'returnNum3', typesTask.numType); 83 checkReturnInClass('A', 'returnNum3', typesTask.numType);
83 checkReturnInClass('A', 'returnNum4', typesTask.numType); 84 checkReturnInClass('A', 'returnNum4', typesTask.numType);
84 checkReturnInClass('A', 'returnNum5', typesTask.numType); 85 checkReturnInClass('A', 'returnNum5', typesTask.numType);
85 checkReturnInClass('A', 'returnNum6', typesTask.numType); 86 checkReturnInClass('A', 'returnNum6', typesTask.numType);
86 checkReturnInClass('A', 'returnDynamic1', subclassOfInterceptor); 87 checkReturnInClass('A', 'returnDynamic1', subclassOfInterceptor);
87 checkReturnInClass('A', 'returnDynamic2', subclassOfInterceptor); 88 checkReturnInClass('A', 'returnDynamic2', subclassOfInterceptor);
88 checkReturnInClass('A', 'returnDynamic3', typesTask.dynamicType); 89 checkReturnInClass('A', 'returnDynamic3', typesTask.dynamicType);
89 90
90 checkReturnInClass('B', 'returnString1', typesTask.stringType); 91 checkReturnInClass('B', 'returnString1', typesTask.stringType);
91 checkReturnInClass('B', 'returnString2', typesTask.stringType); 92 checkReturnInClass('B', 'returnString2', typesTask.stringType);
92 checkReturnInClass('B', 'returnDynamic1', typesTask.dynamicType); 93 checkReturnInClass('B', 'returnDynamic1', typesTask.dynamicType);
93 checkReturnInClass('B', 'returnDynamic2', typesTask.dynamicType); 94 checkReturnInClass('B', 'returnDynamic2', typesTask.dynamicType);
94 checkReturnInClass('B', 'returnDynamic3', typesTask.dynamicType); 95 checkReturnInClass('B', 'returnDynamic3', typesTask.dynamicType);
95 checkReturnInClass('B', 'returnDynamic4', typesTask.dynamicType); 96 checkReturnInClass('B', 'returnDynamic4', typesTask.dynamicType);
97 }));
96 } 98 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698