OLD | NEW |
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("dart:uri"); | 7 #import("dart:uri"); |
8 | 8 |
9 #import("../../../lib/compiler/implementation/elements/elements.dart"); | 9 #import("../../../lib/compiler/implementation/elements/elements.dart"); |
10 #import("../../../lib/compiler/implementation/leg.dart"); | 10 #import("../../../lib/compiler/implementation/leg.dart"); |
11 #import('../../../lib/compiler/implementation/source_file.dart'); | 11 #import('../../../lib/compiler/implementation/source_file.dart'); |
12 #import("../../../lib/compiler/implementation/tree/tree.dart"); | 12 #import("../../../lib/compiler/implementation/tree/tree.dart"); |
13 #import("../../../lib/compiler/implementation/util/util.dart"); | 13 #import("../../../lib/compiler/implementation/util/util.dart"); |
14 #import('../../../lib/compiler/compiler.dart', prefix: 'api'); | 14 #import('../../../lib/compiler/compiler.dart', prefix: 'api'); |
15 #import("parser_helper.dart"); | 15 #import("parser_helper.dart"); |
16 | 16 |
17 class WarningMessage { | 17 class WarningMessage { |
18 Node node; | 18 Node node; |
19 Message message; | 19 Message message; |
20 WarningMessage(this.node, this.message); | 20 WarningMessage(this.node, this.message); |
21 | 21 |
22 toString() => message.toString(); | 22 toString() => message.toString(); |
23 } | 23 } |
24 | 24 |
25 final String DEFAULT_HELPERLIB = @''' | 25 const String DEFAULT_HELPERLIB = @''' |
26 lt() {} add(var a, var b) {} sub() {} mul() {} div() {} tdiv() {} mod() {} | 26 lt() {} add(var a, var b) {} sub() {} mul() {} div() {} tdiv() {} mod() {} |
27 neg() {} shl() {} shr() {} eq() {} le() {} gt() {} ge() {} | 27 neg() {} shl() {} shr() {} eq() {} le() {} gt() {} ge() {} |
28 or() {} and() {} not() {} eqNull(a) {} eqq() {} | 28 or() {} and() {} not() {} eqNull(a) {} eqq() {} |
29 ltB() {} leB() {} eqB() {} gtB() {} geB() {} eqNullB(a) {} | 29 ltB() {} leB() {} eqB() {} gtB() {} geB() {} eqNullB(a) {} |
30 captureStackTrace(x) { return x; } | 30 captureStackTrace(x) { return x; } |
31 iae(x) { throw x; } ioore(x) { throw x; } | 31 iae(x) { throw x; } ioore(x) { throw x; } |
32 guard$array(x) { return x; } | 32 guard$array(x) { return x; } |
33 guard$num(x) { return x; } | 33 guard$num(x) { return x; } |
34 guard$string(x) { return x; } | 34 guard$string(x) { return x; } |
35 guard$stringOrArray(x) { return x; } | 35 guard$stringOrArray(x) { return x; } |
36 index(a, index) {} | 36 index(a, index) {} |
37 indexSet(a, index, value) {} | 37 indexSet(a, index, value) {} |
38 setRuntimeTypeInfo(a, b) {} | 38 setRuntimeTypeInfo(a, b) {} |
39 getRuntimeTypeInfo(a) {} | 39 getRuntimeTypeInfo(a) {} |
40 interface JavaScriptIndexingBehavior {} | 40 interface JavaScriptIndexingBehavior {} |
41 S() {}'''; | 41 S() {}'''; |
42 | 42 |
43 final String DEFAULT_INTERCEPTORSLIB = @''' | 43 const String DEFAULT_INTERCEPTORSLIB = @''' |
44 add$1(receiver, value) {} | 44 add$1(receiver, value) {} |
45 get$length(receiver) {} | 45 get$length(receiver) {} |
46 filter(receiver, predicate) {} | 46 filter(receiver, predicate) {} |
47 removeLast(receiver) {} | 47 removeLast(receiver) {} |
48 iterator(receiver) {} | 48 iterator(receiver) {} |
49 next(receiver) {} | 49 next(receiver) {} |
50 hasNext(receiver) {}'''; | 50 hasNext(receiver) {}'''; |
51 | 51 |
52 final String DEFAULT_CORELIB = @''' | 52 const String DEFAULT_CORELIB = @''' |
53 print(var obj) {} | 53 print(var obj) {} |
54 assert(x) {} | 54 assert(x) {} |
55 interface int extends num {} | 55 interface int extends num {} |
56 interface double extends num {} | 56 interface double extends num {} |
57 class bool {} | 57 class bool {} |
58 class String {} | 58 class String {} |
59 class Object {} | 59 class Object {} |
60 interface num {} | 60 interface num {} |
61 class Function {} | 61 class Function {} |
62 class List {} | 62 class List {} |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 }); | 210 }); |
211 } | 211 } |
212 } | 212 } |
213 | 213 |
214 LibraryElement mockLibrary(Compiler compiler, String source) { | 214 LibraryElement mockLibrary(Compiler compiler, String source) { |
215 Uri uri = new Uri.fromComponents(scheme: "source"); | 215 Uri uri = new Uri.fromComponents(scheme: "source"); |
216 var library = new LibraryElement(new Script(uri, new MockFile(source))); | 216 var library = new LibraryElement(new Script(uri, new MockFile(source))); |
217 importLibrary(library, compiler.coreLibrary, compiler); | 217 importLibrary(library, compiler.coreLibrary, compiler); |
218 return library; | 218 return library; |
219 } | 219 } |
OLD | NEW |