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.ASTVisitor; | 8 import com.google.dart.compiler.ast.ASTVisitor; |
9 import com.google.dart.compiler.ast.DartCatchBlock; | 9 import com.google.dart.compiler.ast.DartCatchBlock; |
10 import com.google.dart.compiler.ast.DartFunction; | 10 import com.google.dart.compiler.ast.DartFunction; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 ErrorCode errorCode, ErrorCode wrongNumberErrorCode) { | 130 ErrorCode errorCode, ErrorCode wrongNumberErrorCode) { |
131 if (node == null) { | 131 if (node == null) { |
132 return getTypeProvider().getDynamicType(); | 132 return getTypeProvider().getDynamicType(); |
133 } | 133 } |
134 assert node.getType() == null || node.getType() instanceof DynamicType; | 134 assert node.getType() == null || node.getType() instanceof DynamicType; |
135 Type type = getContext().resolveType(node, isStatic, isFactory, errorCode, w
rongNumberErrorCode); | 135 Type type = getContext().resolveType(node, isStatic, isFactory, errorCode, w
rongNumberErrorCode); |
136 if (type == null) { | 136 if (type == null) { |
137 type = getTypeProvider().getDynamicType(); | 137 type = getTypeProvider().getDynamicType(); |
138 } | 138 } |
139 node.setType(type); | 139 node.setType(type); |
140 recordElement(node.getIdentifier(), type.getElement()); | 140 Element element = type.getElement(); |
| 141 recordElement(node.getIdentifier(), element); |
| 142 if (element != null && element.getMetadata().isDeprecated()) { |
| 143 getContext().onError(node.getIdentifier(), TypeErrorCode.DEPRECATED_ELEMEN
T, element.getName()); |
| 144 } |
141 return type; | 145 return type; |
142 } | 146 } |
143 | 147 |
144 protected <E extends Element> E recordElement(DartNode node, E element) { | 148 protected <E extends Element> E recordElement(DartNode node, E element) { |
145 node.getClass(); | 149 node.getClass(); |
146 if (element == null) { | 150 if (element == null) { |
147 // TypeAnalyzer will diagnose unresolved identifiers. | 151 // TypeAnalyzer will diagnose unresolved identifiers. |
148 return null; | 152 return null; |
149 } | 153 } |
150 node.setElement(element); | 154 node.setElement(element); |
151 return element; | 155 return element; |
152 } | 156 } |
153 | 157 |
154 CoreTypeProvider getTypeProvider() { | 158 CoreTypeProvider getTypeProvider() { |
155 return typeProvider; | 159 return typeProvider; |
156 } | 160 } |
157 } | 161 } |
OLD | NEW |