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

Side by Side Diff: lib/compiler/implementation/tree/nodes.dart

Issue 10666052: Revert "Implement override checks." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « lib/compiler/implementation/resolver.dart ('k') | lib/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 interface Visitor<R> { 5 interface Visitor<R> {
6 R visitBlock(Block node); 6 R visitBlock(Block node);
7 R visitBreakStatement(BreakStatement node); 7 R visitBreakStatement(BreakStatement node);
8 R visitCascade(Cascade node); 8 R visitCascade(Cascade node);
9 R visitCascadeReceiver(CascadeReceiver node); 9 R visitCascadeReceiver(CascadeReceiver node);
10 R visitCaseMatch(CaseMatch node); 10 R visitCaseMatch(CaseMatch node);
(...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after
1068 /** Bit pattern to easy check what modifiers are present. */ 1068 /** Bit pattern to easy check what modifiers are present. */
1069 final int flags; 1069 final int flags;
1070 1070
1071 static final int FLAG_STATIC = 1; 1071 static final int FLAG_STATIC = 1;
1072 static final int FLAG_ABSTRACT = FLAG_STATIC << 1; 1072 static final int FLAG_ABSTRACT = FLAG_STATIC << 1;
1073 static final int FLAG_FINAL = FLAG_ABSTRACT << 1; 1073 static final int FLAG_FINAL = FLAG_ABSTRACT << 1;
1074 static final int FLAG_VAR = FLAG_FINAL << 1; 1074 static final int FLAG_VAR = FLAG_FINAL << 1;
1075 static final int FLAG_CONST = FLAG_VAR << 1; 1075 static final int FLAG_CONST = FLAG_VAR << 1;
1076 static final int FLAG_FACTORY = FLAG_CONST << 1; 1076 static final int FLAG_FACTORY = FLAG_CONST << 1;
1077 1077
1078 Modifiers(NodeList nodes) : this.withFlags(nodes, computeFlags(nodes.nodes)); 1078 Modifiers(NodeList nodes)
1079 : this.nodes = nodes, flags = computeFlags(nodes.nodes);
1079 1080
1080 Modifiers.empty() : this(new NodeList.empty()); 1081 Modifiers.empty() : this(new NodeList.empty());
1081 1082
1082 Modifiers.withFlags(this.nodes, this.flags);
1083
1084 static int computeFlags(Link<Node> nodes) { 1083 static int computeFlags(Link<Node> nodes) {
1085 int flags = 0; 1084 int flags = 0;
1086 for (; !nodes.isEmpty(); nodes = nodes.tail) { 1085 for (; !nodes.isEmpty(); nodes = nodes.tail) {
1087 String value = nodes.head.asIdentifier().source.stringValue; 1086 String value = nodes.head.asIdentifier().source.stringValue;
1088 if (value === 'static') flags += FLAG_STATIC; 1087 if (value === 'static') flags += FLAG_STATIC;
1089 else if (value === 'abstract') flags += FLAG_ABSTRACT; 1088 else if (value === 'abstract') flags += FLAG_ABSTRACT;
1090 else if (value === 'final') flags += FLAG_FINAL; 1089 else if (value === 'final') flags += FLAG_FINAL;
1091 else if (value === 'var') flags += FLAG_VAR; 1090 else if (value === 'var') flags += FLAG_VAR;
1092 else if (value === 'const') flags += FLAG_CONST; 1091 else if (value === 'const') flags += FLAG_CONST;
1093 else if (value === 'factory') flags += FLAG_FACTORY; 1092 else if (value === 'factory') flags += FLAG_FACTORY;
1094 else throw 'internal error: ${nodes.head}'; 1093 else throw 'internal error: ${nodes.head}';
1095 } 1094 }
1096 return flags; 1095 return flags;
1097 } 1096 }
1098 1097
1099 Modifiers asModifiers() => this; 1098 Modifiers asModifiers() => this;
1100 Token getBeginToken() => nodes.getBeginToken(); 1099 Token getBeginToken() => nodes.getBeginToken();
1101 Token getEndToken() => nodes.getEndToken(); 1100 Token getEndToken() => nodes.getEndToken();
1102 accept(Visitor visitor) => visitor.visitModifiers(this); 1101 accept(Visitor visitor) => visitor.visitModifiers(this);
1103 visitChildren(Visitor visitor) => nodes.accept(visitor); 1102 visitChildren(Visitor visitor) => nodes.accept(visitor);
1104 1103
1105 bool isStatic() => (flags & FLAG_STATIC) != 0; 1104 bool isStatic() => (flags & FLAG_STATIC) != 0;
1106 bool isAbstract() => (flags & FLAG_ABSTRACT) != 0; 1105 bool isAbstract() => (flags & FLAG_ABSTRACT) != 0;
1107 bool isFinal() => (flags & FLAG_FINAL) != 0; 1106 bool isFinal() => (flags & FLAG_FINAL) != 0;
1108 bool isVar() => (flags & FLAG_VAR) != 0; 1107 bool isVar() => (flags & FLAG_VAR) != 0;
1109 bool isConst() => (flags & FLAG_CONST) != 0; 1108 bool isConst() => (flags & FLAG_CONST) != 0;
1110 bool isFactory() => (flags & FLAG_FACTORY) != 0; 1109 bool isFactory() => (flags & FLAG_FACTORY) != 0;
1111
1112 String toString() {
1113 LinkBuilder<String> builder = new LinkBuilder<String>();
1114 if (isStatic()) builder.addLast('static');
1115 if (isAbstract()) builder.addLast('abstract');
1116 if (isFinal()) builder.addLast('final');
1117 if (isVar()) builder.addLast('var');
1118 if (isConst()) builder.addLast('const');
1119 if (isFactory()) builder.addLast('factory');
1120 StringBuffer buffer = new StringBuffer();
1121 builder.toLink().printOn(buffer, ', ');
1122 return buffer.toString();
1123 }
1124 } 1110 }
1125 1111
1126 class StringInterpolation extends StringNode { 1112 class StringInterpolation extends StringNode {
1127 final LiteralString string; 1113 final LiteralString string;
1128 final NodeList parts; 1114 final NodeList parts;
1129 1115
1130 StringInterpolation(this.string, this.parts); 1116 StringInterpolation(this.string, this.parts);
1131 1117
1132 StringInterpolation asStringInterpolation() => this; 1118 StringInterpolation asStringInterpolation() => this;
1133 1119
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
1720 * argument). 1706 * argument).
1721 * 1707 *
1722 * TODO(ahe): This method is controversial, the team needs to discuss 1708 * TODO(ahe): This method is controversial, the team needs to discuss
1723 * if top-level methods are acceptable and what naming conventions to 1709 * if top-level methods are acceptable and what naming conventions to
1724 * use. 1710 * use.
1725 */ 1711 */
1726 initializerDo(Node node, f(Node node)) { 1712 initializerDo(Node node, f(Node node)) {
1727 SendSet send = node.asSendSet(); 1713 SendSet send = node.asSendSet();
1728 if (send !== null) return f(send.arguments.head); 1714 if (send !== null) return f(send.arguments.head);
1729 } 1715 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/resolver.dart ('k') | lib/compiler/implementation/warnings.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698