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

Side by Side Diff: frog/tests/leg/src/mock_compiler.dart

Issue 9666006: Support for "a is Function". (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 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
« no previous file with comments | « frog/leg/ssa/codegen.dart ('k') | tests/co19/co19-leg.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #library('mock_compiler'); 5 #library('mock_compiler');
6 6
7 #import("../../../../lib/uri/uri.dart"); 7 #import("../../../../lib/uri/uri.dart");
8 8
9 #import("../../../leg/elements/elements.dart"); 9 #import("../../../leg/elements/elements.dart");
10 #import("../../../leg/io/io.dart", prefix: 'io'); 10 #import("../../../leg/io/io.dart", prefix: 'io');
(...skipping 17 matching lines...) Expand all
28 iae(x) {throw x;} ioore(x) {throw x;} 28 iae(x) {throw x;} ioore(x) {throw x;}
29 guard$array(x) { return x; } 29 guard$array(x) { return x; }
30 guard$num(x) { return x; } 30 guard$num(x) { return x; }
31 guard$string(x) { return x; } 31 guard$string(x) { return x; }
32 guard$stringOrArray(x) { return x; } 32 guard$stringOrArray(x) { return x; }
33 builtin$add$1(receiver, value) {} 33 builtin$add$1(receiver, value) {}
34 builtin$get$length(var receiver) {} 34 builtin$get$length(var receiver) {}
35 builtin$filter$1(receiver, predicate) {} 35 builtin$filter$1(receiver, predicate) {}
36 builtin$removeLast$0(receiver) {} 36 builtin$removeLast$0(receiver) {}
37 index(a, index) {} 37 index(a, index) {}
38 indexSet(a, index, value) {}'''; 38 indexSet(a, index, value) {}
39 class Closure {} ''';
39 40
40 final String DEFAULT_CORELIB = @''' 41 final String DEFAULT_CORELIB = @'''
41 print(var obj) {} 42 print(var obj) {}
42 class int {} 43 class int {}
43 class double {} 44 class double {}
44 class bool {} 45 class bool {}
45 class String {} 46 class String {}
46 class Object {}'''; 47 class Object {}''';
47 48
48 class MockCompiler extends Compiler { 49 class MockCompiler extends Compiler {
49 List<WarningMessage> warnings; 50 List<WarningMessage> warnings;
50 List<WarningMessage> errors; 51 List<WarningMessage> errors;
51 final Map<String, String> sources; 52 final Map<String, String> sources;
52 Node parsedTree; 53 Node parsedTree;
53 WorkItem lastBailoutWork; 54 WorkItem lastBailoutWork;
54 55
55 MockCompiler([String coreSource = DEFAULT_CORELIB, 56 MockCompiler([String coreSource = DEFAULT_CORELIB,
56 String helperSource = DEFAULT_HELPERLIB]) 57 String helperSource = DEFAULT_HELPERLIB])
57 : warnings = [], errors = [], 58 : warnings = [], errors = [],
58 sources = new Map<String, String>(), 59 sources = new Map<String, String>(),
59 super.withCurrentDirectory(io.getCurrentDirectory()) { 60 super.withCurrentDirectory(io.getCurrentDirectory()) {
60 Uri uri = new Uri(scheme: "source"); 61 Uri uri = new Uri(scheme: "source");
61 var script = new Script(uri, new MockFile(coreSource)); 62 var script = new Script(uri, new MockFile(coreSource));
62 coreLibrary = new LibraryElement(script); 63 coreLibrary = new LibraryElement(script);
63 parseScript(coreSource, coreLibrary); 64 parseScript(coreSource, coreLibrary);
64 script = new Script(uri, new MockFile(helperSource)); 65 script = new Script(uri, new MockFile(helperSource));
65 jsHelperLibrary = new LibraryElement(script); 66 jsHelperLibrary = new LibraryElement(script);
66 parseScript(helperSource, jsHelperLibrary); 67 parseScript(helperSource, jsHelperLibrary);
68 scanner.importLibrary(jsHelperLibrary, coreLibrary, null);
67 mainApp = mockLibrary(this, ""); 69 mainApp = mockLibrary(this, "");
70 objectClass = coreLibrary.find(Compiler.OBJECT);
71 closureClass = jsHelperLibrary.find(Compiler.CLOSURE);
68 } 72 }
69 73
70 void reportWarning(Node node, var message) { 74 void reportWarning(Node node, var message) {
71 warnings.add(new WarningMessage(node, message.message)); 75 warnings.add(new WarningMessage(node, message.message));
72 } 76 }
73 77
74 void reportError(Node node, var message) { 78 void reportError(Node node, var message) {
75 errors.add(new WarningMessage(node, message.message)); 79 errors.add(new WarningMessage(node, message.message));
76 } 80 }
77 81
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 importLibrary(library, compiler.coreLibrary, compiler); 180 importLibrary(library, compiler.coreLibrary, compiler);
177 return library; 181 return library;
178 } 182 }
179 183
180 class StringScript extends Script { 184 class StringScript extends Script {
181 final String code; 185 final String code;
182 StringScript(this.code) : super(null, null); 186 StringScript(this.code) : super(null, null);
183 String get text() => code; 187 String get text() => code;
184 String get name() => "mock script"; 188 String get name() => "mock script";
185 } 189 }
OLDNEW
« no previous file with comments | « frog/leg/ssa/codegen.dart ('k') | tests/co19/co19-leg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698