| 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 946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 957 Type useType(TypeAnnotation annotation, Type type) { | 957 Type useType(TypeAnnotation annotation, Type type) { |
| 958 if (type !== null) { | 958 if (type !== null) { |
| 959 mapping.setType(annotation, type); | 959 mapping.setType(annotation, type); |
| 960 useElement(annotation, type.element); | 960 useElement(annotation, type.element); |
| 961 } | 961 } |
| 962 return type; | 962 return type; |
| 963 } | 963 } |
| 964 | 964 |
| 965 void setupFunction(FunctionExpression node, FunctionElement function) { | 965 void setupFunction(FunctionExpression node, FunctionElement function) { |
| 966 context = new MethodScope(context, function); | 966 context = new MethodScope(context, function); |
| 967 if (node.returnType !== null) resolveTypeAnnotation(node.returnType); | |
| 968 // Put the parameters in scope. | 967 // Put the parameters in scope. |
| 969 FunctionSignature functionParameters = | 968 FunctionSignature functionParameters = |
| 970 function.computeSignature(compiler); | 969 function.computeSignature(compiler); |
| 971 Link<Node> parameterNodes = node.parameters.nodes; | 970 Link<Node> parameterNodes = node.parameters.nodes; |
| 972 functionParameters.forEachParameter((Element element) { | 971 functionParameters.forEachParameter((Element element) { |
| 973 if (element == functionParameters.optionalParameters.head) { | 972 if (element == functionParameters.optionalParameters.head) { |
| 974 NodeList nodes = parameterNodes.head; | 973 NodeList nodes = parameterNodes.head; |
| 975 parameterNodes = nodes.nodes; | 974 parameterNodes = nodes.nodes; |
| 976 } | 975 } |
| 977 VariableDefinitions variableDefinitions = parameterNodes.head; | 976 VariableDefinitions variableDefinitions = parameterNodes.head; |
| (...skipping 1257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2235 | 2234 |
| 2236 TopScope(LibraryElement library) : super(null, library); | 2235 TopScope(LibraryElement library) : super(null, library); |
| 2237 Element lookup(SourceString name) { | 2236 Element lookup(SourceString name) { |
| 2238 return library.find(name); | 2237 return library.find(name); |
| 2239 } | 2238 } |
| 2240 | 2239 |
| 2241 Element add(Element newElement) { | 2240 Element add(Element newElement) { |
| 2242 throw "Cannot add an element in the top scope"; | 2241 throw "Cannot add an element in the top scope"; |
| 2243 } | 2242 } |
| 2244 } | 2243 } |
| OLD | NEW |