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

Side by Side Diff: pkg/analyzer/lib/src/dart/constant/evaluation.dart

Issue 2947443002: Using identical(xxx, typeProvider.yyy) is not compatible with Analysis Driver. (Closed)
Patch Set: Created 3 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.dart.constant.evaluation; 5 library analyzer.src.dart.constant.evaluation;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/context/declared_variables.dart'; 9 import 'package:analyzer/context/declared_variables.dart';
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 // that we can emulate. 468 // that we can emulate.
469 if (constructor.name == "fromEnvironment") { 469 if (constructor.name == "fromEnvironment") {
470 if (!checkFromEnvironmentArguments( 470 if (!checkFromEnvironmentArguments(
471 arguments, argumentValues, namedArgumentValues, definingClass)) { 471 arguments, argumentValues, namedArgumentValues, definingClass)) {
472 errorReporter.reportErrorForNode( 472 errorReporter.reportErrorForNode(
473 CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION, node); 473 CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION, node);
474 return null; 474 return null;
475 } 475 }
476 String variableName = 476 String variableName =
477 argumentCount < 1 ? null : argumentValues[0].toStringValue(); 477 argumentCount < 1 ? null : argumentValues[0].toStringValue();
478 if (identical(definingClass, typeProvider.boolType)) { 478 if (definingClass == typeProvider.boolType) {
479 DartObject valueFromEnvironment; 479 DartObject valueFromEnvironment;
480 valueFromEnvironment = 480 valueFromEnvironment =
481 _declaredVariables.getBool(typeProvider, variableName); 481 _declaredVariables.getBool(typeProvider, variableName);
482 return computeValueFromEnvironment( 482 return computeValueFromEnvironment(
483 valueFromEnvironment, 483 valueFromEnvironment,
484 new DartObjectImpl(typeProvider.boolType, BoolState.FALSE_STATE), 484 new DartObjectImpl(typeProvider.boolType, BoolState.FALSE_STATE),
485 namedArgumentValues); 485 namedArgumentValues);
486 } else if (identical(definingClass, typeProvider.intType)) { 486 } else if (definingClass == typeProvider.intType) {
487 DartObject valueFromEnvironment; 487 DartObject valueFromEnvironment;
488 valueFromEnvironment = 488 valueFromEnvironment =
489 _declaredVariables.getInt(typeProvider, variableName); 489 _declaredVariables.getInt(typeProvider, variableName);
490 return computeValueFromEnvironment( 490 return computeValueFromEnvironment(
491 valueFromEnvironment, 491 valueFromEnvironment,
492 new DartObjectImpl(typeProvider.nullType, NullState.NULL_STATE), 492 new DartObjectImpl(typeProvider.nullType, NullState.NULL_STATE),
493 namedArgumentValues); 493 namedArgumentValues);
494 } else if (identical(definingClass, typeProvider.stringType)) { 494 } else if (definingClass == typeProvider.stringType) {
495 DartObject valueFromEnvironment; 495 DartObject valueFromEnvironment;
496 valueFromEnvironment = 496 valueFromEnvironment =
497 _declaredVariables.getString(typeProvider, variableName); 497 _declaredVariables.getString(typeProvider, variableName);
498 return computeValueFromEnvironment( 498 return computeValueFromEnvironment(
499 valueFromEnvironment, 499 valueFromEnvironment,
500 new DartObjectImpl(typeProvider.nullType, NullState.NULL_STATE), 500 new DartObjectImpl(typeProvider.nullType, NullState.NULL_STATE),
501 namedArgumentValues); 501 namedArgumentValues);
502 } 502 }
503 } else if (constructor.name == "" && 503 } else if (constructor.name == "" &&
504 identical(definingClass, typeProvider.symbolType) && 504 definingClass == typeProvider.symbolType &&
505 argumentCount == 1) { 505 argumentCount == 1) {
506 if (!checkSymbolArguments( 506 if (!checkSymbolArguments(
507 arguments, argumentValues, namedArgumentValues)) { 507 arguments, argumentValues, namedArgumentValues)) {
508 errorReporter.reportErrorForNode( 508 errorReporter.reportErrorForNode(
509 CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION, node); 509 CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION, node);
510 return null; 510 return null;
511 } 511 }
512 String argumentValue = argumentValues[0].toStringValue(); 512 String argumentValue = argumentValues[0].toStringValue();
513 return new DartObjectImpl( 513 return new DartObjectImpl(
514 definingClass, new SymbolState(argumentValue)); 514 definingClass, new SymbolState(argumentValue));
(...skipping 1615 matching lines...) Expand 10 before | Expand all | Expand 10 after
2130 } 2130 }
2131 2131
2132 @override 2132 @override
2133 String toString() { 2133 String toString() {
2134 if (value == null) { 2134 if (value == null) {
2135 return "error"; 2135 return "error";
2136 } 2136 }
2137 return value.toString(); 2137 return value.toString();
2138 } 2138 }
2139 } 2139 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698