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 library types; | 5 library types; |
6 | 6 |
7 import '../common.dart'; | 7 import '../common.dart'; |
8 import '../common/backend_api.dart' show | 8 import '../common/backend_api.dart' show |
9 Backend; | 9 Backend; |
10 import '../common/tasks.dart' show | 10 import '../common/tasks.dart' show |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 typesInferrer.analyzeMain(mainElement); | 279 typesInferrer.analyzeMain(mainElement); |
280 }); | 280 }); |
281 typesInferrer.clear(); | 281 typesInferrer.clear(); |
282 } | 282 } |
283 | 283 |
284 /** | 284 /** |
285 * Return the (inferred) guaranteed type of [element] or null. | 285 * Return the (inferred) guaranteed type of [element] or null. |
286 */ | 286 */ |
287 TypeMask getGuaranteedTypeOfElement(Element element) { | 287 TypeMask getGuaranteedTypeOfElement(Element element) { |
288 return measure(() { | 288 return measure(() { |
| 289 // TODO(24489): trust some JsInterop types. |
| 290 if (element.isJsInterop) { |
| 291 return dynamicType; |
| 292 } |
289 TypeMask guaranteedType = typesInferrer.getTypeOfElement(element); | 293 TypeMask guaranteedType = typesInferrer.getTypeOfElement(element); |
290 return guaranteedType; | 294 return guaranteedType; |
291 }); | 295 }); |
292 } | 296 } |
293 | 297 |
294 TypeMask getGuaranteedReturnTypeOfElement(Element element) { | 298 TypeMask getGuaranteedReturnTypeOfElement(Element element) { |
295 return measure(() { | 299 return measure(() { |
| 300 // TODO(24489): trust some JsInterop types. |
| 301 if (element.isJsInterop) { |
| 302 return dynamicType; |
| 303 } |
| 304 |
296 TypeMask guaranteedType = | 305 TypeMask guaranteedType = |
297 typesInferrer.getReturnTypeOfElement(element); | 306 typesInferrer.getReturnTypeOfElement(element); |
298 return guaranteedType; | 307 return guaranteedType; |
299 }); | 308 }); |
300 } | 309 } |
301 | 310 |
302 /** | 311 /** |
303 * Return the (inferred) guaranteed type of [node] or null. | 312 * Return the (inferred) guaranteed type of [node] or null. |
304 * [node] must be an AST node of [owner]. | 313 * [node] must be an AST node of [owner]. |
305 */ | 314 */ |
306 TypeMask getGuaranteedTypeOfNode(owner, node) { | 315 TypeMask getGuaranteedTypeOfNode(owner, node) { |
307 return measure(() { | 316 return measure(() { |
308 TypeMask guaranteedType = typesInferrer.getTypeOfNode(owner, node); | 317 TypeMask guaranteedType = typesInferrer.getTypeOfNode(owner, node); |
309 return guaranteedType; | 318 return guaranteedType; |
310 }); | 319 }); |
311 } | 320 } |
312 | 321 |
313 /** | 322 /** |
314 * Return the (inferred) guaranteed type of [selector] or null. | 323 * Return the (inferred) guaranteed type of [selector] or null. |
315 */ | 324 */ |
316 TypeMask getGuaranteedTypeOfSelector(Selector selector, TypeMask mask) { | 325 TypeMask getGuaranteedTypeOfSelector(Selector selector, TypeMask mask) { |
317 return measure(() { | 326 return measure(() { |
318 TypeMask guaranteedType = | 327 TypeMask guaranteedType = |
319 typesInferrer.getTypeOfSelector(selector, mask); | 328 typesInferrer.getTypeOfSelector(selector, mask); |
320 return guaranteedType; | 329 return guaranteedType; |
321 }); | 330 }); |
322 } | 331 } |
323 } | 332 } |
OLD | NEW |