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

Side by Side Diff: pkg/analyzer/test/generated/resolver_test.dart

Issue 1215053003: Compute mixin application constructors in the ClassElement.constructors getter. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library engine.resolver_test; 5 library engine.resolver_test;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/src/context/context.dart' as newContext; 9 import 'package:analyzer/src/context/context.dart' as newContext;
10 import 'package:analyzer/src/generated/ast.dart'; 10 import 'package:analyzer/src/generated/ast.dart';
(...skipping 13347 matching lines...) Expand 10 before | Expand all | Expand 10 after
13358 /** 13358 /**
13359 * The type provider used to access the types. 13359 * The type provider used to access the types.
13360 */ 13360 */
13361 TestTypeProvider _typeProvider; 13361 TestTypeProvider _typeProvider;
13362 13362
13363 /** 13363 /**
13364 * The visitor used to resolve types needed to form the type hierarchy. 13364 * The visitor used to resolve types needed to form the type hierarchy.
13365 */ 13365 */
13366 TypeResolverVisitor _visitor; 13366 TypeResolverVisitor _visitor;
13367 13367
13368 /**
13369 * The visitor used to resolve types needed to form the type hierarchy.
13370 */
13371 ImplicitConstructorBuilder _implicitConstructorBuilder;
13372
13373 void fail_visitConstructorDeclaration() { 13368 void fail_visitConstructorDeclaration() {
13374 fail("Not yet tested"); 13369 fail("Not yet tested");
13375 _listener.assertNoErrors(); 13370 _listener.assertNoErrors();
13376 } 13371 }
13377 13372
13378 void fail_visitFunctionDeclaration() { 13373 void fail_visitFunctionDeclaration() {
13379 fail("Not yet tested"); 13374 fail("Not yet tested");
13380 _listener.assertNoErrors(); 13375 _listener.assertNoErrors();
13381 } 13376 }
13382 13377
(...skipping 30 matching lines...) Expand all
13413 new FileBasedSource(FileUtilities2.createFile("/lib.dart")); 13408 new FileBasedSource(FileUtilities2.createFile("/lib.dart"));
13414 _library = new Library(context, _listener, librarySource); 13409 _library = new Library(context, _listener, librarySource);
13415 LibraryElementImpl element = new LibraryElementImpl.forNode( 13410 LibraryElementImpl element = new LibraryElementImpl.forNode(
13416 context, AstFactory.libraryIdentifier2(["lib"])); 13411 context, AstFactory.libraryIdentifier2(["lib"]));
13417 element.definingCompilationUnit = 13412 element.definingCompilationUnit =
13418 new CompilationUnitElementImpl("lib.dart"); 13413 new CompilationUnitElementImpl("lib.dart");
13419 _library.libraryElement = element; 13414 _library.libraryElement = element;
13420 _typeProvider = new TestTypeProvider(); 13415 _typeProvider = new TestTypeProvider();
13421 _visitor = 13416 _visitor =
13422 new TypeResolverVisitor.con1(_library, librarySource, _typeProvider); 13417 new TypeResolverVisitor.con1(_library, librarySource, _typeProvider);
13423 _implicitConstructorBuilder = new ImplicitConstructorBuilder(_listener,
13424 (ClassElement classElement, ClassElement superclassElement,
13425 void computation()) {
13426 // For these tests, we assume the classes for which implicit
13427 // constructors need to be built are visited in proper dependency order,
13428 // so we just invoke the computation immediately.
13429 computation();
13430 });
13431 } 13418 }
13432 13419
13433 void test_visitCatchClause_exception() { 13420 void test_visitCatchClause_exception() {
13434 // catch (e) 13421 // catch (e)
13435 CatchClause clause = AstFactory.catchClause("e"); 13422 CatchClause clause = AstFactory.catchClause("e");
13436 SimpleIdentifier exceptionParameter = clause.exceptionParameter; 13423 SimpleIdentifier exceptionParameter = clause.exceptionParameter;
13437 exceptionParameter.staticElement = 13424 exceptionParameter.staticElement =
13438 new LocalVariableElementImpl.forNode(exceptionParameter); 13425 new LocalVariableElementImpl.forNode(exceptionParameter);
13439 _resolveCatchClause(clause, _typeProvider.dynamicType, null); 13426 _resolveCatchClause(clause, _typeProvider.dynamicType, null);
13440 _listener.assertNoErrors(); 13427 _listener.assertNoErrors();
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
13820 * being resolved 13807 * being resolved
13821 * @return the element to which the expression was resolved 13808 * @return the element to which the expression was resolved
13822 */ 13809 */
13823 void _resolveNode(AstNode node, [List<Element> definedElements]) { 13810 void _resolveNode(AstNode node, [List<Element> definedElements]) {
13824 if (definedElements != null) { 13811 if (definedElements != null) {
13825 for (Element element in definedElements) { 13812 for (Element element in definedElements) {
13826 _library.libraryScope.define(element); 13813 _library.libraryScope.define(element);
13827 } 13814 }
13828 } 13815 }
13829 node.accept(_visitor); 13816 node.accept(_visitor);
13830 if (node is Declaration) {
13831 node.element.accept(_implicitConstructorBuilder);
13832 }
13833 } 13817 }
13834 } 13818 }
13835 13819
13836 class _AnalysisContextFactory_initContextWithCore 13820 class _AnalysisContextFactory_initContextWithCore
13837 extends DirectoryBasedDartSdk { 13821 extends DirectoryBasedDartSdk {
13838 _AnalysisContextFactory_initContextWithCore(JavaFile arg0) : super(arg0); 13822 _AnalysisContextFactory_initContextWithCore(JavaFile arg0) : super(arg0);
13839 13823
13840 @override 13824 @override
13841 LibraryMap initialLibraryMap(bool useDart2jsPaths) { 13825 LibraryMap initialLibraryMap(bool useDart2jsPaths) {
13842 LibraryMap map = new LibraryMap(); 13826 LibraryMap map = new LibraryMap();
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
13884 // check propagated type 13868 // check propagated type
13885 FunctionType propagatedType = node.propagatedType as FunctionType; 13869 FunctionType propagatedType = node.propagatedType as FunctionType;
13886 expect(propagatedType.returnType, test.typeProvider.stringType); 13870 expect(propagatedType.returnType, test.typeProvider.stringType);
13887 } on AnalysisException catch (e, stackTrace) { 13871 } on AnalysisException catch (e, stackTrace) {
13888 thrownException[0] = new CaughtException(e, stackTrace); 13872 thrownException[0] = new CaughtException(e, stackTrace);
13889 } 13873 }
13890 } 13874 }
13891 return null; 13875 return null;
13892 } 13876 }
13893 } 13877 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/element_test.dart ('k') | pkg/analyzer/test/src/task/dart_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698