| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 analyzer.src.generated.constant; | 5 library analyzer.src.generated.constant; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/ast/visitor.dart'; |
| 9 import 'package:analyzer/dart/element/element.dart'; | 11 import 'package:analyzer/dart/element/element.dart'; |
| 10 import 'package:analyzer/dart/element/type.dart'; | 12 import 'package:analyzer/dart/element/type.dart'; |
| 13 import 'package:analyzer/src/dart/ast/utilities.dart'; |
| 11 import 'package:analyzer/src/dart/element/element.dart'; | 14 import 'package:analyzer/src/dart/element/element.dart'; |
| 12 import 'package:analyzer/src/dart/element/member.dart'; | 15 import 'package:analyzer/src/dart/element/member.dart'; |
| 13 import 'package:analyzer/src/generated/ast.dart'; | |
| 14 import 'package:analyzer/src/generated/engine.dart'; | 16 import 'package:analyzer/src/generated/engine.dart'; |
| 15 import 'package:analyzer/src/generated/engine.dart' | 17 import 'package:analyzer/src/generated/engine.dart' |
| 16 show AnalysisEngine, RecordingErrorListener; | 18 show AnalysisEngine, RecordingErrorListener; |
| 17 import 'package:analyzer/src/generated/error.dart'; | 19 import 'package:analyzer/src/generated/error.dart'; |
| 18 import 'package:analyzer/src/generated/java_core.dart'; | 20 import 'package:analyzer/src/generated/java_core.dart'; |
| 19 import 'package:analyzer/src/generated/resolver.dart' show TypeProvider; | 21 import 'package:analyzer/src/generated/resolver.dart' show TypeProvider; |
| 20 import 'package:analyzer/src/generated/scanner.dart' show Token, TokenType; | 22 import 'package:analyzer/src/generated/scanner.dart' show Token, TokenType; |
| 21 import 'package:analyzer/src/generated/source.dart' show Source; | 23 import 'package:analyzer/src/generated/source.dart' show Source; |
| 22 import 'package:analyzer/src/generated/type_system.dart' | 24 import 'package:analyzer/src/generated/type_system.dart' |
| 23 show TypeSystem, TypeSystemImpl; | 25 show TypeSystem, TypeSystemImpl; |
| (...skipping 2281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2305 if (leftOperand != null && rightOperand != null) { | 2307 if (leftOperand != null && rightOperand != null) { |
| 2306 try { | 2308 try { |
| 2307 return leftOperand.equalEqual(_typeProvider, rightOperand); | 2309 return leftOperand.equalEqual(_typeProvider, rightOperand); |
| 2308 } on EvaluationException catch (exception) { | 2310 } on EvaluationException catch (exception) { |
| 2309 _errorReporter.reportErrorForNode(exception.errorCode, node); | 2311 _errorReporter.reportErrorForNode(exception.errorCode, node); |
| 2310 } | 2312 } |
| 2311 } | 2313 } |
| 2312 return null; | 2314 return null; |
| 2313 } | 2315 } |
| 2314 | 2316 |
| 2315 DartObjectImpl questionQuestion(Expression node, DartObjectImpl leftOperand, | |
| 2316 DartObjectImpl rightOperand) { | |
| 2317 if (leftOperand != null && rightOperand != null) { | |
| 2318 if (leftOperand.isNull) { | |
| 2319 return rightOperand; | |
| 2320 } | |
| 2321 return leftOperand; | |
| 2322 } | |
| 2323 return null; | |
| 2324 } | |
| 2325 | |
| 2326 DartObjectImpl greaterThan(BinaryExpression node, DartObjectImpl leftOperand, | 2317 DartObjectImpl greaterThan(BinaryExpression node, DartObjectImpl leftOperand, |
| 2327 DartObjectImpl rightOperand) { | 2318 DartObjectImpl rightOperand) { |
| 2328 if (leftOperand != null && rightOperand != null) { | 2319 if (leftOperand != null && rightOperand != null) { |
| 2329 try { | 2320 try { |
| 2330 return leftOperand.greaterThan(_typeProvider, rightOperand); | 2321 return leftOperand.greaterThan(_typeProvider, rightOperand); |
| 2331 } on EvaluationException catch (exception) { | 2322 } on EvaluationException catch (exception) { |
| 2332 _errorReporter.reportErrorForNode(exception.errorCode, node); | 2323 _errorReporter.reportErrorForNode(exception.errorCode, node); |
| 2333 } | 2324 } |
| 2334 } | 2325 } |
| 2335 return null; | 2326 return null; |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2470 if (evaluationResult != null) { | 2461 if (evaluationResult != null) { |
| 2471 try { | 2462 try { |
| 2472 return evaluationResult.performToString(_typeProvider); | 2463 return evaluationResult.performToString(_typeProvider); |
| 2473 } on EvaluationException catch (exception) { | 2464 } on EvaluationException catch (exception) { |
| 2474 _errorReporter.reportErrorForNode(exception.errorCode, node); | 2465 _errorReporter.reportErrorForNode(exception.errorCode, node); |
| 2475 } | 2466 } |
| 2476 } | 2467 } |
| 2477 return null; | 2468 return null; |
| 2478 } | 2469 } |
| 2479 | 2470 |
| 2471 DartObjectImpl questionQuestion(Expression node, DartObjectImpl leftOperand, |
| 2472 DartObjectImpl rightOperand) { |
| 2473 if (leftOperand != null && rightOperand != null) { |
| 2474 if (leftOperand.isNull) { |
| 2475 return rightOperand; |
| 2476 } |
| 2477 return leftOperand; |
| 2478 } |
| 2479 return null; |
| 2480 } |
| 2481 |
| 2480 DartObjectImpl remainder(BinaryExpression node, DartObjectImpl leftOperand, | 2482 DartObjectImpl remainder(BinaryExpression node, DartObjectImpl leftOperand, |
| 2481 DartObjectImpl rightOperand) { | 2483 DartObjectImpl rightOperand) { |
| 2482 if (leftOperand != null && rightOperand != null) { | 2484 if (leftOperand != null && rightOperand != null) { |
| 2483 try { | 2485 try { |
| 2484 return leftOperand.remainder(_typeProvider, rightOperand); | 2486 return leftOperand.remainder(_typeProvider, rightOperand); |
| 2485 } on EvaluationException catch (exception) { | 2487 } on EvaluationException catch (exception) { |
| 2486 _errorReporter.reportErrorForNode(exception.errorCode, node); | 2488 _errorReporter.reportErrorForNode(exception.errorCode, node); |
| 2487 } | 2489 } |
| 2488 } | 2490 } |
| 2489 return null; | 2491 return null; |
| (...skipping 2976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5466 return BoolState.from(_element == rightElement); | 5468 return BoolState.from(_element == rightElement); |
| 5467 } else if (rightOperand is DynamicState) { | 5469 } else if (rightOperand is DynamicState) { |
| 5468 return BoolState.UNKNOWN_VALUE; | 5470 return BoolState.UNKNOWN_VALUE; |
| 5469 } | 5471 } |
| 5470 return BoolState.FALSE_STATE; | 5472 return BoolState.FALSE_STATE; |
| 5471 } | 5473 } |
| 5472 | 5474 |
| 5473 @override | 5475 @override |
| 5474 String toString() => _element == null ? "-unknown-" : _element.name; | 5476 String toString() => _element == null ? "-unknown-" : _element.name; |
| 5475 } | 5477 } |
| OLD | NEW |