Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 // Unit test of the [NativeBehavior.processSpecString] method. | 5 // Unit test of the [NativeBehavior.processSpecString] method. |
| 6 | 6 |
| 7 import 'package:expect/expect.dart'; | 7 import 'package:expect/expect.dart'; |
| 8 import 'package:compiler/src/native/native.dart'; | 8 import 'package:compiler/src/native/native.dart'; |
| 9 import 'package:compiler/src/diagnostics/diagnostic_listener.dart'; | 9 import 'package:compiler/src/diagnostics/diagnostic_listener.dart'; |
| 10 import 'package:compiler/src/diagnostics/messages.dart'; | 10 import 'package:compiler/src/diagnostics/messages.dart'; |
| 11 import 'package:compiler/src/universe/side_effects.dart' | 11 import 'package:compiler/src/universe/side_effects.dart' |
| 12 show SideEffects; | 12 show SideEffects; |
| 13 | 13 |
| 14 const OBJECT = 'Object'; | 14 const OBJECT = 'Object'; |
| 15 const NULL = 'Null'; | 15 const NULL = 'Null'; |
| 16 | 16 |
| 17 class Listener extends DiagnosticReporter { | 17 class Listener extends DiagnosticReporter { |
| 18 String errorMessage; | 18 String errorMessage; |
| 19 internalError(spannable, message) { | 19 internalError(spannable, message) { |
| 20 errorMessage = message; | 20 errorMessage = message; |
| 21 throw "error"; | 21 throw "error"; |
| 22 } | 22 } |
| 23 reportError(message, [infos]) { | |
| 24 | 23 |
| 24 reportError(message, [infos = const <DiagnosticMessage>[]]) { | |
|
Johnni Winther
2016/06/30 11:09:33
Analyzer warnings that popped up during developmen
| |
| 25 errorMessage = | 25 errorMessage = |
| 26 '${message.message.arguments}'; // E.g. "{text: Duplicate tag 'new'.}" | 26 '${message.message.arguments}'; // E.g. "{text: Duplicate tag 'new'.}" |
| 27 throw "error"; | 27 throw "error"; |
| 28 } | 28 } |
| 29 | 29 |
| 30 @override | 30 @override |
| 31 DiagnosticMessage createMessage(spannable, messageKind, [arguments]) { | 31 DiagnosticMessage createMessage(spannable, messageKind, |
| 32 [arguments = const {}]) { | |
|
Johnni Winther
2016/06/30 11:09:33
Ditto
| |
| 32 return new DiagnosticMessage(null, spannable, | 33 return new DiagnosticMessage(null, spannable, |
| 33 MessageTemplate.TEMPLATES[messageKind].message(arguments)); | 34 MessageTemplate.TEMPLATES[messageKind].message(arguments)); |
| 34 } | 35 } |
| 35 | 36 |
| 36 noSuchMethod(_) => null; | 37 noSuchMethod(_) => null; |
| 37 } | 38 } |
| 38 | 39 |
| 39 void test(String specString, | 40 void test(String specString, |
| 40 {List returns, | 41 {List returns, |
| 41 List creates, | 42 List creates, |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 305 test('gvn:false', expectedGvn: false); | 306 test('gvn:false', expectedGvn: false); |
| 306 test('returns:A;gvn:true', returns: ['A'], expectedGvn: true); | 307 test('returns:A;gvn:true', returns: ['A'], expectedGvn: true); |
| 307 test(' gvn : true ; returns:A;', returns: ['A'], expectedGvn: true); | 308 test(' gvn : true ; returns:A;', returns: ['A'], expectedGvn: true); |
| 308 test('gvn:true;returns:A;gvn:true', expectError: true); | 309 test('gvn:true;returns:A;gvn:true', expectError: true); |
| 309 | 310 |
| 310 test('gvn: true; new: true', expectError: true); | 311 test('gvn: true; new: true', expectError: true); |
| 311 test('gvn: true; new: false', expectedGvn: true, expectedNew: false); | 312 test('gvn: true; new: false', expectedGvn: true, expectedNew: false); |
| 312 test('gvn: false; new: true', expectedGvn: false, expectedNew: true); | 313 test('gvn: false; new: true', expectedGvn: false, expectedNew: true); |
| 313 test('gvn: false; new: false', expectedGvn: false, expectedNew: false); | 314 test('gvn: false; new: false', expectedGvn: false, expectedNew: false); |
| 314 } | 315 } |
| OLD | NEW |