| 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 mock_compiler; | 5 library mock_compiler; |
| 6 | 6 |
| 7 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
| 8 import 'dart:async'; | 8 import 'dart:async'; |
| 9 import 'dart:collection'; | 9 import 'dart:collection'; |
| 10 | 10 |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 * library. | 159 * library. |
| 160 */ | 160 */ |
| 161 void registerSource(Uri uri, String source) { | 161 void registerSource(Uri uri, String source) { |
| 162 sourceFiles[uri.toString()] = new MockFile(source); | 162 sourceFiles[uri.toString()] = new MockFile(source); |
| 163 } | 163 } |
| 164 | 164 |
| 165 // TODO(johnniwinther): Remove this when we don't filter certain type checker | 165 // TODO(johnniwinther): Remove this when we don't filter certain type checker |
| 166 // warnings. | 166 // warnings. |
| 167 void reportWarning(Spannable node, MessageKind messageKind, | 167 void reportWarning(Spannable node, MessageKind messageKind, |
| 168 [Map arguments = const {}]) { | 168 [Map arguments = const {}]) { |
| 169 MessageTemplate template = MessageTemplate.TEMPLATES[messageKind]; |
| 169 reportDiagnostic(node, | 170 reportDiagnostic(node, |
| 170 messageKind.message(arguments, terseDiagnostics), | 171 template.message(arguments, terseDiagnostics), |
| 171 api.Diagnostic.WARNING); | 172 api.Diagnostic.WARNING); |
| 172 } | 173 } |
| 173 | 174 |
| 174 void reportDiagnostic(Spannable node, | 175 void reportDiagnostic(Spannable node, |
| 175 Message message, | 176 Message message, |
| 176 api.Diagnostic kind) { | 177 api.Diagnostic kind) { |
| 177 var diagnostic = new WarningMessage(node, message); | 178 var diagnostic = new WarningMessage(node, message); |
| 178 if (kind == api.Diagnostic.CRASH) { | 179 if (kind == api.Diagnostic.CRASH) { |
| 179 crashes.add(diagnostic); | 180 crashes.add(diagnostic); |
| 180 } else if (kind == api.Diagnostic.ERROR) { | 181 } else if (kind == api.Diagnostic.ERROR) { |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 MockElement(Element enclosingElement) | 402 MockElement(Element enclosingElement) |
| 402 : super('', ElementKind.FUNCTION, Modifiers.EMPTY, | 403 : super('', ElementKind.FUNCTION, Modifiers.EMPTY, |
| 403 enclosingElement); | 404 enclosingElement); |
| 404 | 405 |
| 405 get node => null; | 406 get node => null; |
| 406 | 407 |
| 407 parseNode(_) => null; | 408 parseNode(_) => null; |
| 408 | 409 |
| 409 bool get hasNode => false; | 410 bool get hasNode => false; |
| 410 } | 411 } |
| OLD | NEW |