| 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 package com.google.dart.compiler.resolver; | 5 package com.google.dart.compiler.resolver; |
| 6 | 6 |
| 7 import com.google.dart.compiler.ErrorCode; | 7 import com.google.dart.compiler.ErrorCode; |
| 8 import com.google.dart.compiler.ast.ASTNodes; | 8 import com.google.dart.compiler.ast.ASTNodes; |
| 9 import com.google.dart.compiler.ast.ASTVisitor; | 9 import com.google.dart.compiler.ast.ASTVisitor; |
| 10 import com.google.dart.compiler.ast.DartCatchBlock; | |
| 11 import com.google.dart.compiler.ast.DartFunction; | 10 import com.google.dart.compiler.ast.DartFunction; |
| 12 import com.google.dart.compiler.ast.DartFunctionTypeAlias; | 11 import com.google.dart.compiler.ast.DartFunctionTypeAlias; |
| 13 import com.google.dart.compiler.ast.DartIdentifier; | 12 import com.google.dart.compiler.ast.DartIdentifier; |
| 14 import com.google.dart.compiler.ast.DartNode; | 13 import com.google.dart.compiler.ast.DartNode; |
| 15 import com.google.dart.compiler.ast.DartParameter; | 14 import com.google.dart.compiler.ast.DartParameter; |
| 16 import com.google.dart.compiler.ast.DartThisExpression; | 15 import com.google.dart.compiler.ast.DartThisExpression; |
| 17 import com.google.dart.compiler.ast.DartTypeNode; | 16 import com.google.dart.compiler.ast.DartTypeNode; |
| 18 import com.google.dart.compiler.ast.DartTypeParameter; | 17 import com.google.dart.compiler.ast.DartTypeParameter; |
| 19 import com.google.dart.compiler.common.HasSourceInfo; | 18 import com.google.dart.compiler.common.HasSourceInfo; |
| 20 import com.google.dart.compiler.type.FunctionType; | 19 import com.google.dart.compiler.type.FunctionType; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 } else { | 86 } else { |
| 88 parameterNames.add(parameterName); | 87 parameterNames.add(parameterName); |
| 89 } | 88 } |
| 90 getContext().getScope().declareElement(parameterName, typeVar); | 89 getContext().getScope().declareElement(parameterName, typeVar); |
| 91 } | 90 } |
| 92 return null; | 91 return null; |
| 93 } | 92 } |
| 94 | 93 |
| 95 @Override | 94 @Override |
| 96 public Element visitParameter(DartParameter node) { | 95 public Element visitParameter(DartParameter node) { |
| 97 ErrorCode typeErrorCode; | |
| 98 ErrorCode wrongNumberErrorCode; | |
| 99 if (node.getParent() instanceof DartCatchBlock) { | |
| 100 typeErrorCode = ResolverErrorCode.NO_SUCH_TYPE; | |
| 101 wrongNumberErrorCode = ResolverErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS; | |
| 102 } else { | |
| 103 typeErrorCode = TypeErrorCode.NO_SUCH_TYPE; | |
| 104 wrongNumberErrorCode = TypeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS; | |
| 105 } | |
| 106 Type type = resolveType(node.getTypeNode(), ASTNodes.isStaticContext(node), | 96 Type type = resolveType(node.getTypeNode(), ASTNodes.isStaticContext(node), |
| 107 ASTNodes.isFactoryContext(node), true, typeErrorCode, wrongNumberErrorCo
de); | 97 ASTNodes.isFactoryContext(node), true, TypeErrorCode.NO_SUCH_TYPE, |
| 98 TypeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS); |
| 108 VariableElement element = | 99 VariableElement element = |
| 109 Elements.parameterElement( | 100 Elements.parameterElement( |
| 110 getEnclosingElement(), | 101 getEnclosingElement(), |
| 111 node, | 102 node, |
| 112 node.getParameterName(), | 103 node.getParameterName(), |
| 113 node.getModifiers()); | 104 node.getModifiers()); |
| 114 List<DartParameter> functionParameters = node.getFunctionParameters(); | 105 List<DartParameter> functionParameters = node.getFunctionParameters(); |
| 115 if (functionParameters != null) { | 106 if (functionParameters != null) { |
| 116 List<VariableElement> parameterElements = | 107 List<VariableElement> parameterElements = |
| 117 new ArrayList<VariableElement>(functionParameters.size()); | 108 new ArrayList<VariableElement>(functionParameters.size()); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 return null; | 153 return null; |
| 163 } | 154 } |
| 164 node.setElement(element); | 155 node.setElement(element); |
| 165 return element; | 156 return element; |
| 166 } | 157 } |
| 167 | 158 |
| 168 CoreTypeProvider getTypeProvider() { | 159 CoreTypeProvider getTypeProvider() { |
| 169 return typeProvider; | 160 return typeProvider; |
| 170 } | 161 } |
| 171 } | 162 } |
| OLD | NEW |