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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
98 log('${task.name} took ${task.timing}msec'); | 98 log('${task.name} took ${task.timing}msec'); |
99 } | 99 } |
100 return success; | 100 return success; |
101 } | 101 } |
102 | 102 |
103 void reportDiagnostic(leg.SourceSpan span, String message, | 103 void reportDiagnostic(leg.SourceSpan span, String message, |
104 api.Diagnostic kind) { | 104 api.Diagnostic kind) { |
105 if (kind === api.Diagnostic.ERROR || kind === api.Diagnostic.CRASH) { | 105 if (kind === api.Diagnostic.ERROR || kind === api.Diagnostic.CRASH) { |
106 compilationFailed = true; | 106 compilationFailed = true; |
107 } | 107 } |
108 if (span === null) { | 108 // [:span.uri:] might be [:null:] in case of a [Script] with no [uri]. For |
ahe
2012/08/02 19:56:23
Actually, span.uri may not be null...
| |
109 // instance in the [Types] constructor in typechecker.dart. | |
ahe
2012/08/02 19:56:23
... because Types shouldn't do that :-)
| |
110 if (span === null || span.uri === null) { | |
109 handler(null, null, null, message, kind); | 111 handler(null, null, null, message, kind); |
110 } else { | 112 } else { |
111 handler(translateUri(span.uri, null), span.begin, span.end, | 113 handler(translateUri(span.uri, null), span.begin, span.end, |
112 message, kind); | 114 message, kind); |
113 } | 115 } |
114 } | 116 } |
115 | 117 |
116 bool get isMockCompilation() { | 118 bool get isMockCompilation() { |
117 return mockableLibraryUsed | 119 return mockableLibraryUsed |
118 && (options.indexOf('--allow-mock-compilation') !== -1); | 120 && (options.indexOf('--allow-mock-compilation') !== -1); |
119 } | 121 } |
120 } | 122 } |
OLD | NEW |