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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/resolution/members.dart

Issue 15888009: Fix http://dartbug.com/8669 by making sure we do not crash when trying to use Object as a mixin. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/warnings.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 part of resolution; 5 part of resolution;
6 6
7 abstract class TreeElements { 7 abstract class TreeElements {
8 Element get currentElement; 8 Element get currentElement;
9 Set<Node> get superUses; 9 Set<Node> get superUses;
10 10
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 } 99 }
100 100
101 void setOperatorSelectorInComplexSendSet(SendSet node, Selector selector) { 101 void setOperatorSelectorInComplexSendSet(SendSet node, Selector selector) {
102 selectors[node.assignmentOperator] = selector; 102 selectors[node.assignmentOperator] = selector;
103 } 103 }
104 104
105 Selector getOperatorSelectorInComplexSendSet(SendSet node) { 105 Selector getOperatorSelectorInComplexSendSet(SendSet node) {
106 return selectors[node.assignmentOperator]; 106 return selectors[node.assignmentOperator];
107 } 107 }
108 108
109 // The following methods set selectors on the "for in" node. Since» 109 // The following methods set selectors on the "for in" node. Since
110 // we're using three selectors, we need to use children of the node,» 110 // we're using three selectors, we need to use children of the node,
111 // and we arbitrarily choose which ones.» 111 // and we arbitrarily choose which ones.
ngeoffray 2013/05/30 06:53:01 Thank you :)
112 112
113 Selector setIteratorSelector(ForIn node, Selector selector) { 113 Selector setIteratorSelector(ForIn node, Selector selector) {
114 selectors[node] = selector; 114 selectors[node] = selector;
115 } 115 }
116 116
117 Selector getIteratorSelector(ForIn node) { 117 Selector getIteratorSelector(ForIn node) {
118 return selectors[node]; 118 return selectors[node];
119 } 119 }
120 120
121 Selector setMoveNextSelector(ForIn node, Selector selector) { 121 Selector setMoveNextSelector(ForIn node, Selector selector) {
122 selectors[node.forToken] = selector; 122 selectors[node.forToken] = selector;
123 } 123 }
124 » 124
125 Selector getMoveNextSelector(ForIn node) { 125 Selector getMoveNextSelector(ForIn node) {
126 return selectors[node.forToken]; 126 return selectors[node.forToken];
127 } 127 }
128 128
129 Selector setCurrentSelector(ForIn node, Selector selector) { 129 Selector setCurrentSelector(ForIn node, Selector selector) {
130 selectors[node.inToken] = selector; 130 selectors[node.inToken] = selector;
131 } 131 }
132 132
133 Selector getCurrentSelector(ForIn node) { 133 Selector getCurrentSelector(ForIn node) {
134 return selectors[node.inToken]; 134 return selectors[node.inToken];
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 MessageKind.ILLEGAL_MIXIN_APPLICATION_MODIFIERS, 595 MessageKind.ILLEGAL_MIXIN_APPLICATION_MODIFIERS,
596 {'modifiers': illegalModifiers}); 596 {'modifiers': illegalModifiers});
597 } 597 }
598 598
599 // In case of cyclic mixin applications, the mixin chain will have 599 // In case of cyclic mixin applications, the mixin chain will have
600 // been cut. If so, we have already reported the error to the 600 // been cut. If so, we have already reported the error to the
601 // user so we just return from here. 601 // user so we just return from here.
602 ClassElement mixin = mixinApplication.mixin; 602 ClassElement mixin = mixinApplication.mixin;
603 if (mixin == null) return; 603 if (mixin == null) return;
604 604
605 // Check that we're not trying to use Object as a mixin.
606 if (mixin.superclass == null) {
607 compiler.reportErrorCode(mixinApplication,
608 MessageKind.ILLEGAL_MIXIN_OBJECT);
609 // Avoid reporting additional errors for the Object class.
ngeoffray 2013/05/30 06:53:01 I'd drop "for the Object class", it confused me.
610 return;
611 }
612
605 // Check that the mixed in class has Object as its superclass. 613 // Check that the mixed in class has Object as its superclass.
606 if (!mixin.superclass.isObject(compiler)) { 614 if (!mixin.superclass.isObject(compiler)) {
607 compiler.reportErrorCode(mixin, MessageKind.ILLEGAL_MIXIN_SUPERCLASS); 615 compiler.reportErrorCode(mixin, MessageKind.ILLEGAL_MIXIN_SUPERCLASS);
608 } 616 }
609 617
610 // Check that the mixed in class doesn't have any constructors and 618 // Check that the mixed in class doesn't have any constructors and
611 // make sure we aren't mixing in methods that use 'super'. 619 // make sure we aren't mixing in methods that use 'super'.
612 mixin.forEachLocalMember((Element member) { 620 mixin.forEachLocalMember((Element member) {
613 if (member.isGenerativeConstructor() && !member.isSynthesized) { 621 if (member.isGenerativeConstructor() && !member.isSynthesized) {
614 compiler.reportErrorCode(member, MessageKind.ILLEGAL_MIXIN_CONSTRUCTOR); 622 compiler.reportErrorCode(member, MessageKind.ILLEGAL_MIXIN_CONSTRUCTOR);
(...skipping 3375 matching lines...) Expand 10 before | Expand all | Expand 10 after
3990 return e; 3998 return e;
3991 } 3999 }
3992 4000
3993 /// Assumed to be called by [resolveRedirectingFactory]. 4001 /// Assumed to be called by [resolveRedirectingFactory].
3994 Element visitReturn(Return node) { 4002 Element visitReturn(Return node) {
3995 Node expression = node.expression; 4003 Node expression = node.expression;
3996 return finishConstructorReference(visit(expression), 4004 return finishConstructorReference(visit(expression),
3997 expression, expression); 4005 expression, expression);
3998 } 4006 }
3999 } 4007 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/warnings.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698