Chromium Code Reviews| 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 "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 "package:compiler/src/resolution/resolution.dart"; | 10 import "package:compiler/src/resolution/resolution.dart"; |
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 679 List expectedErrors: const [], | 679 List expectedErrors: const [], |
| 680 List expectedInfos: const [], | 680 List expectedInfos: const [], |
| 681 Map<String, String> corelib}) { | 681 Map<String, String> corelib}) { |
| 682 MockCompiler compiler = new MockCompiler.internal(coreSource: corelib); | 682 MockCompiler compiler = new MockCompiler.internal(coreSource: corelib); |
| 683 return compiler.init().then((_) { | 683 return compiler.init().then((_) { |
| 684 compiler.parseScript(script); | 684 compiler.parseScript(script); |
| 685 compiler.resolveStatement(statement); | 685 compiler.resolveStatement(statement); |
| 686 ClassElement classElement = compiler.mainApp.find(className); | 686 ClassElement classElement = compiler.mainApp.find(className); |
| 687 Element element; | 687 Element element; |
| 688 if (constructor != '') { | 688 if (constructor != '') { |
| 689 element = classElement.lookupConstructor( | 689 element = classElement.lookupConstructor(constructor); |
|
Johnni Winther
2015/01/29 12:42:17
I think this should always be used since we are pa
| |
| 690 new Selector.callConstructor(constructor, classElement.library)); | |
| 691 } else { | 690 } else { |
| 692 element = classElement.lookupConstructor( | 691 element = classElement.lookupDefaultConstructor(); |
| 693 new Selector.callDefaultConstructor(classElement.library)); | |
| 694 } | 692 } |
| 695 | 693 |
| 696 FunctionExpression tree = (element as FunctionElement).node; | 694 FunctionExpression tree = (element as FunctionElement).node; |
| 697 ResolverVisitor visitor = | 695 ResolverVisitor visitor = |
| 698 new ResolverVisitor(compiler, element, | 696 new ResolverVisitor(compiler, element, |
| 699 new ResolutionRegistry.internal(compiler, | 697 new ResolutionRegistry.internal(compiler, |
| 700 new CollectingTreeElements(element))); | 698 new CollectingTreeElements(element))); |
| 701 new InitializerResolver(visitor).resolveInitializers(element, tree); | 699 new InitializerResolver(visitor).resolveInitializers(element, tree); |
| 702 visitor.visit(tree.body); | 700 visitor.visit(tree.body); |
| 703 Expect.equals(expectedElementCount, map(visitor).length); | 701 Expect.equals(expectedElementCount, map(visitor).length); |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1142 }"""; | 1140 }"""; |
| 1143 asyncTest(() => compileScript(script2).then((compiler) { | 1141 asyncTest(() => compileScript(script2).then((compiler) { |
| 1144 expect(compiler, | 1142 expect(compiler, |
| 1145 [MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS], | 1143 [MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS], |
| 1146 [MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_CONSTRUCTOR, | 1144 [MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_CONSTRUCTOR, |
| 1147 MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_CONSTRUCTOR, | 1145 MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_CONSTRUCTOR, |
| 1148 MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_FIELD, | 1146 MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_FIELD, |
| 1149 MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_FIELD]); | 1147 MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_FIELD]); |
| 1150 })); | 1148 })); |
| 1151 } | 1149 } |
| OLD | NEW |