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

Side by Side Diff: pkg/analyzer/lib/src/dart/element/element.dart

Issue 1711673003: Synthetic constructors resulting from mixins should never be const (issue 25738) (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: cleanup Created 4 years, 10 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 | « no previous file | pkg/analyzer/test/generated/compile_time_error_code_test.dart » ('j') | 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 analyzer.src.dart.element.element; 5 library analyzer.src.dart.element.element;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import 'dart:math' show min; 8 import 'dart:math' show min;
9 9
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 } 698 }
699 699
700 // Now create an implicit constructor for every constructor found above, 700 // Now create an implicit constructor for every constructor found above,
701 // substituting type parameters as appropriate. 701 // substituting type parameters as appropriate.
702 return constructorsToForward 702 return constructorsToForward
703 .map((ConstructorElement superclassConstructor) { 703 .map((ConstructorElement superclassConstructor) {
704 ConstructorElementImpl implicitConstructor = 704 ConstructorElementImpl implicitConstructor =
705 new ConstructorElementImpl(superclassConstructor.name, -1); 705 new ConstructorElementImpl(superclassConstructor.name, -1);
706 implicitConstructor.synthetic = true; 706 implicitConstructor.synthetic = true;
707 implicitConstructor.redirectedConstructor = superclassConstructor; 707 implicitConstructor.redirectedConstructor = superclassConstructor;
708 implicitConstructor.const2 = superclassConstructor.isConst;
709 implicitConstructor.returnType = type; 708 implicitConstructor.returnType = type;
710 List<ParameterElement> superParameters = superclassConstructor.parameters; 709 List<ParameterElement> superParameters = superclassConstructor.parameters;
711 int count = superParameters.length; 710 int count = superParameters.length;
712 if (count > 0) { 711 if (count > 0) {
713 List<ParameterElement> implicitParameters = 712 List<ParameterElement> implicitParameters =
714 new List<ParameterElement>(count); 713 new List<ParameterElement>(count);
715 for (int i = 0; i < count; i++) { 714 for (int i = 0; i < count; i++) {
716 ParameterElement superParameter = superParameters[i]; 715 ParameterElement superParameter = superParameters[i];
717 ParameterElementImpl implicitParameter = 716 ParameterElementImpl implicitParameter =
718 new ParameterElementImpl(superParameter.name, -1); 717 new ParameterElementImpl(superParameter.name, -1);
(...skipping 3821 matching lines...) Expand 10 before | Expand all | Expand 10 after
4540 */ 4539 */
4541 DartType bound; 4540 DartType bound;
4542 4541
4543 /** 4542 /**
4544 * Initialize a newly created method element to have the given [name] and 4543 * Initialize a newly created method element to have the given [name] and
4545 * [offset]. 4544 * [offset].
4546 */ 4545 */
4547 TypeParameterElementImpl(String name, int offset) : super(name, offset); 4546 TypeParameterElementImpl(String name, int offset) : super(name, offset);
4548 4547
4549 /** 4548 /**
4549 * Initialize a newly created type parameter element to have the given [name].
4550 */
4551 TypeParameterElementImpl.forNode(Identifier name) : super.forNode(name);
4552
4553 /**
4550 * Initialize a newly created synthetic type parameter element to have the 4554 * Initialize a newly created synthetic type parameter element to have the
4551 * given [name], and with [synthetic] set to true. 4555 * given [name], and with [synthetic] set to true.
4552 */ 4556 */
4553 TypeParameterElementImpl.synthetic(String name) : super(name, -1) { 4557 TypeParameterElementImpl.synthetic(String name) : super(name, -1) {
4554 synthetic = true; 4558 synthetic = true;
4555 } 4559 }
4556 4560
4557 /**
4558 * Initialize a newly created type parameter element to have the given [name].
4559 */
4560 TypeParameterElementImpl.forNode(Identifier name) : super.forNode(name);
4561
4562 @override 4561 @override
4563 ElementKind get kind => ElementKind.TYPE_PARAMETER; 4562 ElementKind get kind => ElementKind.TYPE_PARAMETER;
4564 4563
4565 @override 4564 @override
4566 accept(ElementVisitor visitor) => visitor.visitTypeParameterElement(this); 4565 accept(ElementVisitor visitor) => visitor.visitTypeParameterElement(this);
4567 4566
4568 @override 4567 @override
4569 void appendTo(StringBuffer buffer) { 4568 void appendTo(StringBuffer buffer) {
4570 buffer.write(displayName); 4569 buffer.write(displayName);
4571 if (bound != null) { 4570 if (bound != null) {
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
4738 4737
4739 @override 4738 @override
4740 void visitElement(Element element) { 4739 void visitElement(Element element) {
4741 int offset = element.nameOffset; 4740 int offset = element.nameOffset;
4742 if (offset != -1) { 4741 if (offset != -1) {
4743 map[offset] = element; 4742 map[offset] = element;
4744 } 4743 }
4745 super.visitElement(element); 4744 super.visitElement(element);
4746 } 4745 }
4747 } 4746 }
OLDNEW
« no previous file with comments | « no previous file | 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