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

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

Issue 2027893002: Start separating ClassElementImpl for Class and Enum. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 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 analyzer.test.generated.resolver_test; 5 library analyzer.test.generated.resolver_test;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/ast/token.dart'; 10 import 'package:analyzer/dart/ast/token.dart';
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 void test_creation_empty() { 384 void test_creation_empty() {
385 LibraryElement definingLibrary = createDefaultTestLibrary(); 385 LibraryElement definingLibrary = createDefaultTestLibrary();
386 GatheringErrorListener errorListener = new GatheringErrorListener(); 386 GatheringErrorListener errorListener = new GatheringErrorListener();
387 new LibraryImportScope(definingLibrary, errorListener); 387 new LibraryImportScope(definingLibrary, errorListener);
388 } 388 }
389 389
390 void test_creation_nonEmpty() { 390 void test_creation_nonEmpty() {
391 AnalysisContext context = AnalysisContextFactory.contextWithCore(); 391 AnalysisContext context = AnalysisContextFactory.contextWithCore();
392 String importedTypeName = "A"; 392 String importedTypeName = "A";
393 ClassElement importedType = 393 ClassElement importedType =
394 new ClassElementImpl.forNode(AstFactory.identifier3(importedTypeName)); 394 new ClassElementImpl_Class.forNode(AstFactory.identifier3(importedTypeNa me));
395 LibraryElement importedLibrary = createTestLibrary(context, "imported"); 395 LibraryElement importedLibrary = createTestLibrary(context, "imported");
396 (importedLibrary.definingCompilationUnit as CompilationUnitElementImpl) 396 (importedLibrary.definingCompilationUnit as CompilationUnitElementImpl)
397 .types = <ClassElement>[importedType]; 397 .types = <ClassElement>[importedType];
398 LibraryElementImpl definingLibrary = 398 LibraryElementImpl definingLibrary =
399 createTestLibrary(context, "importing"); 399 createTestLibrary(context, "importing");
400 ImportElementImpl importElement = new ImportElementImpl(0); 400 ImportElementImpl importElement = new ImportElementImpl(0);
401 importElement.importedLibrary = importedLibrary; 401 importElement.importedLibrary = importedLibrary;
402 definingLibrary.imports = <ImportElement>[importElement]; 402 definingLibrary.imports = <ImportElement>[importElement];
403 GatheringErrorListener errorListener = new GatheringErrorListener(); 403 GatheringErrorListener errorListener = new GatheringErrorListener();
404 Scope scope = new LibraryImportScope(definingLibrary, errorListener); 404 Scope scope = new LibraryImportScope(definingLibrary, errorListener);
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 void test_creation_empty() { 504 void test_creation_empty() {
505 LibraryElement definingLibrary = createDefaultTestLibrary(); 505 LibraryElement definingLibrary = createDefaultTestLibrary();
506 GatheringErrorListener errorListener = new GatheringErrorListener(); 506 GatheringErrorListener errorListener = new GatheringErrorListener();
507 new LibraryScope(definingLibrary, errorListener); 507 new LibraryScope(definingLibrary, errorListener);
508 } 508 }
509 509
510 void test_creation_nonEmpty() { 510 void test_creation_nonEmpty() {
511 AnalysisContext context = AnalysisContextFactory.contextWithCore(); 511 AnalysisContext context = AnalysisContextFactory.contextWithCore();
512 String importedTypeName = "A"; 512 String importedTypeName = "A";
513 ClassElement importedType = 513 ClassElement importedType =
514 new ClassElementImpl.forNode(AstFactory.identifier3(importedTypeName)); 514 new ClassElementImpl_Class.forNode(AstFactory.identifier3(importedTypeNa me));
515 LibraryElement importedLibrary = createTestLibrary(context, "imported"); 515 LibraryElement importedLibrary = createTestLibrary(context, "imported");
516 (importedLibrary.definingCompilationUnit as CompilationUnitElementImpl) 516 (importedLibrary.definingCompilationUnit as CompilationUnitElementImpl)
517 .types = <ClassElement>[importedType]; 517 .types = <ClassElement>[importedType];
518 LibraryElementImpl definingLibrary = 518 LibraryElementImpl definingLibrary =
519 createTestLibrary(context, "importing"); 519 createTestLibrary(context, "importing");
520 ImportElementImpl importElement = new ImportElementImpl(0); 520 ImportElementImpl importElement = new ImportElementImpl(0);
521 importElement.importedLibrary = importedLibrary; 521 importElement.importedLibrary = importedLibrary;
522 definingLibrary.imports = <ImportElement>[importElement]; 522 definingLibrary.imports = <ImportElement>[importElement];
523 GatheringErrorListener errorListener = new GatheringErrorListener(); 523 GatheringErrorListener errorListener = new GatheringErrorListener();
524 Scope scope = new LibraryScope(definingLibrary, errorListener); 524 Scope scope = new LibraryScope(definingLibrary, errorListener);
(...skipping 2388 matching lines...) Expand 10 before | Expand all | Expand 10 after
2913 expect(provider.stringType, same(stringType)); 2913 expect(provider.stringType, same(stringType));
2914 expect(provider.symbolType, same(symbolType)); 2914 expect(provider.symbolType, same(symbolType));
2915 InterfaceType mockStreamType = mockAsyncLib.getType('Stream').type; 2915 InterfaceType mockStreamType = mockAsyncLib.getType('Stream').type;
2916 expect(provider.streamType, same(mockStreamType)); 2916 expect(provider.streamType, same(mockStreamType));
2917 expect(provider.typeType, same(typeType)); 2917 expect(provider.typeType, same(typeType));
2918 } 2918 }
2919 2919
2920 ClassElement _classElement(String typeName, InterfaceType superclassType, 2920 ClassElement _classElement(String typeName, InterfaceType superclassType,
2921 [List<String> parameterNames]) { 2921 [List<String> parameterNames]) {
2922 ClassElementImpl element = 2922 ClassElementImpl element =
2923 new ClassElementImpl.forNode(AstFactory.identifier3(typeName)); 2923 new ClassElementImpl_Class.forNode(AstFactory.identifier3(typeName));
2924 element.supertype = superclassType; 2924 element.supertype = superclassType;
2925 InterfaceTypeImpl type = new InterfaceTypeImpl(element); 2925 InterfaceTypeImpl type = new InterfaceTypeImpl(element);
2926 element.type = type; 2926 element.type = type;
2927 if (parameterNames != null) { 2927 if (parameterNames != null) {
2928 int count = parameterNames.length; 2928 int count = parameterNames.length;
2929 if (count > 0) { 2929 if (count > 0) {
2930 List<TypeParameterElementImpl> typeParameters = 2930 List<TypeParameterElementImpl> typeParameters =
2931 new List<TypeParameterElementImpl>(count); 2931 new List<TypeParameterElementImpl>(count);
2932 List<TypeParameterTypeImpl> typeArguments = 2932 List<TypeParameterTypeImpl> typeArguments =
2933 new List<TypeParameterTypeImpl>(count); 2933 new List<TypeParameterTypeImpl>(count);
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
3600 */ 3600 */
3601 class _StaleElement extends ElementImpl { 3601 class _StaleElement extends ElementImpl {
3602 _StaleElement() : super("_StaleElement", -1); 3602 _StaleElement() : super("_StaleElement", -1);
3603 3603
3604 @override 3604 @override
3605 get kind => throw "_StaleElement's kind shouldn't be accessed"; 3605 get kind => throw "_StaleElement's kind shouldn't be accessed";
3606 3606
3607 @override 3607 @override
3608 accept(_) => throw "_StaleElement shouldn't be visited"; 3608 accept(_) => throw "_StaleElement shouldn't be visited";
3609 } 3609 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698