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

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

Issue 9873021: Move frog/leg to lib/compiler/implementation. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 8 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 | « lib/compiler/compiler.dart ('k') | lib/compiler/implementation/dart2js.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('leg.dart', prefix: 'leg'); 7 #import('leg.dart', prefix: 'leg');
8 #import('elements/elements.dart', prefix: 'leg'); 8 #import('elements/elements.dart', prefix: 'leg');
9 #import('tree/tree.dart', prefix: 'leg'); 9 #import('tree/tree.dart', prefix: 'leg');
10 #import('ssa/tracer.dart', prefix: 'ssa'); 10 #import('ssa/tracer.dart', prefix: 'ssa');
11 #import('../lang.dart', prefix: 'frog'); 11 // TODO(ahe): Remove dependency on frog.
12 #import('api.dart'); 12 #import('../../../frog/lang.dart', prefix: 'frog');
13 #import('../../lib/uri/uri.dart'); 13 #import('../compiler.dart');
14 #import('../../uri/uri.dart');
14 15
15 class Compiler extends leg.Compiler { 16 class Compiler extends leg.Compiler {
16 ReadUriFromString provider; 17 ReadUriFromString provider;
17 DiagnosticHandler handler; 18 DiagnosticHandler handler;
18 Uri libraryRoot; 19 Uri libraryRoot;
19 List<String> options; 20 List<String> options;
20 bool mockableLibraryUsed = false; 21 bool mockableLibraryUsed = false;
21 22
22 Compiler(this.provider, this.handler, this.libraryRoot, this.options) 23 Compiler(this.provider, this.handler, this.libraryRoot, this.options)
23 : super.withCurrentDirectory(null, tracer: new ssa.HTracer()); 24 : super.withCurrentDirectory(null, tracer: new ssa.HTracer());
(...skipping 22 matching lines...) Expand all
46 } 47 }
47 frog.SourceFile sourceFile = new frog.SourceFile(uri.toString(), text); 48 frog.SourceFile sourceFile = new frog.SourceFile(uri.toString(), text);
48 return new leg.Script(uri, sourceFile); 49 return new leg.Script(uri, sourceFile);
49 } 50 }
50 51
51 translateDartUri(Uri uri, leg.ScriptTag node) { 52 translateDartUri(Uri uri, leg.ScriptTag node) {
52 String uriName = uri.toString(); 53 String uriName = uri.toString();
53 // TODO(ahe): Clean this up. 54 // TODO(ahe): Clean this up.
54 if (uriName == 'dart:dom') { 55 if (uriName == 'dart:dom') {
55 mockableLibraryUsed = true; 56 mockableLibraryUsed = true;
56 return libraryRoot.resolve('../../../lib/dom/frog/dom_frog.dart'); 57 return libraryRoot.resolve('../../../../lib/dom/frog/dom_frog.dart');
57 } else if (uriName == 'dart:html') { 58 } else if (uriName == 'dart:html') {
58 mockableLibraryUsed = true; 59 mockableLibraryUsed = true;
59 return libraryRoot.resolve('../../../lib/html/frog/html_frog.dart'); 60 return libraryRoot.resolve('../../../../lib/html/frog/html_frog.dart');
60 } else if (uriName == 'dart:json') { 61 } else if (uriName == 'dart:json') {
61 return libraryRoot.resolve('../../../lib/json/json.dart'); 62 return libraryRoot.resolve('../../../../lib/json/json.dart');
62 } else if (uriName == 'dart:isolate') { 63 } else if (uriName == 'dart:isolate') {
63 return libraryRoot.resolve('../../../lib/isolate/isolate_leg.dart'); 64 return libraryRoot.resolve('../../../../lib/isolate/isolate_leg.dart');
64 } else if (uriName == 'dart:io') { 65 } else if (uriName == 'dart:io') {
65 mockableLibraryUsed = true; 66 mockableLibraryUsed = true;
66 return libraryRoot.resolve('io.dart'); 67 return libraryRoot.resolve('io.dart');
67 } else if (uriName == 'dart:utf') { 68 } else if (uriName == 'dart:utf') {
68 return libraryRoot.resolve('../../../lib/utf/utf.dart'); 69 return libraryRoot.resolve('../../../../lib/utf/utf.dart');
69 } else if (uriName == 'dart:uri') { 70 } else if (uriName == 'dart:uri') {
70 return libraryRoot.resolve('../../../lib/uri/uri.dart'); 71 return libraryRoot.resolve('../../../../lib/uri/uri.dart');
71 } 72 }
72 reportError(node, "library not found $uriName"); 73 reportError(node, "library not found $uriName");
73 } 74 }
74 75
75 bool run(Uri uri) { 76 bool run(Uri uri) {
76 bool success = super.run(uri); 77 bool success = super.run(uri);
77 for (final task in tasks) { 78 for (final task in tasks) {
78 log('${task.name} took ${task.timing}msec'); 79 log('${task.name} took ${task.timing}msec');
79 } 80 }
80 return success; 81 return success;
81 } 82 }
82 83
83 void reportDiagnostic(leg.SourceSpan span, String message, bool fatal) { 84 void reportDiagnostic(leg.SourceSpan span, String message, bool fatal) {
84 if (span === null) { 85 if (span === null) {
85 handler(null, null, null, message, fatal); 86 handler(null, null, null, message, fatal);
86 } else { 87 } else {
87 handler(span.uri, span.begin, span.end, message, fatal); 88 handler(span.uri, span.begin, span.end, message, fatal);
88 } 89 }
89 } 90 }
90 91
91 bool get isMockCompilation() { 92 bool get isMockCompilation() {
92 return mockableLibraryUsed 93 return mockableLibraryUsed
93 && (options.indexOf('--allow-mock-compilation') !== -1); 94 && (options.indexOf('--allow-mock-compilation') !== -1);
94 } 95 }
95 } 96 }
OLDNEW
« no previous file with comments | « lib/compiler/compiler.dart ('k') | lib/compiler/implementation/dart2js.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698