| 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"); |
| 11 #import("../../../lib/compiler/implementation/universe/universe.dart"); | |
| 12 #import("../../../lib/compiler/implementation/util/util.dart"); | 11 #import("../../../lib/compiler/implementation/util/util.dart"); |
| 13 #import("compiler_helper.dart"); | 12 #import("compiler_helper.dart"); |
| 14 #import("mock_compiler.dart"); | 13 #import("mock_compiler.dart"); |
| 15 #import("parser_helper.dart"); | 14 #import("parser_helper.dart"); |
| 16 | 15 |
| 17 Node buildIdentifier(String name) => new Identifier(scan(name)); | 16 Node buildIdentifier(String name) => new Identifier(scan(name)); |
| 18 | 17 |
| 19 Node buildInitialization(String name) => | 18 Node buildInitialization(String name) => |
| 20 parseBodyCode('$name = 1', | 19 parseBodyCode('$name = 1', |
| 21 (parser, tokens) => parser.parseOptionallyInitializedIdentifier(tokens)); | 20 (parser, tokens) => parser.parseOptionallyInitializedIdentifier(tokens)); |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 String constructor, int expectedElementCount, | 556 String constructor, int expectedElementCount, |
| 558 [List expectedWarnings = const [], | 557 [List expectedWarnings = const [], |
| 559 List expectedErrors = const [], | 558 List expectedErrors = const [], |
| 560 String corelib = DEFAULT_CORELIB]) { | 559 String corelib = DEFAULT_CORELIB]) { |
| 561 MockCompiler compiler = new MockCompiler(corelib); | 560 MockCompiler compiler = new MockCompiler(corelib); |
| 562 compiler.parseScript(script); | 561 compiler.parseScript(script); |
| 563 compiler.resolveStatement(statement); | 562 compiler.resolveStatement(statement); |
| 564 ClassElement classElement = | 563 ClassElement classElement = |
| 565 compiler.mainApp.find(buildSourceString(className)); | 564 compiler.mainApp.find(buildSourceString(className)); |
| 566 Element element = | 565 Element element = |
| 567 classElement.lookupConstructor( | 566 classElement.lookupConstructor(buildSourceString(constructor)); |
| 568 new Selector.callConstructor(buildSourceString(constructor), | |
| 569 statement.getLibrary())); | |
| 570 FunctionExpression tree = element.parseNode(compiler); | 567 FunctionExpression tree = element.parseNode(compiler); |
| 571 ResolverVisitor visitor = new ResolverVisitor(compiler, element); | 568 ResolverVisitor visitor = new ResolverVisitor(compiler, element); |
| 572 new InitializerResolver(visitor).resolveInitializers(element, tree); | 569 new InitializerResolver(visitor).resolveInitializers(element, tree); |
| 573 visitor.visit(tree.body); | 570 visitor.visit(tree.body); |
| 574 Expect.equals(expectedElementCount, map(visitor).length); | 571 Expect.equals(expectedElementCount, map(visitor).length); |
| 575 | 572 |
| 576 compareWarningKinds(script, expectedWarnings, compiler.warnings); | 573 compareWarningKinds(script, expectedWarnings, compiler.warnings); |
| 577 compareWarningKinds(script, expectedErrors, compiler.errors); | 574 compareWarningKinds(script, expectedErrors, compiler.errors); |
| 578 } | 575 } |
| 579 | 576 |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 785 var d = new D(); | 782 var d = new D(); |
| 786 --d; | 783 --d; |
| 787 }"""; | 784 }"""; |
| 788 final compiler = compileScript(script); | 785 final compiler = compileScript(script); |
| 789 | 786 |
| 790 checkMemberResolved(compiler, 'A', operatorName('+', false)); | 787 checkMemberResolved(compiler, 'A', operatorName('+', false)); |
| 791 checkMemberResolved(compiler, 'B', operatorName('+', false)); | 788 checkMemberResolved(compiler, 'B', operatorName('+', false)); |
| 792 checkMemberResolved(compiler, 'C', operatorName('-', false)); | 789 checkMemberResolved(compiler, 'C', operatorName('-', false)); |
| 793 checkMemberResolved(compiler, 'D', operatorName('-', false)); | 790 checkMemberResolved(compiler, 'D', operatorName('-', false)); |
| 794 } | 791 } |
| OLD | NEW |