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

Side by Side Diff: tests/utils/dummy_compiler_test.dart

Issue 10232011: Implement simple dynamic type check. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Minor edits. Created 8 years, 7 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 // Smoke test of the dart2js compiler API. 5 // Smoke test of the dart2js compiler API.
6 6
7 #import('../../lib/compiler/compiler.dart'); 7 #import('../../lib/compiler/compiler.dart');
8 #import('dart:uri'); 8 #import('dart:uri');
9 9
10 Future<String> provider(Uri uri) { 10 Future<String> provider(Uri uri) {
11 Completer<String> completer = new Completer<String>(); 11 Completer<String> completer = new Completer<String>();
12 String source; 12 String source;
13 if (uri.scheme == "main") { 13 if (uri.scheme == "main") {
14 source = "main() {}"; 14 source = "main() {}";
15 } else if (uri.scheme == "lib") { 15 } else if (uri.scheme == "lib") {
16 if (uri.path.endsWith("/core.dart")) { 16 if (uri.path.endsWith("/core.dart")) {
17 source = """#library('core'); 17 source = """#library('core');
18 class Object{} 18 class Object{}
19 class bool {} 19 class bool {}
20 class num {} 20 class num {}
21 class int {} 21 class int {}
22 class double{} 22 class double{}
23 class String{} 23 class String{}
24 class Function{} 24 class Function{}
25 class List {} 25 class List {}
26 class Closure {} 26 class Closure {}
27 class Dynamic {} 27 class Dynamic {}
28 class Null {} 28 class Null {}
29 getRuntimeTypeInfo(o) {}
30 setRuntimeTypeInfo(o, i) {}
29 eqNull(a) {} 31 eqNull(a) {}
30 eqNullB(a) {}"""; 32 eqNullB(a) {}""";
31 } else { 33 } else {
32 source = "#library('lib');"; 34 source = "#library('lib');";
33 } 35 }
34 } else { 36 } else {
35 throw "unexpected URI $uri"; 37 throw "unexpected URI $uri";
36 } 38 }
37 completer.complete(source); 39 completer.complete(source);
38 return completer.future; 40 return completer.future;
39 } 41 }
40 42
41 void handler(Uri uri, int begin, int end, String message, bool fatal) { 43 void handler(Uri uri, int begin, int end, String message, bool fatal) {
42 print(message); 44 print(message);
43 } 45 }
44 46
45 main() { 47 main() {
46 String code = compile(new Uri(scheme: 'main'), new Uri(scheme: 'lib'), 48 String code = compile(new Uri(scheme: 'main'), new Uri(scheme: 'lib'),
47 provider, handler).value; 49 provider, handler).value;
48 if (code === null) { 50 if (code === null) {
49 throw 'Compilation failed'; 51 throw 'Compilation failed';
50 } 52 }
51 } 53 }
OLDNEW
« lib/compiler/implementation/ssa/ssa.dart ('K') | « tests/co19/co19-leg.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698