| 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 #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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 resolveConstructor(String script, String statement, String className, | 427 resolveConstructor(String script, String statement, String className, |
| 428 String constructor, int expectedElementCount, | 428 String constructor, int expectedElementCount, |
| 429 [List expectedWarnings = const [], | 429 [List expectedWarnings = const [], |
| 430 List expectedErrors = const []]) { | 430 List expectedErrors = const []]) { |
| 431 MockCompiler compiler = new MockCompiler(); | 431 MockCompiler compiler = new MockCompiler(); |
| 432 compiler.parseScript(script); | 432 compiler.parseScript(script); |
| 433 compiler.resolveStatement(statement); | 433 compiler.resolveStatement(statement); |
| 434 ClassElement classElement = | 434 ClassElement classElement = |
| 435 compiler.universe.find(buildSourceString(className)); | 435 compiler.universe.find(buildSourceString(className)); |
| 436 Element element = | 436 Element element = |
| 437 classElement.lookupLocalElement(buildSourceString(constructor)); | 437 classElement.lookupConstructor(buildSourceString(constructor)); |
| 438 FunctionExpression tree = element.parseNode(compiler, compiler); | 438 FunctionExpression tree = element.parseNode(compiler, compiler); |
| 439 ResolverVisitor visitor = new FullResolverVisitor(compiler, element); | 439 ResolverVisitor visitor = new FullResolverVisitor(compiler, element); |
| 440 compiler.resolver.resolveInitializers(element, tree, visitor); | 440 compiler.resolver.resolveInitializers(element, tree, visitor); |
| 441 Expect.equals(expectedElementCount, visitor.mapping.map.length); | 441 Expect.equals(expectedElementCount, visitor.mapping.map.length); |
| 442 | 442 |
| 443 compareWarningKinds(script, expectedWarnings, compiler.warnings); | 443 compareWarningKinds(script, expectedWarnings, compiler.warnings); |
| 444 compareWarningKinds(script, expectedErrors, compiler.errors); | 444 compareWarningKinds(script, expectedErrors, compiler.errors); |
| 445 } | 445 } |
| 446 | 446 |
| 447 testInitializers() { | 447 testInitializers() { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 478 int bar; | 478 int bar; |
| 479 A() : this.foo = bar; | 479 A() : this.foo = bar; |
| 480 }"""; | 480 }"""; |
| 481 resolveConstructor(script, "A a = new A();", "A", "A", 2, | 481 resolveConstructor(script, "A a = new A();", "A", "A", 2, |
| 482 [], [MessageKind.NOT_STATIC]); | 482 [], [MessageKind.NOT_STATIC]); |
| 483 } | 483 } |
| 484 | 484 |
| 485 length(Link link) => link.isEmpty() ? 0 : length(link.tail) + 1; | 485 length(Link link) => link.isEmpty() ? 0 : length(link.tail) + 1; |
| 486 | 486 |
| 487 at(Link link, int index) => (index == 0) ? link.head : at(link.tail, index - 1); | 487 at(Link link, int index) => (index == 0) ? link.head : at(link.tail, index - 1); |
| OLD | NEW |