| OLD | NEW |
| 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 16 matching lines...) Expand all Loading... |
| 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].libraryPath); |
| 37 elements.LibraryElement library = scanner.loadLibrary(uri, null); | 37 Uri canonicalUri; |
| 38 if (path.startsWith("_")) { |
| 39 canonicalUri = uri; |
| 40 } else { |
| 41 canonicalUri = new Uri.fromComponents(scheme: "dart", path: path); |
| 42 } |
| 43 elements.LibraryElement library = |
| 44 scanner.loadLibrary(uri, null, canonicalUri); |
| 38 return library; | 45 return library; |
| 39 } | 46 } |
| 40 | 47 |
| 41 void log(message) { | 48 void log(message) { |
| 42 handler(null, null, null, message, api.Diagnostic.VERBOSE_INFO); | 49 handler(null, null, null, message, api.Diagnostic.VERBOSE_INFO); |
| 43 } | 50 } |
| 44 | 51 |
| 45 leg.Script readScript(Uri uri, [tree.Node node]) { | 52 leg.Script readScript(Uri uri, [tree.Node node]) { |
| 46 if (uri.scheme == 'dart') uri = translateDartUri(uri, node); | 53 if (uri.scheme == 'dart') uri = translateDartUri(uri, node); |
| 47 var translated = translateUri(uri, node); | 54 var translated = translateUri(uri, node); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 handler(translateUri(span.uri, null), span.begin, span.end, | 120 handler(translateUri(span.uri, null), span.begin, span.end, |
| 114 message, kind); | 121 message, kind); |
| 115 } | 122 } |
| 116 } | 123 } |
| 117 | 124 |
| 118 bool get isMockCompilation() { | 125 bool get isMockCompilation() { |
| 119 return mockableLibraryUsed | 126 return mockableLibraryUsed |
| 120 && (options.indexOf('--allow-mock-compilation') !== -1); | 127 && (options.indexOf('--allow-mock-compilation') !== -1); |
| 121 } | 128 } |
| 122 } | 129 } |
| OLD | NEW |