| 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'); |
| 11 #import('tree/tree.dart', prefix: 'tree'); | 11 #import('tree/tree.dart', prefix: 'tree'); |
| 12 #import('elements/elements.dart', prefix: 'elements'); | 12 #import('elements/elements.dart', prefix: 'elements'); |
| 13 #import('ssa/tracer.dart', prefix: 'ssa'); | 13 #import('ssa/tracer.dart', prefix: 'ssa'); |
| 14 #import('library_map.dart'); | 14 #import('library_map.dart'); |
| 15 #import('source_file.dart'); | 15 #import('source_file.dart'); |
| 16 | 16 |
| 17 class Compiler extends leg.Compiler { | 17 class Compiler extends leg.Compiler { |
| 18 api.ReadUriFromString provider; | 18 api.ReadUriFromString provider; |
| 19 api.DiagnosticHandler handler; | 19 api.DiagnosticHandler handler; |
| 20 Uri libraryRoot; | 20 Uri libraryRoot; |
| 21 Uri packageRoot; | 21 Uri packageRoot; |
| 22 List<String> options; | 22 List<String> options; |
| 23 bool mockableLibraryUsed = false; | 23 bool mockableLibraryUsed = false; |
| 24 | 24 |
| 25 Compiler(this.provider, this.handler, this.libraryRoot, List<String> options) | 25 Compiler(this.provider, this.handler, this.libraryRoot, List<String> options) |
| 26 : this.options = options, | 26 : this.options = options, |
| 27 super( | 27 super( |
| 28 tracer: new ssa.HTracer(), | 28 tracer: new ssa.HTracer(), |
| 29 enableTypeAssertions: options.indexOf('--enable-checked-mode') != -1, | 29 enableTypeAssertions: options.indexOf('--enable-checked-mode') != -1, |
| 30 emitJavascript: options.indexOf('--output-type=dart') == -1); | 30 emitJavascript: options.indexOf('--output-type=dart') == -1, |
| 31 validateUnparse: options.indexOf('--unparse-validation') !== -1); |
| 31 | 32 |
| 32 elements.LibraryElement scanBuiltinLibrary(String path) { | 33 elements.LibraryElement scanBuiltinLibrary(String path) { |
| 33 Uri uri = libraryRoot.resolve(DART2JS_LIBRARY_MAP[path]); | 34 Uri uri = libraryRoot.resolve(DART2JS_LIBRARY_MAP[path]); |
| 34 elements.LibraryElement library = scanner.loadLibrary(uri, null); | 35 elements.LibraryElement library = scanner.loadLibrary(uri, null); |
| 35 return library; | 36 return library; |
| 36 } | 37 } |
| 37 | 38 |
| 38 void log(message) { | 39 void log(message) { |
| 39 handler(null, null, null, message, false); | 40 handler(null, null, null, message, false); |
| 40 } | 41 } |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 } else { | 100 } else { |
| 100 handler(span.uri, span.begin, span.end, message, fatal); | 101 handler(span.uri, span.begin, span.end, message, fatal); |
| 101 } | 102 } |
| 102 } | 103 } |
| 103 | 104 |
| 104 bool get isMockCompilation() { | 105 bool get isMockCompilation() { |
| 105 return mockableLibraryUsed | 106 return mockableLibraryUsed |
| 106 && (options.indexOf('--allow-mock-compilation') !== -1); | 107 && (options.indexOf('--allow-mock-compilation') !== -1); |
| 107 } | 108 } |
| 108 } | 109 } |
| OLD | NEW |