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

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

Issue 707073002: Fix analyzer's treatment of mixin constructors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Improve error message. Created 6 years, 1 month 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) 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 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine.all_the_rest_test; 8 library engine.all_the_rest_test;
9 9
10 import 'dart:collection'; 10 import 'dart:collection';
(...skipping 7378 matching lines...) Expand 10 before | Expand all | Expand 10 after
7389 FieldElement field = fields[0]; 7389 FieldElement field = fields[0];
7390 expect(field, isNotNull); 7390 expect(field, isNotNull);
7391 expect(field.name, fieldName); 7391 expect(field.name, fieldName);
7392 List<MethodElement> methods = type.methods; 7392 List<MethodElement> methods = type.methods;
7393 expect(methods, hasLength(1)); 7393 expect(methods, hasLength(1));
7394 MethodElement method = methods[0]; 7394 MethodElement method = methods[0];
7395 expect(method, isNotNull); 7395 expect(method, isNotNull);
7396 expect(method.name, methodName); 7396 expect(method.name, methodName);
7397 } 7397 }
7398 7398
7399 void test_visitClassTypeAlias() {
7400 // class B {}
7401 // class M {}
7402 // class C = B with M
7403 ElementHolder holder = new ElementHolder();
7404 ElementBuilder builder = new ElementBuilder(holder);
7405 ClassElementImpl classB = ElementFactory.classElement2('B', []);
7406 ConstructorElementImpl constructorB =
7407 ElementFactory.constructorElement2(classB, '', []);
7408 constructorB.setModifier(Modifier.SYNTHETIC, true);
7409 classB.constructors = [constructorB];
7410 ClassElement classM = ElementFactory.classElement2('M', []);
7411 WithClause withClause =
7412 AstFactory.withClause([AstFactory.typeName(classM, [])]);
7413 ClassTypeAlias alias = AstFactory.classTypeAlias('C', null, null,
7414 AstFactory.typeName(classB, []), withClause, null);
7415 alias.accept(builder);
7416 List<ClassElement> types = holder.types;
7417 expect(types, hasLength(1));
7418 ClassElement type = types[0];
7419 expect(alias.element, same(type));
7420 expect(type.name, equals('C'));
7421 expect(type.isAbstract, isFalse);
7422 expect(type.isSynthetic, isFalse);
7423 expect(type.typeParameters, isEmpty);
7424 expect(type.fields, isEmpty);
7425 expect(type.methods, isEmpty);
7426 }
7427
7428 void test_visitClassTypeAlias_abstract() {
7429 // class B {}
7430 // class M {}
7431 // abstract class C = B with M
7432 ElementHolder holder = new ElementHolder();
7433 ElementBuilder builder = new ElementBuilder(holder);
7434 ClassElementImpl classB = ElementFactory.classElement2('B', []);
7435 ConstructorElementImpl constructorB =
7436 ElementFactory.constructorElement2(classB, '', []);
7437 constructorB.setModifier(Modifier.SYNTHETIC, true);
7438 classB.constructors = [constructorB];
7439 ClassElement classM = ElementFactory.classElement2('M', []);
7440 WithClause withClause =
7441 AstFactory.withClause([AstFactory.typeName(classM, [])]);
7442 ClassTypeAlias classCAst = AstFactory.classTypeAlias('C', null,
7443 Keyword.ABSTRACT, AstFactory.typeName(classB, []), withClause, null);
7444 classCAst.accept(builder);
7445 List<ClassElement> types = holder.types;
7446 expect(types, hasLength(1));
7447 ClassElement type = types[0];
7448 expect(type.isAbstract, isTrue);
7449 }
7450
7451 void test_visitClassTypeAlias_typeParams() {
7452 // class B {}
7453 // class M {}
7454 // class C<T> = B with M
7455 ElementHolder holder = new ElementHolder();
7456 ElementBuilder builder = new ElementBuilder(holder);
7457 ClassElementImpl classB = ElementFactory.classElement2('B', []);
7458 ConstructorElementImpl constructorB =
7459 ElementFactory.constructorElement2(classB, '', []);
7460 constructorB.setModifier(Modifier.SYNTHETIC, true);
7461 classB.constructors = [constructorB];
7462 ClassElementImpl classM = ElementFactory.classElement2('M', []);
7463 WithClause withClause =
7464 AstFactory.withClause([AstFactory.typeName(classM, [])]);
7465 ClassTypeAlias classCAst = AstFactory.classTypeAlias('C',
7466 AstFactory.typeParameterList(['T']), null,
7467 AstFactory.typeName(classB, []), withClause, null);
7468 classCAst.accept(builder);
7469 List<ClassElement> types = holder.types;
7470 expect(types, hasLength(1));
7471 ClassElement type = types[0];
7472 expect(type.typeParameters, hasLength(1));
7473 expect(type.typeParameters[0].name, equals('T'));
7474 }
7475
7399 void test_visitConstructorDeclaration_factory() { 7476 void test_visitConstructorDeclaration_factory() {
7400 ElementHolder holder = new ElementHolder(); 7477 ElementHolder holder = new ElementHolder();
7401 ElementBuilder builder = new ElementBuilder(holder); 7478 ElementBuilder builder = new ElementBuilder(holder);
7402 String className = "A"; 7479 String className = "A";
7403 ConstructorDeclaration constructorDeclaration = 7480 ConstructorDeclaration constructorDeclaration =
7404 AstFactory.constructorDeclaration2( 7481 AstFactory.constructorDeclaration2(
7405 null, 7482 null,
7406 Keyword.FACTORY, 7483 Keyword.FACTORY,
7407 AstFactory.identifier3(className), 7484 AstFactory.identifier3(className),
7408 null, 7485 null,
(...skipping 3654 matching lines...) Expand 10 before | Expand all | Expand 10 after
11063 Source scriptSource = externalScript.scriptSource; 11140 Source scriptSource = externalScript.scriptSource;
11064 if (_expectedExternalScriptName == null) { 11141 if (_expectedExternalScriptName == null) {
11065 expect(scriptSource, isNull, reason: "script $scriptIndex"); 11142 expect(scriptSource, isNull, reason: "script $scriptIndex");
11066 } else { 11143 } else {
11067 expect(scriptSource, isNotNull, reason: "script $scriptIndex"); 11144 expect(scriptSource, isNotNull, reason: "script $scriptIndex");
11068 String actualExternalScriptName = scriptSource.shortName; 11145 String actualExternalScriptName = scriptSource.shortName;
11069 expect(actualExternalScriptName, _expectedExternalScriptName, reason: "scr ipt $scriptIndex"); 11146 expect(actualExternalScriptName, _expectedExternalScriptName, reason: "scr ipt $scriptIndex");
11070 } 11147 }
11071 } 11148 }
11072 } 11149 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/resolver.dart ('k') | pkg/analyzer/test/generated/compile_time_error_code_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698