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

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

Issue 10915083: Change assert implementation to not depend on a top-level function called 'assert'. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments. Created 8 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
« no previous file with comments | « tests/co19/co19-dart2js.status ('k') | tests/compiler/dart2js/unparser_test.dart » ('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("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");
(...skipping 21 matching lines...) Expand all
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 stringTypeCheck(x) {} 40 stringTypeCheck(x) {}
41 interface JavaScriptIndexingBehavior {} 41 interface JavaScriptIndexingBehavior {}
42 S() {}'''; 42 S() {}
43 assert(a){}''';
43 44
44 const String DEFAULT_INTERCEPTORSLIB = @''' 45 const String DEFAULT_INTERCEPTORSLIB = @'''
45 add$1(receiver, value) {} 46 add$1(receiver, value) {}
46 get$length(receiver) {} 47 get$length(receiver) {}
47 filter(receiver, predicate) {} 48 filter(receiver, predicate) {}
48 removeLast(receiver) {} 49 removeLast(receiver) {}
49 iterator(receiver) {} 50 iterator(receiver) {}
50 next(receiver) {} 51 next(receiver) {}
51 hasNext(receiver) {}'''; 52 hasNext(receiver) {}''';
52 53
53 const String DEFAULT_CORELIB = @''' 54 const String DEFAULT_CORELIB = @'''
54 print(var obj) {} 55 print(var obj) {}
55 assert(x) {}
56 interface int extends num {} 56 interface int extends num {}
57 interface double extends num {} 57 interface double extends num {}
58 class bool {} 58 class bool {}
59 class String {} 59 class String {}
60 class Object {} 60 class Object {}
61 interface num {} 61 interface num {}
62 class Function {} 62 class Function {}
63 class List {} 63 class List {}
64 class Closure {} 64 class Closure {}
65 class Null {} 65 class Null {}
(...skipping 11 matching lines...) Expand all
77 bool enableTypeAssertions = false]) 77 bool enableTypeAssertions = false])
78 : warnings = [], errors = [], 78 : warnings = [], errors = [],
79 sourceFiles = new Map<String, SourceFile>(), 79 sourceFiles = new Map<String, SourceFile>(),
80 super(enableTypeAssertions: enableTypeAssertions) { 80 super(enableTypeAssertions: enableTypeAssertions) {
81 Uri uri = new Uri.fromComponents(scheme: "source"); 81 Uri uri = new Uri.fromComponents(scheme: "source");
82 var script = new Script(uri, new MockFile(coreSource)); 82 var script = new Script(uri, new MockFile(coreSource));
83 coreLibrary = new LibraryElement(script); 83 coreLibrary = new LibraryElement(script);
84 parseScript(coreSource, coreLibrary); 84 parseScript(coreSource, coreLibrary);
85 // We need to set the assert method to avoid calls with a 'null' 85 // We need to set the assert method to avoid calls with a 'null'
86 // target being interpreted as a call to assert. 86 // target being interpreted as a call to assert.
87 assertMethod = coreLibrary.find(buildSourceString('assert'));
88 87
89 script = new Script(uri, new MockFile(helperSource)); 88 script = new Script(uri, new MockFile(helperSource));
90 jsHelperLibrary = new LibraryElement(script); 89 jsHelperLibrary = new LibraryElement(script);
91 parseScript(helperSource, jsHelperLibrary); 90 parseScript(helperSource, jsHelperLibrary);
91 assertMethod = jsHelperLibrary.find(buildSourceString('assert'));
92 92
93 script = new Script(uri, new MockFile(interceptorsSource)); 93 script = new Script(uri, new MockFile(interceptorsSource));
94 interceptorsLibrary = new LibraryElement(script); 94 interceptorsLibrary = new LibraryElement(script);
95 parseScript(interceptorsSource, interceptorsLibrary); 95 parseScript(interceptorsSource, interceptorsLibrary);
96 96
97 mainApp = mockLibrary(this, ""); 97 mainApp = mockLibrary(this, "");
98 initializeSpecialClasses(); 98 initializeSpecialClasses();
99 } 99 }
100 100
101 void reportWarning(Node node, var message) { 101 void reportWarning(Node node, var message) {
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 }); 212 });
213 } 213 }
214 } 214 }
215 215
216 LibraryElement mockLibrary(Compiler compiler, String source) { 216 LibraryElement mockLibrary(Compiler compiler, String source) {
217 Uri uri = new Uri.fromComponents(scheme: "source"); 217 Uri uri = new Uri.fromComponents(scheme: "source");
218 var library = new LibraryElement(new Script(uri, new MockFile(source))); 218 var library = new LibraryElement(new Script(uri, new MockFile(source)));
219 importLibrary(library, compiler.coreLibrary, compiler); 219 importLibrary(library, compiler.coreLibrary, compiler);
220 return library; 220 return library;
221 } 221 }
OLDNEW
« no previous file with comments | « tests/co19/co19-dart2js.status ('k') | tests/compiler/dart2js/unparser_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698