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

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

Issue 17825002: Remove support for 'argument definitions test' from dart2js. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove SentinelConstant. 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
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
11 /// A set of additional dependencies. See [registerDependency] below. 11 /// A set of additional dependencies. See [registerDependency] below.
12 Set<Element> get otherDependencies; 12 Set<Element> get otherDependencies;
13 13
14 Element operator[](Node node); 14 Element operator[](Node node);
15 Selector getSelector(Send send); 15 Selector getSelector(Send send);
16 Selector getGetterSelectorInComplexSendSet(SendSet node); 16 Selector getGetterSelectorInComplexSendSet(SendSet node);
17 Selector getOperatorSelectorInComplexSendSet(SendSet node); 17 Selector getOperatorSelectorInComplexSendSet(SendSet node);
18 DartType getType(Node node); 18 DartType getType(Node node);
19 bool isParameterChecked(Element element);
20 void setSelector(Node node, Selector selector); 19 void setSelector(Node node, Selector selector);
21 void setGetterSelectorInComplexSendSet(SendSet node, Selector selector); 20 void setGetterSelectorInComplexSendSet(SendSet node, Selector selector);
22 void setOperatorSelectorInComplexSendSet(SendSet node, Selector selector); 21 void setOperatorSelectorInComplexSendSet(SendSet node, Selector selector);
23 Selector getIteratorSelector(ForIn node); 22 Selector getIteratorSelector(ForIn node);
24 Selector getMoveNextSelector(ForIn node); 23 Selector getMoveNextSelector(ForIn node);
25 Selector getCurrentSelector(ForIn node); 24 Selector getCurrentSelector(ForIn node);
26 Selector setIteratorSelector(ForIn node, Selector selector); 25 Selector setIteratorSelector(ForIn node, Selector selector);
27 Selector setMoveNextSelector(ForIn node, Selector selector); 26 Selector setMoveNextSelector(ForIn node, Selector selector);
28 Selector setCurrentSelector(ForIn node, Selector selector); 27 Selector setCurrentSelector(ForIn node, Selector selector);
29 28
30 /// Register additional dependencies required by [currentElement]. 29 /// Register additional dependencies required by [currentElement].
31 /// For example, elements that are used by a backend. 30 /// For example, elements that are used by a backend.
32 void registerDependency(Element element); 31 void registerDependency(Element element);
33 } 32 }
34 33
35 class TreeElementMapping implements TreeElements { 34 class TreeElementMapping implements TreeElements {
36 final Element currentElement; 35 final Element currentElement;
37 final Map<Spannable, Selector> selectors = 36 final Map<Spannable, Selector> selectors =
38 new LinkedHashMap<Spannable, Selector>(); 37 new LinkedHashMap<Spannable, Selector>();
39 final Map<Node, DartType> types = new LinkedHashMap<Node, DartType>(); 38 final Map<Node, DartType> types = new LinkedHashMap<Node, DartType>();
40 final Set<Element> checkedParameters = new LinkedHashSet<Element>();
41 final Set<Node> superUses = new LinkedHashSet<Node>(); 39 final Set<Node> superUses = new LinkedHashSet<Node>();
42 final Set<Element> otherDependencies = new LinkedHashSet<Element>(); 40 final Set<Element> otherDependencies = new LinkedHashSet<Element>();
43 final int hashCode = ++hashCodeCounter; 41 final int hashCode = ++hashCodeCounter;
44 static int hashCodeCounter = 0; 42 static int hashCodeCounter = 0;
45 43
46 TreeElementMapping(this.currentElement); 44 TreeElementMapping(this.currentElement);
47 45
48 operator []=(Node node, Element element) { 46 operator []=(Node node, Element element) {
49 assert(invariant(node, () { 47 assert(invariant(node, () {
50 FunctionExpression functionExpression = node.asFunctionExpression(); 48 FunctionExpression functionExpression = node.asFunctionExpression();
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 } 125 }
128 126
129 Selector setCurrentSelector(ForIn node, Selector selector) { 127 Selector setCurrentSelector(ForIn node, Selector selector) {
130 selectors[node.inToken] = selector; 128 selectors[node.inToken] = selector;
131 } 129 }
132 130
133 Selector getCurrentSelector(ForIn node) { 131 Selector getCurrentSelector(ForIn node) {
134 return selectors[node.inToken]; 132 return selectors[node.inToken];
135 } 133 }
136 134
137 bool isParameterChecked(Element element) {
138 return checkedParameters.contains(element);
139 }
140
141 void registerDependency(Element element) { 135 void registerDependency(Element element) {
142 otherDependencies.add(element.implementation); 136 otherDependencies.add(element.implementation);
143 } 137 }
144 138
145 String toString() => 'TreeElementMapping($currentElement)'; 139 String toString() => 'TreeElementMapping($currentElement)';
146 } 140 }
147 141
148 class ResolverTask extends CompilerTask { 142 class ResolverTask extends CompilerTask {
149 ResolverTask(Compiler compiler) : super(compiler); 143 ResolverTask(Compiler compiler) : super(compiler);
150 144
(...skipping 2127 matching lines...) Expand 10 before | Expand all | Expand 10 after
2278 if (type != null) { 2272 if (type != null) {
2279 compiler.enqueuer.resolution.registerIsCheck(type, mapping); 2273 compiler.enqueuer.resolution.registerIsCheck(type, mapping);
2280 } 2274 }
2281 resolvedArguments = true; 2275 resolvedArguments = true;
2282 } else if (operatorString == 'as') { 2276 } else if (operatorString == 'as') {
2283 DartType type = resolveTypeRequired(node.arguments.head); 2277 DartType type = resolveTypeRequired(node.arguments.head);
2284 if (type != null) { 2278 if (type != null) {
2285 compiler.enqueuer.resolution.registerAsCheck(type, mapping); 2279 compiler.enqueuer.resolution.registerAsCheck(type, mapping);
2286 } 2280 }
2287 resolvedArguments = true; 2281 resolvedArguments = true;
2288 } else if (identical(operatorString, '?')) {
2289 Element parameter = mapping[node.receiver];
2290 if (parameter == null
2291 || !identical(parameter.kind, ElementKind.PARAMETER)) {
2292 error(node.receiver, MessageKind.PARAMETER_NAME_EXPECTED);
2293 } else {
2294 mapping.checkedParameters.add(parameter);
2295 }
2296 } 2282 }
2297 } 2283 }
2298 2284
2299 if (!resolvedArguments) { 2285 if (!resolvedArguments) {
2300 resolveArguments(node.argumentsNode); 2286 resolveArguments(node.argumentsNode);
2301 } 2287 }
2302 2288
2303 // If the selector is null, it means that we will not be generating 2289 // If the selector is null, it means that we will not be generating
2304 // code for this as a send. 2290 // code for this as a send.
2305 Selector selector = mapping.getSelector(node); 2291 Selector selector = mapping.getSelector(node);
(...skipping 1745 matching lines...) Expand 10 before | Expand all | Expand 10 after
4051 return e; 4037 return e;
4052 } 4038 }
4053 4039
4054 /// Assumed to be called by [resolveRedirectingFactory]. 4040 /// Assumed to be called by [resolveRedirectingFactory].
4055 Element visitReturn(Return node) { 4041 Element visitReturn(Return node) {
4056 Node expression = node.expression; 4042 Node expression = node.expression;
4057 return finishConstructorReference(visit(expression), 4043 return finishConstructorReference(visit(expression),
4058 expression, expression); 4044 expression, expression);
4059 } 4045 }
4060 } 4046 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698