| 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("../../../leg/leg.dart"); | 5 #import("../../../leg/leg.dart"); |
| 6 #import("../../../leg/elements/elements.dart"); | 6 #import("../../../leg/elements/elements.dart"); |
| 7 #import("../../../leg/tree/tree.dart"); | 7 #import("../../../leg/tree/tree.dart"); |
| 8 #import("../../../leg/util/util.dart"); | 8 #import("../../../leg/util/util.dart"); |
| 9 #import("mock_compiler.dart"); | 9 #import("mock_compiler.dart"); |
| 10 #import("parser_helper.dart"); | 10 #import("parser_helper.dart"); |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 Expect.isTrue(element is SynthesizedConstructorElement); | 421 Expect.isTrue(element is SynthesizedConstructorElement); |
| 422 } | 422 } |
| 423 | 423 |
| 424 testTopLevelFields() { | 424 testTopLevelFields() { |
| 425 MockCompiler compiler = new MockCompiler(); | 425 MockCompiler compiler = new MockCompiler(); |
| 426 compiler.parseScript("int a;"); | 426 compiler.parseScript("int a;"); |
| 427 VariableElement element = compiler.mainApp.find(buildSourceString("a")); | 427 VariableElement element = compiler.mainApp.find(buildSourceString("a")); |
| 428 Expect.equals(ElementKind.FIELD, element.kind); | 428 Expect.equals(ElementKind.FIELD, element.kind); |
| 429 VariableDefinitions node = element.variables.parseNode(compiler); | 429 VariableDefinitions node = element.variables.parseNode(compiler); |
| 430 Identifier typeName = node.type.typeName; | 430 Identifier typeName = node.type.typeName; |
| 431 Expect.equals(typeName.source.stringValue, 'int'); | 431 Expect.equals(typeName.source.slowToString(), 'int'); |
| 432 | 432 |
| 433 compiler.parseScript("var b, c;"); | 433 compiler.parseScript("var b, c;"); |
| 434 VariableElement bElement = compiler.mainApp.find(buildSourceString("b")); | 434 VariableElement bElement = compiler.mainApp.find(buildSourceString("b")); |
| 435 VariableElement cElement = compiler.mainApp.find(buildSourceString("c")); | 435 VariableElement cElement = compiler.mainApp.find(buildSourceString("c")); |
| 436 Expect.equals(ElementKind.FIELD, bElement.kind); | 436 Expect.equals(ElementKind.FIELD, bElement.kind); |
| 437 Expect.equals(ElementKind.FIELD, cElement.kind); | 437 Expect.equals(ElementKind.FIELD, cElement.kind); |
| 438 Expect.isTrue(bElement != cElement); | 438 Expect.isTrue(bElement != cElement); |
| 439 | 439 |
| 440 VariableDefinitions bNode = bElement.variables.parseNode(compiler); | 440 VariableDefinitions bNode = bElement.variables.parseNode(compiler); |
| 441 VariableDefinitions cNode = cElement.variables.parseNode(compiler); | 441 VariableDefinitions cNode = cElement.variables.parseNode(compiler); |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 length(Link link) => link.isEmpty() ? 0 : length(link.tail) + 1; | 600 length(Link link) => link.isEmpty() ? 0 : length(link.tail) + 1; |
| 601 | 601 |
| 602 at(Link link, int index) => (index == 0) ? link.head : at(link.tail, index - 1); | 602 at(Link link, int index) => (index == 0) ? link.head : at(link.tail, index - 1); |
| 603 | 603 |
| 604 List<String> asSortedStrings(Link link) { | 604 List<String> asSortedStrings(Link link) { |
| 605 List<String> result = <String>[]; | 605 List<String> result = <String>[]; |
| 606 for (; !link.isEmpty(); link = link.tail) result.add(link.head.toString()); | 606 for (; !link.isEmpty(); link = link.tail) result.add(link.head.toString()); |
| 607 result.sort((s1, s2) => s1.compareTo(s2)); | 607 result.sort((s1, s2) => s1.compareTo(s2)); |
| 608 return result; | 608 return result; |
| 609 } | 609 } |
| OLD | NEW |