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

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

Issue 1207383005: Clean up constructors for ScopedVisitor and derived classes. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Remove commented out code. 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
« no previous file with comments | « pkg/analyzer/lib/src/task/dart.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1916 matching lines...) Expand 10 before | Expand all | Expand 10 after
1927 FileBasedSource source = 1927 FileBasedSource source =
1928 new FileBasedSource(FileUtilities2.createFile("/test.dart")); 1928 new FileBasedSource(FileUtilities2.createFile("/test.dart"));
1929 CompilationUnitElementImpl definingCompilationUnit = 1929 CompilationUnitElementImpl definingCompilationUnit =
1930 new CompilationUnitElementImpl("test.dart"); 1930 new CompilationUnitElementImpl("test.dart");
1931 definingCompilationUnit.librarySource = 1931 definingCompilationUnit.librarySource =
1932 definingCompilationUnit.source = source; 1932 definingCompilationUnit.source = source;
1933 _definingLibrary = ElementFactory.library(context, "test"); 1933 _definingLibrary = ElementFactory.library(context, "test");
1934 _definingLibrary.definingCompilationUnit = definingCompilationUnit; 1934 _definingLibrary.definingCompilationUnit = definingCompilationUnit;
1935 Library library = new Library(context, _listener, source); 1935 Library library = new Library(context, _listener, source);
1936 library.libraryElement = _definingLibrary; 1936 library.libraryElement = _definingLibrary;
1937 _visitor = new ResolverVisitor.con1(library, source, _typeProvider); 1937 _visitor = new ResolverVisitor(
1938 library.libraryElement, source, _typeProvider, library.errorListener,
1939 nameScope: library.libraryScope,
1940 inheritanceManager: library.inheritanceManager);
1938 try { 1941 try {
1939 return _visitor.elementResolver; 1942 return _visitor.elementResolver;
1940 } catch (exception) { 1943 } catch (exception) {
1941 throw new IllegalArgumentException( 1944 throw new IllegalArgumentException(
1942 "Could not create resolver", exception); 1945 "Could not create resolver", exception);
1943 } 1946 }
1944 } 1947 }
1945 1948
1946 /** 1949 /**
1947 * Return the element associated with the label of [statement] after the 1950 * Return the element associated with the label of [statement] after the
(...skipping 9129 matching lines...) Expand 10 before | Expand all | Expand 10 after
11077 new FileBasedSource(FileUtilities2.createFile("/lib.dart")); 11080 new FileBasedSource(FileUtilities2.createFile("/lib.dart"));
11078 CompilationUnitElementImpl definingCompilationUnit = 11081 CompilationUnitElementImpl definingCompilationUnit =
11079 new CompilationUnitElementImpl("lib.dart"); 11082 new CompilationUnitElementImpl("lib.dart");
11080 definingCompilationUnit.librarySource = 11083 definingCompilationUnit.librarySource =
11081 definingCompilationUnit.source = source; 11084 definingCompilationUnit.source = source;
11082 LibraryElementImpl definingLibrary = 11085 LibraryElementImpl definingLibrary =
11083 new LibraryElementImpl.forNode(context, null); 11086 new LibraryElementImpl.forNode(context, null);
11084 definingLibrary.definingCompilationUnit = definingCompilationUnit; 11087 definingLibrary.definingCompilationUnit = definingCompilationUnit;
11085 Library library = new Library(context, _listener, source); 11088 Library library = new Library(context, _listener, source);
11086 library.libraryElement = definingLibrary; 11089 library.libraryElement = definingLibrary;
11087 _visitor = new ResolverVisitor.con1(library, source, _typeProvider); 11090 _visitor = new ResolverVisitor(
11091 library.libraryElement, source, _typeProvider, library.errorListener,
11092 nameScope: library.libraryScope,
11093 inheritanceManager: library.inheritanceManager);
11088 _visitor.overrideManager.enterScope(); 11094 _visitor.overrideManager.enterScope();
11089 try { 11095 try {
11090 return _visitor.typeAnalyzer; 11096 return _visitor.typeAnalyzer;
11091 } catch (exception) { 11097 } catch (exception) {
11092 throw new IllegalArgumentException( 11098 throw new IllegalArgumentException(
11093 "Could not create analyzer", exception); 11099 "Could not create analyzer", exception);
11094 } 11100 }
11095 } 11101 }
11096 11102
11097 DartType _flatten(DartType type) => 11103 DartType _flatten(DartType type) =>
(...skipping 2308 matching lines...) Expand 10 before | Expand all | Expand 10 after
13406 InternalAnalysisContext context = AnalysisContextFactory.contextWithCore(); 13412 InternalAnalysisContext context = AnalysisContextFactory.contextWithCore();
13407 Source librarySource = 13413 Source librarySource =
13408 new FileBasedSource(FileUtilities2.createFile("/lib.dart")); 13414 new FileBasedSource(FileUtilities2.createFile("/lib.dart"));
13409 _library = new Library(context, _listener, librarySource); 13415 _library = new Library(context, _listener, librarySource);
13410 LibraryElementImpl element = new LibraryElementImpl.forNode( 13416 LibraryElementImpl element = new LibraryElementImpl.forNode(
13411 context, AstFactory.libraryIdentifier2(["lib"])); 13417 context, AstFactory.libraryIdentifier2(["lib"]));
13412 element.definingCompilationUnit = 13418 element.definingCompilationUnit =
13413 new CompilationUnitElementImpl("lib.dart"); 13419 new CompilationUnitElementImpl("lib.dart");
13414 _library.libraryElement = element; 13420 _library.libraryElement = element;
13415 _typeProvider = new TestTypeProvider(); 13421 _typeProvider = new TestTypeProvider();
13416 _visitor = 13422 _visitor = new TypeResolverVisitor(_library.libraryElement, librarySource,
13417 new TypeResolverVisitor.con1(_library, librarySource, _typeProvider); 13423 _typeProvider, _library.errorListener,
13424 nameScope: _library.libraryScope);
13418 } 13425 }
13419 13426
13420 void test_visitCatchClause_exception() { 13427 void test_visitCatchClause_exception() {
13421 // catch (e) 13428 // catch (e)
13422 CatchClause clause = AstFactory.catchClause("e"); 13429 CatchClause clause = AstFactory.catchClause("e");
13423 SimpleIdentifier exceptionParameter = clause.exceptionParameter; 13430 SimpleIdentifier exceptionParameter = clause.exceptionParameter;
13424 exceptionParameter.staticElement = 13431 exceptionParameter.staticElement =
13425 new LocalVariableElementImpl.forNode(exceptionParameter); 13432 new LocalVariableElementImpl.forNode(exceptionParameter);
13426 _resolveCatchClause(clause, _typeProvider.dynamicType, null); 13433 _resolveCatchClause(clause, _typeProvider.dynamicType, null);
13427 _listener.assertNoErrors(); 13434 _listener.assertNoErrors();
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
13868 // check propagated type 13875 // check propagated type
13869 FunctionType propagatedType = node.propagatedType as FunctionType; 13876 FunctionType propagatedType = node.propagatedType as FunctionType;
13870 expect(propagatedType.returnType, test.typeProvider.stringType); 13877 expect(propagatedType.returnType, test.typeProvider.stringType);
13871 } on AnalysisException catch (e, stackTrace) { 13878 } on AnalysisException catch (e, stackTrace) {
13872 thrownException[0] = new CaughtException(e, stackTrace); 13879 thrownException[0] = new CaughtException(e, stackTrace);
13873 } 13880 }
13874 } 13881 }
13875 return null; 13882 return null;
13876 } 13883 }
13877 } 13884 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/task/dart.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698