Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(780)

Side by Side Diff: tests/compiler/dart2js/resolver_test.dart

Issue 266913017: Convert property methods into getters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 import 'dart:async'; 6 import 'dart:async';
7 import "package:async_helper/async_helper.dart"; 7 import "package:async_helper/async_helper.dart";
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import "../../../sdk/lib/_internal/compiler/implementation/resolution/resolution .dart"; 10 import "../../../sdk/lib/_internal/compiler/implementation/resolution/resolution .dart";
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 VariableElementX bElement = compiler.mainApp.find("b"); 624 VariableElementX bElement = compiler.mainApp.find("b");
625 VariableElementX cElement = compiler.mainApp.find("c"); 625 VariableElementX cElement = compiler.mainApp.find("c");
626 Expect.equals(ElementKind.FIELD, bElement.kind); 626 Expect.equals(ElementKind.FIELD, bElement.kind);
627 Expect.equals(ElementKind.FIELD, cElement.kind); 627 Expect.equals(ElementKind.FIELD, cElement.kind);
628 Expect.isTrue(bElement != cElement); 628 Expect.isTrue(bElement != cElement);
629 629
630 VariableDefinitions bNode = bElement.variables.parseNode(bElement, compiler); 630 VariableDefinitions bNode = bElement.variables.parseNode(bElement, compiler);
631 VariableDefinitions cNode = cElement.variables.parseNode(cElement, compiler); 631 VariableDefinitions cNode = cElement.variables.parseNode(cElement, compiler);
632 Expect.equals(bNode, cNode); 632 Expect.equals(bNode, cNode);
633 Expect.isNull(bNode.type); 633 Expect.isNull(bNode.type);
634 Expect.isTrue(bNode.modifiers.isVar()); 634 Expect.isTrue(bNode.modifiers.isVar);
635 } 635 }
636 636
637 resolveConstructor(String script, String statement, String className, 637 resolveConstructor(String script, String statement, String className,
638 String constructor, int expectedElementCount, 638 String constructor, int expectedElementCount,
639 {List expectedWarnings: const [], 639 {List expectedWarnings: const [],
640 List expectedErrors: const [], 640 List expectedErrors: const [],
641 List expectedInfos: const [], 641 List expectedInfos: const [],
642 String corelib: DEFAULT_CORELIB}) { 642 String corelib: DEFAULT_CORELIB}) {
643 MockCompiler compiler = new MockCompiler(coreSource: corelib); 643 MockCompiler compiler = new MockCompiler(coreSource: corelib);
644 compiler.parseScript(script); 644 compiler.parseScript(script);
645 compiler.resolveStatement(statement); 645 compiler.resolveStatement(statement);
646 ClassElement classElement = compiler.mainApp.find(className); 646 ClassElement classElement = compiler.mainApp.find(className);
647 Element element; 647 Element element;
648 if (constructor != '') { 648 if (constructor != '') {
649 element = classElement.lookupConstructor( 649 element = classElement.lookupConstructor(
650 new Selector.callConstructor(constructor, classElement.getLibrary())); 650 new Selector.callConstructor(constructor, classElement.library));
651 } else { 651 } else {
652 element = classElement.lookupConstructor( 652 element = classElement.lookupConstructor(
653 new Selector.callDefaultConstructor(classElement.getLibrary())); 653 new Selector.callDefaultConstructor(classElement.library));
654 } 654 }
655 655
656 FunctionExpression tree = element.parseNode(compiler); 656 FunctionExpression tree = element.parseNode(compiler);
657 ResolverVisitor visitor = 657 ResolverVisitor visitor =
658 new ResolverVisitor(compiler, element, 658 new ResolverVisitor(compiler, element,
659 new CollectingTreeElements(element)); 659 new CollectingTreeElements(element));
660 new InitializerResolver(visitor).resolveInitializers(element, tree); 660 new InitializerResolver(visitor).resolveInitializers(element, tree);
661 visitor.visit(tree.body); 661 visitor.visit(tree.body);
662 Expect.equals(expectedElementCount, map(visitor).length); 662 Expect.equals(expectedElementCount, map(visitor).length);
663 663
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
1011 }"""; 1011 }""";
1012 asyncTest(() => compileScript(script2).then((compiler) { 1012 asyncTest(() => compileScript(script2).then((compiler) {
1013 expect(compiler, 1013 expect(compiler,
1014 [MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS], 1014 [MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS],
1015 [MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_CONSTRUCTOR, 1015 [MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_CONSTRUCTOR,
1016 MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_CONSTRUCTOR, 1016 MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_CONSTRUCTOR,
1017 MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_FIELD, 1017 MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_FIELD,
1018 MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_FIELD]); 1018 MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_FIELD]);
1019 })); 1019 }));
1020 } 1020 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/reexport_handled_test.dart ('k') | tests/compiler/dart2js/type_checker_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698