Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1365)

Unified Diff: pkg/analyzer/lib/src/generated/resolver.dart

Issue 1410643003: Add a public API for the results of constant evaluation (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/lib/src/generated/resolver.dart
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index 84f0f6b2bccd175b8f2f3cef08dd0f8da37aa873..47a68ee9fd1bd1b16266b070b1e7f5d5d7126706 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -1521,14 +1521,14 @@ class DeadCodeVerifier extends RecursiveAstVisitor<Object> {
if (!_isDebugConstant(lhsCondition)) {
EvaluationResultImpl lhsResult = _getConstantBooleanValue(lhsCondition);
if (lhsResult != null) {
- if (lhsResult.value.isTrue && isBarBar) {
+ if (lhsResult.value.toBoolValue() == true && isBarBar) {
// report error on else block: true || !e!
_errorReporter.reportErrorForNode(
HintCode.DEAD_CODE, node.rightOperand);
// only visit the LHS:
_safelyVisit(lhsCondition);
return null;
- } else if (lhsResult.value.isFalse && isAmpAmp) {
+ } else if (lhsResult.value.toBoolValue() == false && isAmpAmp) {
// report error on if block: false && !e!
_errorReporter.reportErrorForNode(
HintCode.DEAD_CODE, node.rightOperand);
@@ -1582,7 +1582,7 @@ class DeadCodeVerifier extends RecursiveAstVisitor<Object> {
EvaluationResultImpl result =
_getConstantBooleanValue(conditionExpression);
if (result != null) {
- if (result.value.isTrue) {
+ if (result.value.toBoolValue() == true) {
// report error on else block: true ? 1 : !2!
_errorReporter.reportErrorForNode(
HintCode.DEAD_CODE, node.elseExpression);
@@ -1608,7 +1608,7 @@ class DeadCodeVerifier extends RecursiveAstVisitor<Object> {
EvaluationResultImpl result =
_getConstantBooleanValue(conditionExpression);
if (result != null) {
- if (result.value.isTrue) {
+ if (result.value.toBoolValue() == true) {
// report error on else block: if(true) {} else {!}
Statement elseStatement = node.elseStatement;
if (elseStatement != null) {
@@ -1717,7 +1717,7 @@ class DeadCodeVerifier extends RecursiveAstVisitor<Object> {
EvaluationResultImpl result =
_getConstantBooleanValue(conditionExpression);
if (result != null) {
- if (result.value.isFalse) {
+ if (result.value.toBoolValue() == false) {
// report error on if block: while (false) {!}
_errorReporter.reportErrorForNode(HintCode.DEAD_CODE, node.body);
return null;
@@ -15722,11 +15722,6 @@ class VariableResolverVisitor extends ScopedVisitor {
}
@override
- Object visitTypeName(TypeName node) {
- return null;
- }
-
- @override
Object visitSimpleIdentifier(SimpleIdentifier node) {
// Ignore if already resolved - declaration or type.
if (node.inDeclarationContext()) {
@@ -15738,7 +15733,8 @@ class VariableResolverVisitor extends ScopedVisitor {
return null;
} else if (parent is ConstructorDeclaration && parent.returnType == node) {
return null;
- } else if (parent is ConstructorFieldInitializer && parent.fieldName == node) {
+ } else if (parent is ConstructorFieldInitializer &&
+ parent.fieldName == node) {
return null;
}
// Ignore if qualified.
@@ -15791,6 +15787,11 @@ class VariableResolverVisitor extends ScopedVisitor {
}
return null;
}
+
+ @override
+ Object visitTypeName(TypeName node) {
+ return null;
+ }
}
class _ConstantVerifier_validateInitializerExpression extends ConstantVisitor {
« no previous file with comments | « pkg/analyzer/lib/src/generated/element_handle.dart ('k') | pkg/analyzer/test/generated/all_the_rest_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698