| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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("../../../leg/leg.dart"); | 7 #import("../../../leg/leg.dart"); |
| 8 #import("../../../leg/elements/elements.dart"); | 8 #import("../../../leg/elements/elements.dart"); |
| 9 #import("../../../leg/tree/tree.dart"); | 9 #import("../../../leg/tree/tree.dart"); |
| 10 #import("../../../leg/util/util.dart"); | 10 #import("../../../leg/util/util.dart"); |
| 11 #import("parser_helper.dart"); | 11 #import("parser_helper.dart"); |
| 12 | 12 |
| 13 class WarningMessage { | 13 class WarningMessage { |
| 14 Node node; | 14 Node node; |
| 15 Message message; | 15 Message message; |
| 16 WarningMessage(this.node, this.message); | 16 WarningMessage(this.node, this.message); |
| 17 |
| 18 toString() => message.toString(); |
| 17 } | 19 } |
| 18 | 20 |
| 19 final String DEFAULT_CORELIB = @''' | 21 final String DEFAULT_CORELIB = @''' |
| 20 lt() {} add(var a, var b) {} sub() {} mul() {} div() {} tdiv() {} mod() {} | 22 lt() {} add(var a, var b) {} sub() {} mul() {} div() {} tdiv() {} mod() {} |
| 21 neg() {} shl() {} shr() {} eq() {} le() {} gt() {} ge() {} | 23 neg() {} shl() {} shr() {} eq() {} le() {} gt() {} ge() {} |
| 22 or() {} and() {} not() {} print(var obj) {} | 24 or() {} and() {} not() {} print(var obj) {} |
| 23 guard$num(x) { return true; } | 25 guard$num(x) { return true; } |
| 24 class int {} | 26 class int {} |
| 25 class double {} | 27 class double {} |
| 26 class bool {} | 28 class bool {} |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 link = link.tail) { | 90 link = link.tail) { |
| 89 universe.define(link.head); | 91 universe.define(link.head); |
| 90 } | 92 } |
| 91 } | 93 } |
| 92 | 94 |
| 93 resolve(ClassElement element) { | 95 resolve(ClassElement element) { |
| 94 return resolver.resolveType(element); | 96 return resolver.resolveType(element); |
| 95 } | 97 } |
| 96 } | 98 } |
| 97 | 99 |
| 100 void compareWarningKinds(String text, expectedWarnings, foundWarnings) { |
| 101 var fail = (message) => Expect.fail('$text: $message'); |
| 102 Iterator<MessageKind> expected = expectedWarnings.iterator(); |
| 103 Iterator<WarningMessage> found = foundWarnings.iterator(); |
| 104 while (expected.hasNext() && found.hasNext()) { |
| 105 Expect.equals(expected.next(), found.next().message.kind); |
| 106 } |
| 107 if (expected.hasNext()) { |
| 108 do { |
| 109 print('Expected warning "${expected.next()}" did not occur'); |
| 110 } while (expected.hasNext()); |
| 111 fail('Too few warnings'); |
| 112 } |
| 113 if (found.hasNext()) { |
| 114 do { |
| 115 print('Additional warning "${found.next()}"'); |
| 116 } while (found.hasNext()); |
| 117 fail('Too many warnings'); |
| 118 } |
| 119 } |
| OLD | NEW |