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

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

Issue 10824347: Make top-level patch injections be compilation unit under library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Offline discussed changes. Created 8 years, 4 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 #import("../../../lib/compiler/implementation/leg.dart"); 5 #import("../../../lib/compiler/implementation/leg.dart");
6 #import("../../../lib/compiler/implementation/elements/elements.dart"); 6 #import("../../../lib/compiler/implementation/elements/elements.dart");
7 #import("../../../lib/compiler/implementation/tree/tree.dart"); 7 #import("../../../lib/compiler/implementation/tree/tree.dart");
8 #import("../../../lib/compiler/implementation/util/util.dart"); 8 #import("../../../lib/compiler/implementation/util/util.dart");
9 #import("mock_compiler.dart"); 9 #import("mock_compiler.dart");
10 #import("parser_helper.dart"); 10 #import("parser_helper.dart");
11 #import("dart:uri"); 11 #import("dart:uri");
12 12
13 Compiler applyPatch(String script, String patch) { 13 Compiler applyPatch(String script, String patch) {
14 String core = "$DEFAULT_CORELIB\n$script"; 14 String core = "$DEFAULT_CORELIB\n$script";
15 MockCompiler compiler = new MockCompiler(coreSource: core); 15 MockCompiler compiler = new MockCompiler(coreSource: core);
16
17 var uri = new Uri("core.dartp"); 16 var uri = new Uri("core.dartp");
18 var patchScript = new Script(uri, new MockFile(patch)); 17 compiler.sourceFiles[uri.toString()] = new MockFile(patch);
19 var patchLibrary = new LibraryElement(patchScript); 18 compiler.patchParser.patchLibrary(uri, compiler.coreLibrary);
20 19 compiler.applyClassPatches(compiler.coreLibrary);
21 compiler.patchParser.scanLibraryElements(patchLibrary);
22 compiler.applyLibraryPatch(compiler.coreLibrary, patchLibrary);
23
24 return compiler; 20 return compiler;
25 } 21 }
26 22
27 Element ensure(compiler, 23 Element ensure(compiler,
28 String name, 24 String name,
29 Element lookup(name), 25 Element lookup(name),
30 [bool isPatched = true, 26 [bool isPatched = true,
31 bool hasBody = false, 27 bool hasBody = false,
32 bool isGetter = false]) { 28 bool isGetter = false]) {
33 var element = lookup(buildSourceString(name)); 29 var element = lookup(buildSourceString(name));
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 hasBody: true, 99 hasBody: true,
104 isPatched: false); 100 isPatched: false);
105 } 101 }
106 102
107 main() { 103 main() {
108 testPatchFunction(); 104 testPatchFunction();
109 testPatchMember(); 105 testPatchMember();
110 testPatchGetter(); 106 testPatchGetter();
111 testInjectFunction(); 107 testInjectFunction();
112 } 108 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/scanner/scanner_task.dart ('k') | tests/compiler/dart2js/unparser_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698