| 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('dart:uri'); | 5 #import('dart:uri'); |
| 6 | 6 |
| 7 #import("../../../lib/compiler/implementation/leg.dart"); | 7 #import("../../../lib/compiler/implementation/leg.dart"); |
| 8 #import("../../../lib/compiler/implementation/elements/elements.dart"); | 8 #import("../../../lib/compiler/implementation/elements/elements.dart"); |
| 9 #import("../../../lib/compiler/implementation/tree/tree.dart"); | 9 #import("../../../lib/compiler/implementation/tree/tree.dart"); |
| 10 #import("../../../lib/compiler/implementation/scanner/scannerlib.dart"); | 10 #import("../../../lib/compiler/implementation/scanner/scannerlib.dart"); |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 resolveConstructor(String script, String statement, String className, | 555 resolveConstructor(String script, String statement, String className, |
| 556 String constructor, int expectedElementCount, | 556 String constructor, int expectedElementCount, |
| 557 [List expectedWarnings = const [], | 557 [List expectedWarnings = const [], |
| 558 List expectedErrors = const [], | 558 List expectedErrors = const [], |
| 559 String corelib = DEFAULT_CORELIB]) { | 559 String corelib = DEFAULT_CORELIB]) { |
| 560 MockCompiler compiler = new MockCompiler(corelib); | 560 MockCompiler compiler = new MockCompiler(corelib); |
| 561 compiler.parseScript(script); | 561 compiler.parseScript(script); |
| 562 compiler.resolveStatement(statement); | 562 compiler.resolveStatement(statement); |
| 563 ClassElement classElement = | 563 ClassElement classElement = |
| 564 compiler.mainApp.find(buildSourceString(className)); | 564 compiler.mainApp.find(buildSourceString(className)); |
| 565 Element element = | 565 Element element = classElement.lookupConstructor( |
| 566 classElement.lookupConstructor(buildSourceString(constructor)); | 566 new Selector.callDefaultConstructor(buildSourceString(constructor), |
| 567 statement.getLibrary()); |
| 567 FunctionExpression tree = element.parseNode(compiler); | 568 FunctionExpression tree = element.parseNode(compiler); |
| 568 ResolverVisitor visitor = new ResolverVisitor(compiler, element); | 569 ResolverVisitor visitor = new ResolverVisitor(compiler, element); |
| 569 new InitializerResolver(visitor).resolveInitializers(element, tree); | 570 new InitializerResolver(visitor).resolveInitializers(element, tree); |
| 570 visitor.visit(tree.body); | 571 visitor.visit(tree.body); |
| 571 Expect.equals(expectedElementCount, map(visitor).length); | 572 Expect.equals(expectedElementCount, map(visitor).length); |
| 572 | 573 |
| 573 compareWarningKinds(script, expectedWarnings, compiler.warnings); | 574 compareWarningKinds(script, expectedWarnings, compiler.warnings); |
| 574 compareWarningKinds(script, expectedErrors, compiler.errors); | 575 compareWarningKinds(script, expectedErrors, compiler.errors); |
| 575 } | 576 } |
| 576 | 577 |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 782 var d = new D(); | 783 var d = new D(); |
| 783 --d; | 784 --d; |
| 784 }"""; | 785 }"""; |
| 785 final compiler = compileScript(script); | 786 final compiler = compileScript(script); |
| 786 | 787 |
| 787 checkMemberResolved(compiler, 'A', operatorName('+', false)); | 788 checkMemberResolved(compiler, 'A', operatorName('+', false)); |
| 788 checkMemberResolved(compiler, 'B', operatorName('+', false)); | 789 checkMemberResolved(compiler, 'B', operatorName('+', false)); |
| 789 checkMemberResolved(compiler, 'C', operatorName('-', false)); | 790 checkMemberResolved(compiler, 'C', operatorName('-', false)); |
| 790 checkMemberResolved(compiler, 'D', operatorName('-', false)); | 791 checkMemberResolved(compiler, 'D', operatorName('-', false)); |
| 791 } | 792 } |
| OLD | NEW |