| 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 #import("../../../lib/compiler/implementation/leg.dart"); | 5 #import("../../../lib/compiler/implementation/leg.dart"); |
| 6 #import("../../../lib/compiler/implementation/elements/elements.dart"); | 6 #import("../../../lib/compiler/implementation/elements/elements.dart"); |
| 7 #import("../../../lib/compiler/implementation/tree/tree.dart"); | 7 #import("../../../lib/compiler/implementation/tree/tree.dart"); |
| 8 #import("../../../lib/compiler/implementation/util/util.dart"); | 8 #import("../../../lib/compiler/implementation/util/util.dart"); |
| 9 #import("mock_compiler.dart"); | 9 #import("mock_compiler.dart"); |
| 10 #import("parser_helper.dart"); | 10 #import("parser_helper.dart"); |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 // for (int i = 0; i < 10; i = i + 1) { i = 5; }; | 352 // for (int i = 0; i < 10; i = i + 1) { i = 5; }; |
| 353 // ^ | 353 // ^ |
| 354 checkIdentifier(iElement, nodes[8], elements[8]); | 354 checkIdentifier(iElement, nodes[8], elements[8]); |
| 355 | 355 |
| 356 // for (int i = 0; i < 10; i = i + 1) { i = 5; }; | 356 // for (int i = 0; i < 10; i = i + 1) { i = 5; }; |
| 357 // ^^^^^ | 357 // ^^^^^ |
| 358 checkSendSet(iElement, nodes[9], elements[9]); | 358 checkSendSet(iElement, nodes[9], elements[9]); |
| 359 } | 359 } |
| 360 | 360 |
| 361 checkIdentifier(Element expected, Node node, Element actual) { | 361 checkIdentifier(Element expected, Node node, Element actual) { |
| 362 Expect.isTrue(node is Identifier, node.toDebugString()); | 362 Expect.isTrue(node is Identifier, node.toString()); |
| 363 Expect.equals(expected, actual); | 363 Expect.equals(expected, actual); |
| 364 } | 364 } |
| 365 | 365 |
| 366 checkSend(Element expected, Node node, Element actual) { | 366 checkSend(Element expected, Node node, Element actual) { |
| 367 Expect.isTrue(node is Send, node.toDebugString()); | 367 Expect.isTrue(node is Send, node.toString()); |
| 368 Expect.isTrue(node is !SendSet, node.toDebugString()); | 368 Expect.isTrue(node is !SendSet, node.toString()); |
| 369 Expect.equals(expected, actual); | 369 Expect.equals(expected, actual); |
| 370 } | 370 } |
| 371 | 371 |
| 372 checkSendSet(Element expected, Node node, Element actual) { | 372 checkSendSet(Element expected, Node node, Element actual) { |
| 373 Expect.isTrue(node is SendSet, node.toDebugString()); | 373 Expect.isTrue(node is SendSet, node.toString()); |
| 374 Expect.equals(expected, actual); | 374 Expect.equals(expected, actual); |
| 375 } | 375 } |
| 376 | 376 |
| 377 testTypeAnnotation() { | 377 testTypeAnnotation() { |
| 378 MockCompiler compiler = new MockCompiler(); | 378 MockCompiler compiler = new MockCompiler(); |
| 379 String statement = "Foo bar;"; | 379 String statement = "Foo bar;"; |
| 380 | 380 |
| 381 // Test that we get a warning when Foo is not defined. | 381 // Test that we get a warning when Foo is not defined. |
| 382 Map mapping = compiler.resolveStatement(statement).map; | 382 Map mapping = compiler.resolveStatement(statement).map; |
| 383 | 383 |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 length(Link link) => link.isEmpty() ? 0 : length(link.tail) + 1; | 711 length(Link link) => link.isEmpty() ? 0 : length(link.tail) + 1; |
| 712 | 712 |
| 713 at(Link link, int index) => (index == 0) ? link.head : at(link.tail, index - 1); | 713 at(Link link, int index) => (index == 0) ? link.head : at(link.tail, index - 1); |
| 714 | 714 |
| 715 List<String> asSortedStrings(Link link) { | 715 List<String> asSortedStrings(Link link) { |
| 716 List<String> result = <String>[]; | 716 List<String> result = <String>[]; |
| 717 for (; !link.isEmpty(); link = link.tail) result.add(link.head.toString()); | 717 for (; !link.isEmpty(); link = link.tail) result.add(link.head.toString()); |
| 718 result.sort((s1, s2) => s1.compareTo(s2)); | 718 result.sort((s1, s2) => s1.compareTo(s2)); |
| 719 return result; | 719 return result; |
| 720 } | 720 } |
| OLD | NEW |