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

Side by Side Diff: lib/compiler/implementation/apiimpl.dart

Issue 10689038: Revert "First step towards having patch files for generic libraries." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 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 | « no previous file | lib/compiler/implementation/compiler.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('leg_apiimpl'); 5 #library('leg_apiimpl');
6 6
7 #import('dart:uri'); 7 #import('dart:uri');
8 8
9 #import('../compiler.dart', prefix: 'api'); 9 #import('../compiler.dart', prefix: 'api');
10 #import('leg.dart', prefix: 'leg'); 10 #import('leg.dart', prefix: 'leg');
(...skipping 15 matching lines...) Expand all
26 List<String> options) 26 List<String> options)
27 : this.options = options, 27 : this.options = options,
28 super( 28 super(
29 tracer: new ssa.HTracer(), 29 tracer: new ssa.HTracer(),
30 enableTypeAssertions: options.indexOf('--enable-checked-mode') != -1, 30 enableTypeAssertions: options.indexOf('--enable-checked-mode') != -1,
31 enableUserAssertions: options.indexOf('--enable-checked-mode') != -1, 31 enableUserAssertions: options.indexOf('--enable-checked-mode') != -1,
32 emitJavascript: options.indexOf('--output-type=dart') == -1, 32 emitJavascript: options.indexOf('--output-type=dart') == -1,
33 validateUnparse: options.indexOf('--unparse-validation') !== -1); 33 validateUnparse: options.indexOf('--unparse-validation') !== -1);
34 34
35 elements.LibraryElement scanBuiltinLibrary(String path) { 35 elements.LibraryElement scanBuiltinLibrary(String path) {
36 Uri uri = libraryRoot.resolve(DART2JS_LIBRARY_MAP[path].libraryPath); 36 Uri uri = libraryRoot.resolve(DART2JS_LIBRARY_MAP[path]);
37 elements.LibraryElement library = scanner.loadLibrary(uri, null); 37 elements.LibraryElement library = scanner.loadLibrary(uri, null);
38 return library; 38 return library;
39 } 39 }
40 40
41 void log(message) { 41 void log(message) {
42 handler(null, null, null, message, api.Diagnostic.VERBOSE_INFO); 42 handler(null, null, null, message, api.Diagnostic.VERBOSE_INFO);
43 } 43 }
44 44
45 leg.Script readScript(Uri uri, [tree.Node node]) { 45 leg.Script readScript(Uri uri, [tree.Node node]) {
46 if (uri.scheme == 'dart') uri = translateDartUri(uri, node); 46 if (uri.scheme == 'dart') uri = translateDartUri(uri, node);
(...skipping 16 matching lines...) Expand all
63 } 63 }
64 64
65 Uri translateUri(Uri uri, tree.Node node) { 65 Uri translateUri(Uri uri, tree.Node node) {
66 switch (uri.scheme) { 66 switch (uri.scheme) {
67 case 'package': return translatePackageUri(uri, node); 67 case 'package': return translatePackageUri(uri, node);
68 default: return uri; 68 default: return uri;
69 } 69 }
70 } 70 }
71 71
72 Uri translateDartUri(Uri uri, tree.Node node) { 72 Uri translateDartUri(Uri uri, tree.Node node) {
73 String path = DART2JS_LIBRARY_MAP[uri.path].libraryPath; 73 String path = DART2JS_LIBRARY_MAP[uri.path];
74 if (path === null || uri.path.startsWith('_')) { 74 if (path === null || uri.path.startsWith('_')) {
75 reportError(node, 'library not found ${uri}'); 75 reportError(node, 'library not found ${uri}');
76 return null; 76 return null;
77 } 77 }
78 if (uri.path == 'dom_deprecated' 78 if (uri.path == 'dom_deprecated'
79 || uri.path == 'html' || uri.path == 'io') { 79 || uri.path == 'html' || uri.path == 'io') {
80 // TODO(ahe): Get rid of mockableLibraryUsed when test.dart 80 // TODO(ahe): Get rid of mockableLibraryUsed when test.dart
81 // supports this use case better. 81 // supports this use case better.
82 mockableLibraryUsed = true; 82 mockableLibraryUsed = true;
83 } 83 }
84 return libraryRoot.resolve(path); 84 return libraryRoot.resolve(path);
85 } 85 }
86 86
87 Uri resolvePatchUri(String dartLibraryPath) {
88 String patchPath = DART2JS_LIBRARY_MAP[dartLibraryPath].patchPath;
89 if (patchPath === null) return null;
90 return libraryRoot.resolve(patchPath);
91 }
92
93 translatePackageUri(Uri uri, tree.Node node) => packageRoot.resolve(uri.path); 87 translatePackageUri(Uri uri, tree.Node node) => packageRoot.resolve(uri.path);
94 88
95 bool run(Uri uri) { 89 bool run(Uri uri) {
96 bool success = super.run(uri); 90 bool success = super.run(uri);
97 for (final task in tasks) { 91 for (final task in tasks) {
98 log('${task.name} took ${task.timing}msec'); 92 log('${task.name} took ${task.timing}msec');
99 } 93 }
100 return success; 94 return success;
101 } 95 }
102 96
103 void reportDiagnostic(leg.SourceSpan span, String message, 97 void reportDiagnostic(leg.SourceSpan span, String message,
104 api.Diagnostic kind) { 98 api.Diagnostic kind) {
105 if (kind === api.Diagnostic.ERROR || kind === api.Diagnostic.CRASH) { 99 if (kind === api.Diagnostic.ERROR || kind === api.Diagnostic.CRASH) {
106 compilationFailed = true; 100 compilationFailed = true;
107 } 101 }
108 if (span === null) { 102 if (span === null) {
109 handler(null, null, null, message, kind); 103 handler(null, null, null, message, kind);
110 } else { 104 } else {
111 handler(translateUri(span.uri, null), span.begin, span.end, 105 handler(translateUri(span.uri, null), span.begin, span.end,
112 message, kind); 106 message, kind);
113 } 107 }
114 } 108 }
115 109
116 bool get isMockCompilation() { 110 bool get isMockCompilation() {
117 return mockableLibraryUsed 111 return mockableLibraryUsed
118 && (options.indexOf('--allow-mock-compilation') !== -1); 112 && (options.indexOf('--allow-mock-compilation') !== -1);
119 } 113 }
120 } 114 }
OLDNEW
« no previous file with comments | « no previous file | lib/compiler/implementation/compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698