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

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: 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
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 add$1(receiver, value) {} 45 add$1(receiver, value) {}
46 get$length(receiver) {} 46 get$length(receiver) {}
47 filter(receiver, predicate) {} 47 filter(receiver, predicate) {}
48 removeLast(receiver) {} 48 removeLast(receiver) {}
49 iterator(receiver) {} 49 iterator(receiver) {}
50 next(receiver) {} 50 next(receiver) {}
51 hasNext(receiver) {}'''; 51 hasNext(receiver) {}''';
52 52
53 const String DEFAULT_CORELIB = @''' 53 const String DEFAULT_CORELIB = @'''
54 print(var obj) {} 54 print(var obj) {}
55 assert(x) {} 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')); 87 assertMethod = coreLibrary.find(buildSourceString('_assert'));
88 88
89 script = new Script(uri, new MockFile(helperSource)); 89 script = new Script(uri, new MockFile(helperSource));
90 jsHelperLibrary = new LibraryElement(script); 90 jsHelperLibrary = new LibraryElement(script);
91 parseScript(helperSource, jsHelperLibrary); 91 parseScript(helperSource, jsHelperLibrary);
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, "");
(...skipping 114 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

Powered by Google App Engine
This is Rietveld 408576698