Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 TreeElements { | 5 interface TreeElements { |
| 6 Element operator[](Node node); | 6 Element operator[](Node node); |
| 7 Selector getSelector(Send send); | 7 Selector getSelector(Send send); |
| 8 Type getType(TypeAnnotation annotation); | 8 Type getType(TypeAnnotation annotation); |
| 9 } | 9 } |
| 10 | 10 |
| (...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 934 Type useType(TypeAnnotation annotation, Type type) { | 934 Type useType(TypeAnnotation annotation, Type type) { |
| 935 if (type !== null) { | 935 if (type !== null) { |
| 936 mapping.setType(annotation, type); | 936 mapping.setType(annotation, type); |
| 937 useElement(annotation, type.element); | 937 useElement(annotation, type.element); |
| 938 } | 938 } |
| 939 return type; | 939 return type; |
| 940 } | 940 } |
| 941 | 941 |
| 942 void setupFunction(FunctionExpression node, FunctionElement function) { | 942 void setupFunction(FunctionExpression node, FunctionElement function) { |
| 943 context = new MethodScope(context, function); | 943 context = new MethodScope(context, function); |
| 944 if (node.returnType !== null) resolveTypeAnnotation(node.returnType); | |
|
ahe
2012/08/02 18:37:14
I think you should be able to revert this since yo
| |
| 944 // Put the parameters in scope. | 945 // Put the parameters in scope. |
| 945 FunctionSignature functionParameters = | 946 FunctionSignature functionParameters = |
| 946 function.computeSignature(compiler); | 947 function.computeSignature(compiler); |
| 947 Link<Node> parameterNodes = node.parameters.nodes; | 948 Link<Node> parameterNodes = node.parameters.nodes; |
| 948 functionParameters.forEachParameter((Element element) { | 949 functionParameters.forEachParameter((Element element) { |
| 949 if (element == functionParameters.optionalParameters.head) { | 950 if (element == functionParameters.optionalParameters.head) { |
| 950 NodeList nodes = parameterNodes.head; | 951 NodeList nodes = parameterNodes.head; |
| 951 parameterNodes = nodes.nodes; | 952 parameterNodes = nodes.nodes; |
| 952 } | 953 } |
| 953 VariableDefinitions variableDefinitions = parameterNodes.head; | 954 VariableDefinitions variableDefinitions = parameterNodes.head; |
| (...skipping 1257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2211 | 2212 |
| 2212 TopScope(LibraryElement library) : super(null, library); | 2213 TopScope(LibraryElement library) : super(null, library); |
| 2213 Element lookup(SourceString name) { | 2214 Element lookup(SourceString name) { |
| 2214 return library.find(name); | 2215 return library.find(name); |
| 2215 } | 2216 } |
| 2216 | 2217 |
| 2217 Element add(Element newElement) { | 2218 Element add(Element newElement) { |
| 2218 throw "Cannot add an element in the top scope"; | 2219 throw "Cannot add an element in the top scope"; |
| 2219 } | 2220 } |
| 2220 } | 2221 } |
| OLD | NEW |