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

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

Issue 189803004: Translate private Java members to private Dart members. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Tweaks Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « pkg/analyzer/lib/src/generated/ast.dart ('k') | pkg/analyzer/lib/src/generated/element.dart » ('j') | 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 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine.constant; 8 library engine.constant;
9 9
10 import 'java_core.dart'; 10 import 'java_core.dart';
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 _declarationMap = _constantFinder.variableMap; 319 _declarationMap = _constantFinder.variableMap;
320 for (MapEntry<VariableElement, VariableDeclaration> entry in getMapEntrySet( _declarationMap)) { 320 for (MapEntry<VariableElement, VariableDeclaration> entry in getMapEntrySet( _declarationMap)) {
321 VariableElement element = entry.getKey(); 321 VariableElement element = entry.getKey();
322 ReferenceFinder referenceFinder = new ReferenceFinder(element, _referenceG raph); 322 ReferenceFinder referenceFinder = new ReferenceFinder(element, _referenceG raph);
323 _referenceGraph.addNode(element); 323 _referenceGraph.addNode(element);
324 entry.getValue().initializer.accept(referenceFinder); 324 entry.getValue().initializer.accept(referenceFinder);
325 } 325 }
326 while (!_referenceGraph.isEmpty) { 326 while (!_referenceGraph.isEmpty) {
327 VariableElement element = _referenceGraph.removeSink(); 327 VariableElement element = _referenceGraph.removeSink();
328 while (element != null) { 328 while (element != null) {
329 computeValueFor(element); 329 _computeValueFor(element);
330 element = _referenceGraph.removeSink(); 330 element = _referenceGraph.removeSink();
331 } 331 }
332 if (!_referenceGraph.isEmpty) { 332 if (!_referenceGraph.isEmpty) {
333 List<VariableElement> variablesInCycle = _referenceGraph.findCycle(); 333 List<VariableElement> variablesInCycle = _referenceGraph.findCycle();
334 if (variablesInCycle == null) { 334 if (variablesInCycle == null) {
335 // 335 //
336 // This should not happen. Either the graph should be empty, or there should be at least 336 // This should not happen. Either the graph should be empty, or there should be at least
337 // one sink, or there should be a cycle. If this does happen we exit t o prevent an 337 // one sink, or there should be a cycle. If this does happen we exit t o prevent an
338 // infinite loop. 338 // infinite loop.
339 // 339 //
340 AnalysisEngine.instance.logger.logError("Exiting constant value comput er with ${_referenceGraph.nodeCount} variables that are neither sinks nor in a c ycle"); 340 AnalysisEngine.instance.logger.logError("Exiting constant value comput er with ${_referenceGraph.nodeCount} variables that are neither sinks nor in a c ycle");
341 return; 341 return;
342 } 342 }
343 for (VariableElement variable in variablesInCycle) { 343 for (VariableElement variable in variablesInCycle) {
344 generateCycleError(variablesInCycle, variable); 344 _generateCycleError(variablesInCycle, variable);
345 } 345 }
346 _referenceGraph.removeAllNodes(variablesInCycle); 346 _referenceGraph.removeAllNodes(variablesInCycle);
347 } 347 }
348 } 348 }
349 } 349 }
350 350
351 /** 351 /**
352 * Compute a value for the given variable. 352 * Compute a value for the given variable.
353 * 353 *
354 * @param variable the variable for which a value is to be computed 354 * @param variable the variable for which a value is to be computed
355 */ 355 */
356 void computeValueFor(VariableElement variable) { 356 void _computeValueFor(VariableElement variable) {
357 VariableDeclaration declaration = _declarationMap[variable]; 357 VariableDeclaration declaration = _declarationMap[variable];
358 if (declaration == null) { 358 if (declaration == null) {
359 // 359 //
360 // The declaration will be null when the variable was added to the graph a s a result of being 360 // The declaration will be null when the variable was added to the graph a s a result of being
361 // referenced by another variable but is not defined in the compilation un its that were added 361 // referenced by another variable but is not defined in the compilation un its that were added
362 // to this computer. In such cases, the variable should already have a val ue associated with 362 // to this computer. In such cases, the variable should already have a val ue associated with
363 // it, but we don't bother to check because there's nothing we can do abou t it at this point. 363 // it, but we don't bother to check because there's nothing we can do abou t it at this point.
364 // 364 //
365 return; 365 return;
366 } 366 }
(...skipping 10 matching lines...) Expand all
377 } 377 }
378 378
379 /** 379 /**
380 * Generate an error indicating that the given variable is not a valid compile -time constant 380 * Generate an error indicating that the given variable is not a valid compile -time constant
381 * because it references at least one of the variables in the given cycle, eac h of which directly 381 * because it references at least one of the variables in the given cycle, eac h of which directly
382 * or indirectly references the variable. 382 * or indirectly references the variable.
383 * 383 *
384 * @param variablesInCycle the variables in the cycle that includes the given variable 384 * @param variablesInCycle the variables in the cycle that includes the given variable
385 * @param variable the variable that is not a valid compile-time constant 385 * @param variable the variable that is not a valid compile-time constant
386 */ 386 */
387 void generateCycleError(List<VariableElement> variablesInCycle, VariableElemen t variable) { 387 void _generateCycleError(List<VariableElement> variablesInCycle, VariableEleme nt variable) {
388 } 388 }
389 } 389 }
390 390
391 /** 391 /**
392 * Instances of the class `ConstantVisitor` evaluate constant expressions to pro duce their 392 * Instances of the class `ConstantVisitor` evaluate constant expressions to pro duce their
393 * compile-time value. According to the Dart Language Specification: <blockquote > A constant 393 * compile-time value. According to the Dart Language Specification: <blockquote > A constant
394 * expression is one of the following: 394 * expression is one of the following:
395 * * A literal number. 395 * * A literal number.
396 * * A literal boolean. 396 * * A literal boolean.
397 * * A literal string where any interpolated expression is a compile-time consta nt that evaluates 397 * * A literal string where any interpolated expression is a compile-time consta nt that evaluates
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 return result; 463 return result;
464 } 464 }
465 465
466 EvaluationResultImpl visitBinaryExpression(BinaryExpression node) { 466 EvaluationResultImpl visitBinaryExpression(BinaryExpression node) {
467 EvaluationResultImpl leftResult = node.leftOperand.accept(this); 467 EvaluationResultImpl leftResult = node.leftOperand.accept(this);
468 EvaluationResultImpl rightResult = node.rightOperand.accept(this); 468 EvaluationResultImpl rightResult = node.rightOperand.accept(this);
469 TokenType operatorType = node.operator.type; 469 TokenType operatorType = node.operator.type;
470 // 'null' is almost never good operand 470 // 'null' is almost never good operand
471 if (operatorType != TokenType.BANG_EQ && operatorType != TokenType.EQ_EQ) { 471 if (operatorType != TokenType.BANG_EQ && operatorType != TokenType.EQ_EQ) {
472 if (leftResult is ValidResult && leftResult.isNull || rightResult is Valid Result && rightResult.isNull) { 472 if (leftResult is ValidResult && leftResult.isNull || rightResult is Valid Result && rightResult.isNull) {
473 return error(node, CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION); 473 return _error(node, CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION);
474 } 474 }
475 } 475 }
476 // evaluate operator 476 // evaluate operator
477 while (true) { 477 while (true) {
478 if (operatorType == TokenType.AMPERSAND) { 478 if (operatorType == TokenType.AMPERSAND) {
479 return leftResult.bitAnd(_typeProvider, node, rightResult); 479 return leftResult.bitAnd(_typeProvider, node, rightResult);
480 } else if (operatorType == TokenType.AMPERSAND_AMPERSAND) { 480 } else if (operatorType == TokenType.AMPERSAND_AMPERSAND) {
481 return leftResult.logicalAnd(_typeProvider, node, rightResult); 481 return leftResult.logicalAnd(_typeProvider, node, rightResult);
482 } else if (operatorType == TokenType.BANG_EQ) { 482 } else if (operatorType == TokenType.BANG_EQ) {
483 return leftResult.notEqual(_typeProvider, node, rightResult); 483 return leftResult.notEqual(_typeProvider, node, rightResult);
(...skipping 24 matching lines...) Expand all
508 } else if (operatorType == TokenType.PLUS) { 508 } else if (operatorType == TokenType.PLUS) {
509 return leftResult.add(_typeProvider, node, rightResult); 509 return leftResult.add(_typeProvider, node, rightResult);
510 } else if (operatorType == TokenType.STAR) { 510 } else if (operatorType == TokenType.STAR) {
511 return leftResult.times(_typeProvider, node, rightResult); 511 return leftResult.times(_typeProvider, node, rightResult);
512 } else if (operatorType == TokenType.SLASH) { 512 } else if (operatorType == TokenType.SLASH) {
513 return leftResult.divide(_typeProvider, node, rightResult); 513 return leftResult.divide(_typeProvider, node, rightResult);
514 } else if (operatorType == TokenType.TILDE_SLASH) { 514 } else if (operatorType == TokenType.TILDE_SLASH) {
515 return leftResult.integerDivide(_typeProvider, node, rightResult); 515 return leftResult.integerDivide(_typeProvider, node, rightResult);
516 } else { 516 } else {
517 // TODO(brianwilkerson) Figure out which error to report. 517 // TODO(brianwilkerson) Figure out which error to report.
518 return error(node, null); 518 return _error(node, null);
519 } 519 }
520 break; 520 break;
521 } 521 }
522 } 522 }
523 523
524 EvaluationResultImpl visitBooleanLiteral(BooleanLiteral node) => valid(_typePr ovider.boolType, BoolState.from(node.value)); 524 EvaluationResultImpl visitBooleanLiteral(BooleanLiteral node) => _valid(_typeP rovider.boolType, BoolState.from(node.value));
525 525
526 EvaluationResultImpl visitConditionalExpression(ConditionalExpression node) { 526 EvaluationResultImpl visitConditionalExpression(ConditionalExpression node) {
527 Expression condition = node.condition; 527 Expression condition = node.condition;
528 EvaluationResultImpl conditionResult = condition.accept(this); 528 EvaluationResultImpl conditionResult = condition.accept(this);
529 EvaluationResultImpl thenResult = node.thenExpression.accept(this); 529 EvaluationResultImpl thenResult = node.thenExpression.accept(this);
530 EvaluationResultImpl elseResult = node.elseExpression.accept(this); 530 EvaluationResultImpl elseResult = node.elseExpression.accept(this);
531 if (conditionResult is ErrorResult) { 531 if (conditionResult is ErrorResult) {
532 return union(union(conditionResult as ErrorResult, thenResult), elseResult ); 532 return _union(_union(conditionResult as ErrorResult, thenResult), elseResu lt);
533 } else if (!(conditionResult as ValidResult).isBool) { 533 } else if (!(conditionResult as ValidResult).isBool) {
534 return new ErrorResult.con1(condition, CompileTimeErrorCode.CONST_EVAL_TYP E_BOOL); 534 return new ErrorResult.con1(condition, CompileTimeErrorCode.CONST_EVAL_TYP E_BOOL);
535 } else if (thenResult is ErrorResult) { 535 } else if (thenResult is ErrorResult) {
536 return union(thenResult, elseResult); 536 return _union(thenResult, elseResult);
537 } else if (elseResult is ErrorResult) { 537 } else if (elseResult is ErrorResult) {
538 return elseResult; 538 return elseResult;
539 } 539 }
540 conditionResult = conditionResult.applyBooleanConversion(_typeProvider, cond ition); 540 conditionResult = conditionResult.applyBooleanConversion(_typeProvider, cond ition);
541 if (conditionResult is ErrorResult) { 541 if (conditionResult is ErrorResult) {
542 return conditionResult; 542 return conditionResult;
543 } 543 }
544 ValidResult validResult = conditionResult as ValidResult; 544 ValidResult validResult = conditionResult as ValidResult;
545 if (validResult.isTrue) { 545 if (validResult.isTrue) {
546 return thenResult; 546 return thenResult;
547 } else if (validResult.isFalse) { 547 } else if (validResult.isFalse) {
548 return elseResult; 548 return elseResult;
549 } 549 }
550 InterfaceType thenType = (thenResult as ValidResult).value.type; 550 InterfaceType thenType = (thenResult as ValidResult).value.type;
551 InterfaceType elseType = (elseResult as ValidResult).value.type; 551 InterfaceType elseType = (elseResult as ValidResult).value.type;
552 return validWithUnknownValue(thenType.getLeastUpperBound(elseType) as Interf aceType); 552 return _validWithUnknownValue(thenType.getLeastUpperBound(elseType) as Inter faceType);
553 } 553 }
554 554
555 EvaluationResultImpl visitDoubleLiteral(DoubleLiteral node) => valid(_typeProv ider.doubleType, new DoubleState(node.value)); 555 EvaluationResultImpl visitDoubleLiteral(DoubleLiteral node) => _valid(_typePro vider.doubleType, new DoubleState(node.value));
556 556
557 EvaluationResultImpl visitInstanceCreationExpression(InstanceCreationExpressio n node) { 557 EvaluationResultImpl visitInstanceCreationExpression(InstanceCreationExpressio n node) {
558 if (!node.isConst) { 558 if (!node.isConst) {
559 // TODO(brianwilkerson) Figure out which error to report. 559 // TODO(brianwilkerson) Figure out which error to report.
560 return error(node, null); 560 return _error(node, null);
561 } 561 }
562 ConstructorElement constructor = node.staticElement; 562 ConstructorElement constructor = node.staticElement;
563 if (constructor != null && constructor.isConst) { 563 if (constructor != null && constructor.isConst) {
564 NodeList<Expression> arguments = node.argumentList.arguments; 564 NodeList<Expression> arguments = node.argumentList.arguments;
565 int argumentCount = arguments.length; 565 int argumentCount = arguments.length;
566 List<DartObjectImpl> argumentValues = new List<DartObjectImpl>(argumentCou nt); 566 List<DartObjectImpl> argumentValues = new List<DartObjectImpl>(argumentCou nt);
567 Map<String, DartObjectImpl> namedArgumentValues = new Map<String, DartObje ctImpl>(); 567 Map<String, DartObjectImpl> namedArgumentValues = new Map<String, DartObje ctImpl>();
568 for (int i = 0; i < argumentCount; i++) { 568 for (int i = 0; i < argumentCount; i++) {
569 Expression argument = arguments[i]; 569 Expression argument = arguments[i];
570 if (argument is NamedExpression) { 570 if (argument is NamedExpression) {
571 NamedExpression namedExpression = argument; 571 NamedExpression namedExpression = argument;
572 String name = namedExpression.name.label.name; 572 String name = namedExpression.name.label.name;
573 namedArgumentValues[name] = valueOf(namedExpression.expression); 573 namedArgumentValues[name] = _valueOf(namedExpression.expression);
574 argumentValues[i] = null2; 574 argumentValues[i] = null2;
575 } else { 575 } else {
576 argumentValues[i] = valueOf(argument); 576 argumentValues[i] = _valueOf(argument);
577 } 577 }
578 } 578 }
579 InterfaceType definingClass = constructor.returnType as InterfaceType; 579 InterfaceType definingClass = constructor.returnType as InterfaceType;
580 if (definingClass.element.library.isDartCore) { 580 if (definingClass.element.library.isDartCore) {
581 String className = definingClass.name; 581 String className = definingClass.name;
582 if (className == "Symbol" && argumentCount == 1) { 582 if (className == "Symbol" && argumentCount == 1) {
583 String argumentValue = argumentValues[0].stringValue; 583 String argumentValue = argumentValues[0].stringValue;
584 if (argumentValue != null) { 584 if (argumentValue != null) {
585 return valid(definingClass, new SymbolState(argumentValue)); 585 return _valid(definingClass, new SymbolState(argumentValue));
586 } 586 }
587 } 587 }
588 } 588 }
589 Map<String, DartObjectImpl> fieldMap = new Map<String, DartObjectImpl>(); 589 Map<String, DartObjectImpl> fieldMap = new Map<String, DartObjectImpl>();
590 List<ParameterElement> parameters = constructor.parameters; 590 List<ParameterElement> parameters = constructor.parameters;
591 int parameterCount = parameters.length; 591 int parameterCount = parameters.length;
592 for (int i = 0; i < parameterCount; i++) { 592 for (int i = 0; i < parameterCount; i++) {
593 ParameterElement parameter = parameters[i]; 593 ParameterElement parameter = parameters[i];
594 if (parameter.isInitializingFormal) { 594 if (parameter.isInitializingFormal) {
595 String fieldName = (parameter as FieldFormalParameterElement).field.na me; 595 String fieldName = (parameter as FieldFormalParameterElement).field.na me;
596 if (identical(parameter.parameterKind, ParameterKind.NAMED)) { 596 if (identical(parameter.parameterKind, ParameterKind.NAMED)) {
597 DartObjectImpl argumentValue = namedArgumentValues[parameter.name]; 597 DartObjectImpl argumentValue = namedArgumentValues[parameter.name];
598 if (argumentValue != null) { 598 if (argumentValue != null) {
599 fieldMap[fieldName] = argumentValue; 599 fieldMap[fieldName] = argumentValue;
600 } 600 }
601 } else if (i < argumentCount) { 601 } else if (i < argumentCount) {
602 fieldMap[fieldName] = argumentValues[i]; 602 fieldMap[fieldName] = argumentValues[i];
603 } 603 }
604 } 604 }
605 } 605 }
606 // TODO(brianwilkerson) This doesn't handle fields initialized in an initi alizer. We should be 606 // TODO(brianwilkerson) This doesn't handle fields initialized in an initi alizer. We should be
607 // able to handle fields initialized by the superclass' constructor fairly easily, but other 607 // able to handle fields initialized by the superclass' constructor fairly easily, but other
608 // initializers will be harder. 608 // initializers will be harder.
609 return valid(definingClass, new GenericState(fieldMap)); 609 return _valid(definingClass, new GenericState(fieldMap));
610 } 610 }
611 // TODO(brianwilkerson) Figure out which error to report. 611 // TODO(brianwilkerson) Figure out which error to report.
612 return error(node, null); 612 return _error(node, null);
613 } 613 }
614 614
615 EvaluationResultImpl visitIntegerLiteral(IntegerLiteral node) => valid(_typePr ovider.intType, new IntState(node.value)); 615 EvaluationResultImpl visitIntegerLiteral(IntegerLiteral node) => _valid(_typeP rovider.intType, new IntState(node.value));
616 616
617 EvaluationResultImpl visitInterpolationExpression(InterpolationExpression node ) { 617 EvaluationResultImpl visitInterpolationExpression(InterpolationExpression node ) {
618 EvaluationResultImpl result = node.expression.accept(this); 618 EvaluationResultImpl result = node.expression.accept(this);
619 if (result is ValidResult && !result.isBoolNumStringOrNull) { 619 if (result is ValidResult && !result.isBoolNumStringOrNull) {
620 return error(node, CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL_NUM_STRING); 620 return _error(node, CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL_NUM_STRING);
621 } 621 }
622 return result.performToString(_typeProvider, node); 622 return result.performToString(_typeProvider, node);
623 } 623 }
624 624
625 EvaluationResultImpl visitInterpolationString(InterpolationString node) => val id(_typeProvider.stringType, new StringState(node.value)); 625 EvaluationResultImpl visitInterpolationString(InterpolationString node) => _va lid(_typeProvider.stringType, new StringState(node.value));
626 626
627 EvaluationResultImpl visitListLiteral(ListLiteral node) { 627 EvaluationResultImpl visitListLiteral(ListLiteral node) {
628 if (node.constKeyword == null) { 628 if (node.constKeyword == null) {
629 return new ErrorResult.con1(node, CompileTimeErrorCode.MISSING_CONST_IN_LI ST_LITERAL); 629 return new ErrorResult.con1(node, CompileTimeErrorCode.MISSING_CONST_IN_LI ST_LITERAL);
630 } 630 }
631 ErrorResult result = null; 631 ErrorResult result = null;
632 List<DartObjectImpl> elements = new List<DartObjectImpl>(); 632 List<DartObjectImpl> elements = new List<DartObjectImpl>();
633 for (Expression element in node.elements) { 633 for (Expression element in node.elements) {
634 EvaluationResultImpl elementResult = element.accept(this); 634 EvaluationResultImpl elementResult = element.accept(this);
635 result = union(result, elementResult); 635 result = _union(result, elementResult);
636 if (elementResult is ValidResult) { 636 if (elementResult is ValidResult) {
637 elements.add(elementResult.value); 637 elements.add(elementResult.value);
638 } 638 }
639 } 639 }
640 if (result != null) { 640 if (result != null) {
641 return result; 641 return result;
642 } 642 }
643 return valid(_typeProvider.listType, new ListState(new List.from(elements))) ; 643 return _valid(_typeProvider.listType, new ListState(new List.from(elements)) );
644 } 644 }
645 645
646 EvaluationResultImpl visitMapLiteral(MapLiteral node) { 646 EvaluationResultImpl visitMapLiteral(MapLiteral node) {
647 if (node.constKeyword == null) { 647 if (node.constKeyword == null) {
648 return new ErrorResult.con1(node, CompileTimeErrorCode.MISSING_CONST_IN_MA P_LITERAL); 648 return new ErrorResult.con1(node, CompileTimeErrorCode.MISSING_CONST_IN_MA P_LITERAL);
649 } 649 }
650 ErrorResult result = null; 650 ErrorResult result = null;
651 Map<DartObjectImpl, DartObjectImpl> map = new Map<DartObjectImpl, DartObject Impl>(); 651 Map<DartObjectImpl, DartObjectImpl> map = new Map<DartObjectImpl, DartObject Impl>();
652 for (MapLiteralEntry entry in node.entries) { 652 for (MapLiteralEntry entry in node.entries) {
653 EvaluationResultImpl keyResult = entry.key.accept(this); 653 EvaluationResultImpl keyResult = entry.key.accept(this);
654 EvaluationResultImpl valueResult = entry.value.accept(this); 654 EvaluationResultImpl valueResult = entry.value.accept(this);
655 result = union(result, keyResult); 655 result = _union(result, keyResult);
656 result = union(result, valueResult); 656 result = _union(result, valueResult);
657 if (keyResult is ValidResult && valueResult is ValidResult) { 657 if (keyResult is ValidResult && valueResult is ValidResult) {
658 map[keyResult.value] = valueResult.value; 658 map[keyResult.value] = valueResult.value;
659 } 659 }
660 } 660 }
661 if (result != null) { 661 if (result != null) {
662 return result; 662 return result;
663 } 663 }
664 return valid(_typeProvider.mapType, new MapState(map)); 664 return _valid(_typeProvider.mapType, new MapState(map));
665 } 665 }
666 666
667 EvaluationResultImpl visitMethodInvocation(MethodInvocation node) { 667 EvaluationResultImpl visitMethodInvocation(MethodInvocation node) {
668 Element element = node.methodName.staticElement; 668 Element element = node.methodName.staticElement;
669 if (element is FunctionElement) { 669 if (element is FunctionElement) {
670 FunctionElement function = element; 670 FunctionElement function = element;
671 if (function.name == "identical") { 671 if (function.name == "identical") {
672 NodeList<Expression> arguments = node.argumentList.arguments; 672 NodeList<Expression> arguments = node.argumentList.arguments;
673 if (arguments.length == 2) { 673 if (arguments.length == 2) {
674 Element enclosingElement = function.enclosingElement; 674 Element enclosingElement = function.enclosingElement;
675 if (enclosingElement is CompilationUnitElement) { 675 if (enclosingElement is CompilationUnitElement) {
676 LibraryElement library = enclosingElement.library; 676 LibraryElement library = enclosingElement.library;
677 if (library.isDartCore) { 677 if (library.isDartCore) {
678 EvaluationResultImpl leftArgument = arguments[0].accept(this); 678 EvaluationResultImpl leftArgument = arguments[0].accept(this);
679 EvaluationResultImpl rightArgument = arguments[1].accept(this); 679 EvaluationResultImpl rightArgument = arguments[1].accept(this);
680 return leftArgument.equalEqual(_typeProvider, node, rightArgument) ; 680 return leftArgument.equalEqual(_typeProvider, node, rightArgument) ;
681 } 681 }
682 } 682 }
683 } 683 }
684 } 684 }
685 } 685 }
686 // TODO(brianwilkerson) Figure out which error to report. 686 // TODO(brianwilkerson) Figure out which error to report.
687 return error(node, null); 687 return _error(node, null);
688 } 688 }
689 689
690 EvaluationResultImpl visitNamedExpression(NamedExpression node) => node.expres sion.accept(this); 690 EvaluationResultImpl visitNamedExpression(NamedExpression node) => node.expres sion.accept(this);
691 691
692 EvaluationResultImpl visitNode(AstNode node) => error(node, null); 692 EvaluationResultImpl visitNode(AstNode node) => _error(node, null);
693 693
694 EvaluationResultImpl visitNullLiteral(NullLiteral node) => new ValidResult(nul l2); 694 EvaluationResultImpl visitNullLiteral(NullLiteral node) => new ValidResult(nul l2);
695 695
696 EvaluationResultImpl visitParenthesizedExpression(ParenthesizedExpression node ) => node.expression.accept(this); 696 EvaluationResultImpl visitParenthesizedExpression(ParenthesizedExpression node ) => node.expression.accept(this);
697 697
698 EvaluationResultImpl visitPrefixedIdentifier(PrefixedIdentifier node) { 698 EvaluationResultImpl visitPrefixedIdentifier(PrefixedIdentifier node) {
699 // validate prefix 699 // validate prefix
700 SimpleIdentifier prefixNode = node.prefix; 700 SimpleIdentifier prefixNode = node.prefix;
701 Element prefixElement = prefixNode.staticElement; 701 Element prefixElement = prefixNode.staticElement;
702 if (prefixElement is! PrefixElement) { 702 if (prefixElement is! PrefixElement) {
703 EvaluationResultImpl prefixResult = prefixNode.accept(this); 703 EvaluationResultImpl prefixResult = prefixNode.accept(this);
704 if (prefixResult is! ValidResult) { 704 if (prefixResult is! ValidResult) {
705 return error(node, null); 705 return _error(node, null);
706 } 706 }
707 } 707 }
708 // validate prefixed identifier 708 // validate prefixed identifier
709 return getConstantValue(node, node.staticElement); 709 return _getConstantValue(node, node.staticElement);
710 } 710 }
711 711
712 EvaluationResultImpl visitPrefixExpression(PrefixExpression node) { 712 EvaluationResultImpl visitPrefixExpression(PrefixExpression node) {
713 EvaluationResultImpl operand = node.operand.accept(this); 713 EvaluationResultImpl operand = node.operand.accept(this);
714 if (operand is ValidResult && operand.isNull) { 714 if (operand is ValidResult && operand.isNull) {
715 return error(node, CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION); 715 return _error(node, CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION);
716 } 716 }
717 while (true) { 717 while (true) {
718 if (node.operator.type == TokenType.BANG) { 718 if (node.operator.type == TokenType.BANG) {
719 return operand.logicalNot(_typeProvider, node); 719 return operand.logicalNot(_typeProvider, node);
720 } else if (node.operator.type == TokenType.TILDE) { 720 } else if (node.operator.type == TokenType.TILDE) {
721 return operand.bitNot(_typeProvider, node); 721 return operand.bitNot(_typeProvider, node);
722 } else if (node.operator.type == TokenType.MINUS) { 722 } else if (node.operator.type == TokenType.MINUS) {
723 return operand.negated(_typeProvider, node); 723 return operand.negated(_typeProvider, node);
724 } else { 724 } else {
725 // TODO(brianwilkerson) Figure out which error to report. 725 // TODO(brianwilkerson) Figure out which error to report.
726 return error(node, null); 726 return _error(node, null);
727 } 727 }
728 break; 728 break;
729 } 729 }
730 } 730 }
731 731
732 EvaluationResultImpl visitPropertyAccess(PropertyAccess node) => getConstantVa lue(node, node.propertyName.staticElement); 732 EvaluationResultImpl visitPropertyAccess(PropertyAccess node) => _getConstantV alue(node, node.propertyName.staticElement);
733 733
734 EvaluationResultImpl visitSimpleIdentifier(SimpleIdentifier node) => getConsta ntValue(node, node.staticElement); 734 EvaluationResultImpl visitSimpleIdentifier(SimpleIdentifier node) => _getConst antValue(node, node.staticElement);
735 735
736 EvaluationResultImpl visitSimpleStringLiteral(SimpleStringLiteral node) => val id(_typeProvider.stringType, new StringState(node.value)); 736 EvaluationResultImpl visitSimpleStringLiteral(SimpleStringLiteral node) => _va lid(_typeProvider.stringType, new StringState(node.value));
737 737
738 EvaluationResultImpl visitStringInterpolation(StringInterpolation node) { 738 EvaluationResultImpl visitStringInterpolation(StringInterpolation node) {
739 EvaluationResultImpl result = null; 739 EvaluationResultImpl result = null;
740 for (InterpolationElement element in node.elements) { 740 for (InterpolationElement element in node.elements) {
741 if (result == null) { 741 if (result == null) {
742 result = element.accept(this); 742 result = element.accept(this);
743 } else { 743 } else {
744 result = result.concatenate(_typeProvider, node, element.accept(this)); 744 result = result.concatenate(_typeProvider, node, element.accept(this));
745 } 745 }
746 } 746 }
747 return result; 747 return result;
748 } 748 }
749 749
750 EvaluationResultImpl visitSymbolLiteral(SymbolLiteral node) { 750 EvaluationResultImpl visitSymbolLiteral(SymbolLiteral node) {
751 JavaStringBuilder builder = new JavaStringBuilder(); 751 JavaStringBuilder builder = new JavaStringBuilder();
752 List<Token> components = node.components; 752 List<Token> components = node.components;
753 for (int i = 0; i < components.length; i++) { 753 for (int i = 0; i < components.length; i++) {
754 if (i > 0) { 754 if (i > 0) {
755 builder.appendChar(0x2E); 755 builder.appendChar(0x2E);
756 } 756 }
757 builder.append(components[i].lexeme); 757 builder.append(components[i].lexeme);
758 } 758 }
759 return valid(_typeProvider.symbolType, new SymbolState(builder.toString())); 759 return _valid(_typeProvider.symbolType, new SymbolState(builder.toString())) ;
760 } 760 }
761 761
762 /** 762 /**
763 * Return a result object representing an error associated with the given node . 763 * Return a result object representing an error associated with the given node .
764 * 764 *
765 * @param node the AST node associated with the error 765 * @param node the AST node associated with the error
766 * @param code the error code indicating the nature of the error 766 * @param code the error code indicating the nature of the error
767 * @return a result object representing an error associated with the given nod e 767 * @return a result object representing an error associated with the given nod e
768 */ 768 */
769 ErrorResult error(AstNode node, ErrorCode code) => new ErrorResult.con1(node, code == null ? CompileTimeErrorCode.INVALID_CONSTANT : code); 769 ErrorResult _error(AstNode node, ErrorCode code) => new ErrorResult.con1(node, code == null ? CompileTimeErrorCode.INVALID_CONSTANT : code);
770 770
771 /** 771 /**
772 * Return the constant value of the static constant represented by the given e lement. 772 * Return the constant value of the static constant represented by the given e lement.
773 * 773 *
774 * @param node the node to be used if an error needs to be reported 774 * @param node the node to be used if an error needs to be reported
775 * @param element the element whose value is to be returned 775 * @param element the element whose value is to be returned
776 * @return the constant value of the static constant 776 * @return the constant value of the static constant
777 */ 777 */
778 EvaluationResultImpl getConstantValue(AstNode node, Element element) { 778 EvaluationResultImpl _getConstantValue(AstNode node, Element element) {
779 if (element is PropertyAccessorElement) { 779 if (element is PropertyAccessorElement) {
780 element = (element as PropertyAccessorElement).variable; 780 element = (element as PropertyAccessorElement).variable;
781 } 781 }
782 if (element is VariableElementImpl) { 782 if (element is VariableElementImpl) {
783 VariableElementImpl variableElementImpl = element; 783 VariableElementImpl variableElementImpl = element;
784 EvaluationResultImpl value = variableElementImpl.evaluationResult; 784 EvaluationResultImpl value = variableElementImpl.evaluationResult;
785 if (variableElementImpl.isConst && value != null) { 785 if (variableElementImpl.isConst && value != null) {
786 return value; 786 return value;
787 } 787 }
788 } else if (element is ExecutableElement) { 788 } else if (element is ExecutableElement) {
789 ExecutableElement function = element; 789 ExecutableElement function = element;
790 if (function.isStatic) { 790 if (function.isStatic) {
791 return valid(_typeProvider.functionType, new FunctionState(function)); 791 return _valid(_typeProvider.functionType, new FunctionState(function));
792 } 792 }
793 } else if (element is ClassElement || element is FunctionTypeAliasElement) { 793 } else if (element is ClassElement || element is FunctionTypeAliasElement) {
794 return valid(_typeProvider.typeType, new TypeState(element)); 794 return _valid(_typeProvider.typeType, new TypeState(element));
795 } 795 }
796 // TODO(brianwilkerson) Figure out which error to report. 796 // TODO(brianwilkerson) Figure out which error to report.
797 return error(node, null); 797 return _error(node, null);
798 } 798 }
799 799
800 /** 800 /**
801 * Return an object representing the value 'null'. 801 * Return an object representing the value 'null'.
802 * 802 *
803 * @return an object representing the value 'null' 803 * @return an object representing the value 'null'
804 */ 804 */
805 DartObjectImpl get null2 { 805 DartObjectImpl get null2 {
806 if (_nullObject == null) { 806 if (_nullObject == null) {
807 _nullObject = new DartObjectImpl(_typeProvider.nullType, NullState.NULL_ST ATE); 807 _nullObject = new DartObjectImpl(_typeProvider.nullType, NullState.NULL_ST ATE);
808 } 808 }
809 return _nullObject; 809 return _nullObject;
810 } 810 }
811 811
812 /** 812 /**
813 * Return the union of the errors encoded in the given results. 813 * Return the union of the errors encoded in the given results.
814 * 814 *
815 * @param leftResult the first set of errors, or `null` if there was no previo us collection 815 * @param leftResult the first set of errors, or `null` if there was no previo us collection
816 * of errors 816 * of errors
817 * @param rightResult the errors to be added to the collection, or a valid res ult if there are no 817 * @param rightResult the errors to be added to the collection, or a valid res ult if there are no
818 * errors to be added 818 * errors to be added
819 * @return the union of the errors encoded in the given results 819 * @return the union of the errors encoded in the given results
820 */ 820 */
821 ErrorResult union(ErrorResult leftResult, EvaluationResultImpl rightResult) { 821 ErrorResult _union(ErrorResult leftResult, EvaluationResultImpl rightResult) {
822 if (rightResult is ErrorResult) { 822 if (rightResult is ErrorResult) {
823 if (leftResult != null) { 823 if (leftResult != null) {
824 return new ErrorResult.con2(leftResult, rightResult); 824 return new ErrorResult.con2(leftResult, rightResult);
825 } else { 825 } else {
826 return rightResult; 826 return rightResult;
827 } 827 }
828 } 828 }
829 return leftResult; 829 return leftResult;
830 } 830 }
831 831
832 ValidResult valid(InterfaceType type, InstanceState state) => new ValidResult( new DartObjectImpl(type, state)); 832 ValidResult _valid(InterfaceType type, InstanceState state) => new ValidResult (new DartObjectImpl(type, state));
833 833
834 ValidResult validWithUnknownValue(InterfaceType type) { 834 ValidResult _validWithUnknownValue(InterfaceType type) {
835 if (type.element.library.isDartCore) { 835 if (type.element.library.isDartCore) {
836 String typeName = type.name; 836 String typeName = type.name;
837 if (typeName == "bool") { 837 if (typeName == "bool") {
838 return valid(type, BoolState.UNKNOWN_VALUE); 838 return _valid(type, BoolState.UNKNOWN_VALUE);
839 } else if (typeName == "double") { 839 } else if (typeName == "double") {
840 return valid(type, DoubleState.UNKNOWN_VALUE); 840 return _valid(type, DoubleState.UNKNOWN_VALUE);
841 } else if (typeName == "int") { 841 } else if (typeName == "int") {
842 return valid(type, IntState.UNKNOWN_VALUE); 842 return _valid(type, IntState.UNKNOWN_VALUE);
843 } else if (typeName == "String") { 843 } else if (typeName == "String") {
844 return valid(type, StringState.UNKNOWN_VALUE); 844 return _valid(type, StringState.UNKNOWN_VALUE);
845 } 845 }
846 } 846 }
847 return valid(type, GenericState.UNKNOWN_VALUE); 847 return _valid(type, GenericState.UNKNOWN_VALUE);
848 } 848 }
849 849
850 /** 850 /**
851 * Return the value of the given expression, or a representation of 'null' if the expression 851 * Return the value of the given expression, or a representation of 'null' if the expression
852 * cannot be evaluated. 852 * cannot be evaluated.
853 * 853 *
854 * @param expression the expression whose value is to be returned 854 * @param expression the expression whose value is to be returned
855 * @return the value of the given expression 855 * @return the value of the given expression
856 */ 856 */
857 DartObjectImpl valueOf(Expression expression) { 857 DartObjectImpl _valueOf(Expression expression) {
858 EvaluationResultImpl expressionValue = expression.accept(this); 858 EvaluationResultImpl expressionValue = expression.accept(this);
859 if (expressionValue is ValidResult) { 859 if (expressionValue is ValidResult) {
860 return expressionValue.value; 860 return expressionValue.value;
861 } 861 }
862 return null2; 862 return null2;
863 } 863 }
864 } 864 }
865 865
866 /** 866 /**
867 * Instances of the class `DirectedGraph` implement a directed graph in which th e nodes are 867 * Instances of the class `DirectedGraph` implement a directed graph in which th e nodes are
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 /** 998 /**
999 * Find one node (referred to as a sink node) that has no outgoing edges (that is, for which there 999 * Find one node (referred to as a sink node) that has no outgoing edges (that is, for which there
1000 * are no edges that have that node as the head of the edge) and remove it fro m this graph. Return 1000 * are no edges that have that node as the head of the edge) and remove it fro m this graph. Return
1001 * the node that was removed, or `null` if there are no such nodes either beca use the graph 1001 * the node that was removed, or `null` if there are no such nodes either beca use the graph
1002 * is empty or because every node in the graph has at least one outgoing edge. As a consequence of 1002 * is empty or because every node in the graph has at least one outgoing edge. As a consequence of
1003 * removing the node from the graph any edges for which that node was a tail w ill also be removed. 1003 * removing the node from the graph any edges for which that node was a tail w ill also be removed.
1004 * 1004 *
1005 * @return the sink node that was removed 1005 * @return the sink node that was removed
1006 */ 1006 */
1007 N removeSink() { 1007 N removeSink() {
1008 N sink = findSink(); 1008 N sink = _findSink();
1009 if (sink == null) { 1009 if (sink == null) {
1010 return null; 1010 return null;
1011 } 1011 }
1012 removeNode(sink); 1012 removeNode(sink);
1013 return sink; 1013 return sink;
1014 } 1014 }
1015 1015
1016 /** 1016 /**
1017 * Return one node that has no outgoing edges (that is, for which there are no edges that have 1017 * Return one node that has no outgoing edges (that is, for which there are no edges that have
1018 * that node as the head of the edge), or `null` if there are no such nodes. 1018 * that node as the head of the edge), or `null` if there are no such nodes.
1019 * 1019 *
1020 * @return a sink node 1020 * @return a sink node
1021 */ 1021 */
1022 N findSink() { 1022 N _findSink() {
1023 for (N key in _edges.keys) { 1023 for (N key in _edges.keys) {
1024 if (_edges[key].isEmpty) return key; 1024 if (_edges[key].isEmpty) return key;
1025 } 1025 }
1026 return null; 1026 return null;
1027 } 1027 }
1028 } 1028 }
1029 1029
1030 /** 1030 /**
1031 * Instances of the class `ErrorResult` represent the result of evaluating an ex pression that 1031 * Instances of the class `ErrorResult` represent the result of evaluating an ex pression that
1032 * is not a valid compile time constant. 1032 * is not a valid compile time constant.
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
1425 EvaluationResultImpl add(TypeProvider typeProvider, BinaryExpression node, Eva luationResultImpl rightOperand) => rightOperand.addToValid(typeProvider, node, t his); 1425 EvaluationResultImpl add(TypeProvider typeProvider, BinaryExpression node, Eva luationResultImpl rightOperand) => rightOperand.addToValid(typeProvider, node, t his);
1426 1426
1427 /** 1427 /**
1428 * Return the result of applying boolean conversion to this result. 1428 * Return the result of applying boolean conversion to this result.
1429 * 1429 *
1430 * @param node the node against which errors should be reported 1430 * @param node the node against which errors should be reported
1431 * @return the result of applying boolean conversion to the given value 1431 * @return the result of applying boolean conversion to the given value
1432 */ 1432 */
1433 EvaluationResultImpl applyBooleanConversion(TypeProvider typeProvider, AstNode node) { 1433 EvaluationResultImpl applyBooleanConversion(TypeProvider typeProvider, AstNode node) {
1434 try { 1434 try {
1435 return valueOf(value.convertToBool(typeProvider)); 1435 return _valueOf(value.convertToBool(typeProvider));
1436 } on EvaluationException catch (exception) { 1436 } on EvaluationException catch (exception) {
1437 return error(node, exception.errorCode); 1437 return _error(node, exception.errorCode);
1438 } 1438 }
1439 } 1439 }
1440 1440
1441 EvaluationResultImpl bitAnd(TypeProvider typeProvider, BinaryExpression node, EvaluationResultImpl rightOperand) => rightOperand.bitAndValid(typeProvider, nod e, this); 1441 EvaluationResultImpl bitAnd(TypeProvider typeProvider, BinaryExpression node, EvaluationResultImpl rightOperand) => rightOperand.bitAndValid(typeProvider, nod e, this);
1442 1442
1443 EvaluationResultImpl bitNot(TypeProvider typeProvider, Expression node) { 1443 EvaluationResultImpl bitNot(TypeProvider typeProvider, Expression node) {
1444 try { 1444 try {
1445 return valueOf(value.bitNot(typeProvider)); 1445 return _valueOf(value.bitNot(typeProvider));
1446 } on EvaluationException catch (exception) { 1446 } on EvaluationException catch (exception) {
1447 return error(node, exception.errorCode); 1447 return _error(node, exception.errorCode);
1448 } 1448 }
1449 } 1449 }
1450 1450
1451 EvaluationResultImpl bitOr(TypeProvider typeProvider, BinaryExpression node, E valuationResultImpl rightOperand) => rightOperand.bitOrValid(typeProvider, node, this); 1451 EvaluationResultImpl bitOr(TypeProvider typeProvider, BinaryExpression node, E valuationResultImpl rightOperand) => rightOperand.bitOrValid(typeProvider, node, this);
1452 1452
1453 EvaluationResultImpl bitXor(TypeProvider typeProvider, BinaryExpression node, EvaluationResultImpl rightOperand) => rightOperand.bitXorValid(typeProvider, nod e, this); 1453 EvaluationResultImpl bitXor(TypeProvider typeProvider, BinaryExpression node, EvaluationResultImpl rightOperand) => rightOperand.bitXorValid(typeProvider, nod e, this);
1454 1454
1455 EvaluationResultImpl concatenate(TypeProvider typeProvider, Expression node, E valuationResultImpl rightOperand) => rightOperand.concatenateValid(typeProvider, node, this); 1455 EvaluationResultImpl concatenate(TypeProvider typeProvider, Expression node, E valuationResultImpl rightOperand) => rightOperand.concatenateValid(typeProvider, node, this);
1456 1456
1457 EvaluationResultImpl divide(TypeProvider typeProvider, BinaryExpression node, EvaluationResultImpl rightOperand) => rightOperand.divideValid(typeProvider, nod e, this); 1457 EvaluationResultImpl divide(TypeProvider typeProvider, BinaryExpression node, EvaluationResultImpl rightOperand) => rightOperand.divideValid(typeProvider, nod e, this);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1515 bool get isUserDefinedObject => value.isUserDefinedObject; 1515 bool get isUserDefinedObject => value.isUserDefinedObject;
1516 1516
1517 EvaluationResultImpl lessThan(TypeProvider typeProvider, BinaryExpression node , EvaluationResultImpl rightOperand) => rightOperand.lessThanValid(typeProvider, node, this); 1517 EvaluationResultImpl lessThan(TypeProvider typeProvider, BinaryExpression node , EvaluationResultImpl rightOperand) => rightOperand.lessThanValid(typeProvider, node, this);
1518 1518
1519 EvaluationResultImpl lessThanOrEqual(TypeProvider typeProvider, BinaryExpressi on node, EvaluationResultImpl rightOperand) => rightOperand.lessThanOrEqualValid (typeProvider, node, this); 1519 EvaluationResultImpl lessThanOrEqual(TypeProvider typeProvider, BinaryExpressi on node, EvaluationResultImpl rightOperand) => rightOperand.lessThanOrEqualValid (typeProvider, node, this);
1520 1520
1521 EvaluationResultImpl logicalAnd(TypeProvider typeProvider, BinaryExpression no de, EvaluationResultImpl rightOperand) => rightOperand.logicalAndValid(typeProvi der, node, this); 1521 EvaluationResultImpl logicalAnd(TypeProvider typeProvider, BinaryExpression no de, EvaluationResultImpl rightOperand) => rightOperand.logicalAndValid(typeProvi der, node, this);
1522 1522
1523 EvaluationResultImpl logicalNot(TypeProvider typeProvider, Expression node) { 1523 EvaluationResultImpl logicalNot(TypeProvider typeProvider, Expression node) {
1524 try { 1524 try {
1525 return valueOf(value.logicalNot(typeProvider)); 1525 return _valueOf(value.logicalNot(typeProvider));
1526 } on EvaluationException catch (exception) { 1526 } on EvaluationException catch (exception) {
1527 return error(node, exception.errorCode); 1527 return _error(node, exception.errorCode);
1528 } 1528 }
1529 } 1529 }
1530 1530
1531 EvaluationResultImpl logicalOr(TypeProvider typeProvider, BinaryExpression nod e, EvaluationResultImpl rightOperand) => rightOperand.logicalOrValid(typeProvide r, node, this); 1531 EvaluationResultImpl logicalOr(TypeProvider typeProvider, BinaryExpression nod e, EvaluationResultImpl rightOperand) => rightOperand.logicalOrValid(typeProvide r, node, this);
1532 1532
1533 EvaluationResultImpl minus(TypeProvider typeProvider, BinaryExpression node, E valuationResultImpl rightOperand) => rightOperand.minusValid(typeProvider, node, this); 1533 EvaluationResultImpl minus(TypeProvider typeProvider, BinaryExpression node, E valuationResultImpl rightOperand) => rightOperand.minusValid(typeProvider, node, this);
1534 1534
1535 EvaluationResultImpl negated(TypeProvider typeProvider, Expression node) { 1535 EvaluationResultImpl negated(TypeProvider typeProvider, Expression node) {
1536 try { 1536 try {
1537 return valueOf(value.negated(typeProvider)); 1537 return _valueOf(value.negated(typeProvider));
1538 } on EvaluationException catch (exception) { 1538 } on EvaluationException catch (exception) {
1539 return error(node, exception.errorCode); 1539 return _error(node, exception.errorCode);
1540 } 1540 }
1541 } 1541 }
1542 1542
1543 EvaluationResultImpl notEqual(TypeProvider typeProvider, BinaryExpression node , EvaluationResultImpl rightOperand) => rightOperand.notEqualValid(typeProvider, node, this); 1543 EvaluationResultImpl notEqual(TypeProvider typeProvider, BinaryExpression node , EvaluationResultImpl rightOperand) => rightOperand.notEqualValid(typeProvider, node, this);
1544 1544
1545 EvaluationResultImpl performToString(TypeProvider typeProvider, AstNode node) { 1545 EvaluationResultImpl performToString(TypeProvider typeProvider, AstNode node) {
1546 try { 1546 try {
1547 return valueOf(value.performToString(typeProvider)); 1547 return _valueOf(value.performToString(typeProvider));
1548 } on EvaluationException catch (exception) { 1548 } on EvaluationException catch (exception) {
1549 return error(node, exception.errorCode); 1549 return _error(node, exception.errorCode);
1550 } 1550 }
1551 } 1551 }
1552 1552
1553 EvaluationResultImpl remainder(TypeProvider typeProvider, BinaryExpression nod e, EvaluationResultImpl rightOperand) => rightOperand.remainderValid(typeProvide r, node, this); 1553 EvaluationResultImpl remainder(TypeProvider typeProvider, BinaryExpression nod e, EvaluationResultImpl rightOperand) => rightOperand.remainderValid(typeProvide r, node, this);
1554 1554
1555 EvaluationResultImpl shiftLeft(TypeProvider typeProvider, BinaryExpression nod e, EvaluationResultImpl rightOperand) => rightOperand.shiftLeftValid(typeProvide r, node, this); 1555 EvaluationResultImpl shiftLeft(TypeProvider typeProvider, BinaryExpression nod e, EvaluationResultImpl rightOperand) => rightOperand.shiftLeftValid(typeProvide r, node, this);
1556 1556
1557 EvaluationResultImpl shiftRight(TypeProvider typeProvider, BinaryExpression no de, EvaluationResultImpl rightOperand) => rightOperand.shiftRightValid(typeProvi der, node, this); 1557 EvaluationResultImpl shiftRight(TypeProvider typeProvider, BinaryExpression no de, EvaluationResultImpl rightOperand) => rightOperand.shiftRightValid(typeProvi der, node, this);
1558 1558
1559 EvaluationResultImpl times(TypeProvider typeProvider, BinaryExpression node, E valuationResultImpl rightOperand) => rightOperand.timesValid(typeProvider, node, this); 1559 EvaluationResultImpl times(TypeProvider typeProvider, BinaryExpression node, E valuationResultImpl rightOperand) => rightOperand.timesValid(typeProvider, node, this);
1560 1560
1561 String toString() { 1561 String toString() {
1562 if (value == null) { 1562 if (value == null) {
1563 return "null"; 1563 return "null";
1564 } 1564 }
1565 return value.toString(); 1565 return value.toString();
1566 } 1566 }
1567 1567
1568 EvaluationResultImpl addToError(BinaryExpression node, ErrorResult leftOperand ) => leftOperand; 1568 EvaluationResultImpl addToError(BinaryExpression node, ErrorResult leftOperand ) => leftOperand;
1569 1569
1570 EvaluationResultImpl addToValid(TypeProvider typeProvider, BinaryExpression no de, ValidResult leftOperand) { 1570 EvaluationResultImpl addToValid(TypeProvider typeProvider, BinaryExpression no de, ValidResult leftOperand) {
1571 try { 1571 try {
1572 return valueOf(leftOperand.value.add(typeProvider, value)); 1572 return _valueOf(leftOperand.value.add(typeProvider, value));
1573 } on EvaluationException catch (exception) { 1573 } on EvaluationException catch (exception) {
1574 return error(node, exception.errorCode); 1574 return _error(node, exception.errorCode);
1575 } 1575 }
1576 } 1576 }
1577 1577
1578 EvaluationResultImpl bitAndError(BinaryExpression node, ErrorResult leftOperan d) => leftOperand; 1578 EvaluationResultImpl bitAndError(BinaryExpression node, ErrorResult leftOperan d) => leftOperand;
1579 1579
1580 EvaluationResultImpl bitAndValid(TypeProvider typeProvider, BinaryExpression n ode, ValidResult leftOperand) { 1580 EvaluationResultImpl bitAndValid(TypeProvider typeProvider, BinaryExpression n ode, ValidResult leftOperand) {
1581 try { 1581 try {
1582 return valueOf(leftOperand.value.bitAnd(typeProvider, value)); 1582 return _valueOf(leftOperand.value.bitAnd(typeProvider, value));
1583 } on EvaluationException catch (exception) { 1583 } on EvaluationException catch (exception) {
1584 return error(node, exception.errorCode); 1584 return _error(node, exception.errorCode);
1585 } 1585 }
1586 } 1586 }
1587 1587
1588 EvaluationResultImpl bitOrError(BinaryExpression node, ErrorResult leftOperand ) => leftOperand; 1588 EvaluationResultImpl bitOrError(BinaryExpression node, ErrorResult leftOperand ) => leftOperand;
1589 1589
1590 EvaluationResultImpl bitOrValid(TypeProvider typeProvider, BinaryExpression no de, ValidResult leftOperand) { 1590 EvaluationResultImpl bitOrValid(TypeProvider typeProvider, BinaryExpression no de, ValidResult leftOperand) {
1591 try { 1591 try {
1592 return valueOf(leftOperand.value.bitOr(typeProvider, value)); 1592 return _valueOf(leftOperand.value.bitOr(typeProvider, value));
1593 } on EvaluationException catch (exception) { 1593 } on EvaluationException catch (exception) {
1594 return error(node, exception.errorCode); 1594 return _error(node, exception.errorCode);
1595 } 1595 }
1596 } 1596 }
1597 1597
1598 EvaluationResultImpl bitXorError(BinaryExpression node, ErrorResult leftOperan d) => leftOperand; 1598 EvaluationResultImpl bitXorError(BinaryExpression node, ErrorResult leftOperan d) => leftOperand;
1599 1599
1600 EvaluationResultImpl bitXorValid(TypeProvider typeProvider, BinaryExpression n ode, ValidResult leftOperand) { 1600 EvaluationResultImpl bitXorValid(TypeProvider typeProvider, BinaryExpression n ode, ValidResult leftOperand) {
1601 try { 1601 try {
1602 return valueOf(leftOperand.value.bitXor(typeProvider, value)); 1602 return _valueOf(leftOperand.value.bitXor(typeProvider, value));
1603 } on EvaluationException catch (exception) { 1603 } on EvaluationException catch (exception) {
1604 return error(node, exception.errorCode); 1604 return _error(node, exception.errorCode);
1605 } 1605 }
1606 } 1606 }
1607 1607
1608 EvaluationResultImpl concatenateError(Expression node, ErrorResult leftOperand ) => leftOperand; 1608 EvaluationResultImpl concatenateError(Expression node, ErrorResult leftOperand ) => leftOperand;
1609 1609
1610 EvaluationResultImpl concatenateValid(TypeProvider typeProvider, Expression no de, ValidResult leftOperand) { 1610 EvaluationResultImpl concatenateValid(TypeProvider typeProvider, Expression no de, ValidResult leftOperand) {
1611 try { 1611 try {
1612 return valueOf(leftOperand.value.concatenate(typeProvider, value)); 1612 return _valueOf(leftOperand.value.concatenate(typeProvider, value));
1613 } on EvaluationException catch (exception) { 1613 } on EvaluationException catch (exception) {
1614 return error(node, exception.errorCode); 1614 return _error(node, exception.errorCode);
1615 } 1615 }
1616 } 1616 }
1617 1617
1618 EvaluationResultImpl divideError(BinaryExpression node, ErrorResult leftOperan d) => leftOperand; 1618 EvaluationResultImpl divideError(BinaryExpression node, ErrorResult leftOperan d) => leftOperand;
1619 1619
1620 EvaluationResultImpl divideValid(TypeProvider typeProvider, BinaryExpression n ode, ValidResult leftOperand) { 1620 EvaluationResultImpl divideValid(TypeProvider typeProvider, BinaryExpression n ode, ValidResult leftOperand) {
1621 try { 1621 try {
1622 return valueOf(leftOperand.value.divide(typeProvider, value)); 1622 return _valueOf(leftOperand.value.divide(typeProvider, value));
1623 } on EvaluationException catch (exception) { 1623 } on EvaluationException catch (exception) {
1624 return error(node, exception.errorCode); 1624 return _error(node, exception.errorCode);
1625 } 1625 }
1626 } 1626 }
1627 1627
1628 EvaluationResultImpl equalEqualError(Expression node, ErrorResult leftOperand) => leftOperand; 1628 EvaluationResultImpl equalEqualError(Expression node, ErrorResult leftOperand) => leftOperand;
1629 1629
1630 EvaluationResultImpl equalEqualValid(TypeProvider typeProvider, Expression nod e, ValidResult leftOperand) { 1630 EvaluationResultImpl equalEqualValid(TypeProvider typeProvider, Expression nod e, ValidResult leftOperand) {
1631 try { 1631 try {
1632 return valueOf(leftOperand.value.equalEqual(typeProvider, value)); 1632 return _valueOf(leftOperand.value.equalEqual(typeProvider, value));
1633 } on EvaluationException catch (exception) { 1633 } on EvaluationException catch (exception) {
1634 return error(node, exception.errorCode); 1634 return _error(node, exception.errorCode);
1635 } 1635 }
1636 } 1636 }
1637 1637
1638 EvaluationResultImpl greaterThanError(BinaryExpression node, ErrorResult leftO perand) => leftOperand; 1638 EvaluationResultImpl greaterThanError(BinaryExpression node, ErrorResult leftO perand) => leftOperand;
1639 1639
1640 EvaluationResultImpl greaterThanOrEqualError(BinaryExpression node, ErrorResul t leftOperand) => leftOperand; 1640 EvaluationResultImpl greaterThanOrEqualError(BinaryExpression node, ErrorResul t leftOperand) => leftOperand;
1641 1641
1642 EvaluationResultImpl greaterThanOrEqualValid(TypeProvider typeProvider, Binary Expression node, ValidResult leftOperand) { 1642 EvaluationResultImpl greaterThanOrEqualValid(TypeProvider typeProvider, Binary Expression node, ValidResult leftOperand) {
1643 try { 1643 try {
1644 return valueOf(leftOperand.value.greaterThanOrEqual(typeProvider, value)); 1644 return _valueOf(leftOperand.value.greaterThanOrEqual(typeProvider, value)) ;
1645 } on EvaluationException catch (exception) { 1645 } on EvaluationException catch (exception) {
1646 return error(node, exception.errorCode); 1646 return _error(node, exception.errorCode);
1647 } 1647 }
1648 } 1648 }
1649 1649
1650 EvaluationResultImpl greaterThanValid(TypeProvider typeProvider, BinaryExpress ion node, ValidResult leftOperand) { 1650 EvaluationResultImpl greaterThanValid(TypeProvider typeProvider, BinaryExpress ion node, ValidResult leftOperand) {
1651 try { 1651 try {
1652 return valueOf(leftOperand.value.greaterThan(typeProvider, value)); 1652 return _valueOf(leftOperand.value.greaterThan(typeProvider, value));
1653 } on EvaluationException catch (exception) { 1653 } on EvaluationException catch (exception) {
1654 return error(node, exception.errorCode); 1654 return _error(node, exception.errorCode);
1655 } 1655 }
1656 } 1656 }
1657 1657
1658 EvaluationResultImpl integerDivideError(BinaryExpression node, ErrorResult lef tOperand) => leftOperand; 1658 EvaluationResultImpl integerDivideError(BinaryExpression node, ErrorResult lef tOperand) => leftOperand;
1659 1659
1660 EvaluationResultImpl integerDivideValid(TypeProvider typeProvider, BinaryExpre ssion node, ValidResult leftOperand) { 1660 EvaluationResultImpl integerDivideValid(TypeProvider typeProvider, BinaryExpre ssion node, ValidResult leftOperand) {
1661 try { 1661 try {
1662 return valueOf(leftOperand.value.integerDivide(typeProvider, value)); 1662 return _valueOf(leftOperand.value.integerDivide(typeProvider, value));
1663 } on EvaluationException catch (exception) { 1663 } on EvaluationException catch (exception) {
1664 return error(node, exception.errorCode); 1664 return _error(node, exception.errorCode);
1665 } 1665 }
1666 } 1666 }
1667 1667
1668 EvaluationResultImpl lessThanError(BinaryExpression node, ErrorResult leftOper and) => leftOperand; 1668 EvaluationResultImpl lessThanError(BinaryExpression node, ErrorResult leftOper and) => leftOperand;
1669 1669
1670 EvaluationResultImpl lessThanOrEqualError(BinaryExpression node, ErrorResult l eftOperand) => leftOperand; 1670 EvaluationResultImpl lessThanOrEqualError(BinaryExpression node, ErrorResult l eftOperand) => leftOperand;
1671 1671
1672 EvaluationResultImpl lessThanOrEqualValid(TypeProvider typeProvider, BinaryExp ression node, ValidResult leftOperand) { 1672 EvaluationResultImpl lessThanOrEqualValid(TypeProvider typeProvider, BinaryExp ression node, ValidResult leftOperand) {
1673 try { 1673 try {
1674 return valueOf(leftOperand.value.lessThanOrEqual(typeProvider, value)); 1674 return _valueOf(leftOperand.value.lessThanOrEqual(typeProvider, value));
1675 } on EvaluationException catch (exception) { 1675 } on EvaluationException catch (exception) {
1676 return error(node, exception.errorCode); 1676 return _error(node, exception.errorCode);
1677 } 1677 }
1678 } 1678 }
1679 1679
1680 EvaluationResultImpl lessThanValid(TypeProvider typeProvider, BinaryExpression node, ValidResult leftOperand) { 1680 EvaluationResultImpl lessThanValid(TypeProvider typeProvider, BinaryExpression node, ValidResult leftOperand) {
1681 try { 1681 try {
1682 return valueOf(leftOperand.value.lessThan(typeProvider, value)); 1682 return _valueOf(leftOperand.value.lessThan(typeProvider, value));
1683 } on EvaluationException catch (exception) { 1683 } on EvaluationException catch (exception) {
1684 return error(node, exception.errorCode); 1684 return _error(node, exception.errorCode);
1685 } 1685 }
1686 } 1686 }
1687 1687
1688 EvaluationResultImpl logicalAndError(BinaryExpression node, ErrorResult leftOp erand) => leftOperand; 1688 EvaluationResultImpl logicalAndError(BinaryExpression node, ErrorResult leftOp erand) => leftOperand;
1689 1689
1690 EvaluationResultImpl logicalAndValid(TypeProvider typeProvider, BinaryExpressi on node, ValidResult leftOperand) { 1690 EvaluationResultImpl logicalAndValid(TypeProvider typeProvider, BinaryExpressi on node, ValidResult leftOperand) {
1691 try { 1691 try {
1692 return valueOf(leftOperand.value.logicalAnd(typeProvider, value)); 1692 return _valueOf(leftOperand.value.logicalAnd(typeProvider, value));
1693 } on EvaluationException catch (exception) { 1693 } on EvaluationException catch (exception) {
1694 return error(node, exception.errorCode); 1694 return _error(node, exception.errorCode);
1695 } 1695 }
1696 } 1696 }
1697 1697
1698 EvaluationResultImpl logicalOrError(BinaryExpression node, ErrorResult leftOpe rand) => leftOperand; 1698 EvaluationResultImpl logicalOrError(BinaryExpression node, ErrorResult leftOpe rand) => leftOperand;
1699 1699
1700 EvaluationResultImpl logicalOrValid(TypeProvider typeProvider, BinaryExpressio n node, ValidResult leftOperand) { 1700 EvaluationResultImpl logicalOrValid(TypeProvider typeProvider, BinaryExpressio n node, ValidResult leftOperand) {
1701 try { 1701 try {
1702 return valueOf(leftOperand.value.logicalOr(typeProvider, value)); 1702 return _valueOf(leftOperand.value.logicalOr(typeProvider, value));
1703 } on EvaluationException catch (exception) { 1703 } on EvaluationException catch (exception) {
1704 return error(node, exception.errorCode); 1704 return _error(node, exception.errorCode);
1705 } 1705 }
1706 } 1706 }
1707 1707
1708 EvaluationResultImpl minusError(BinaryExpression node, ErrorResult leftOperand ) => leftOperand; 1708 EvaluationResultImpl minusError(BinaryExpression node, ErrorResult leftOperand ) => leftOperand;
1709 1709
1710 EvaluationResultImpl minusValid(TypeProvider typeProvider, BinaryExpression no de, ValidResult leftOperand) { 1710 EvaluationResultImpl minusValid(TypeProvider typeProvider, BinaryExpression no de, ValidResult leftOperand) {
1711 try { 1711 try {
1712 return valueOf(leftOperand.value.minus(typeProvider, value)); 1712 return _valueOf(leftOperand.value.minus(typeProvider, value));
1713 } on EvaluationException catch (exception) { 1713 } on EvaluationException catch (exception) {
1714 return error(node, exception.errorCode); 1714 return _error(node, exception.errorCode);
1715 } 1715 }
1716 } 1716 }
1717 1717
1718 EvaluationResultImpl notEqualError(BinaryExpression node, ErrorResult leftOper and) => leftOperand; 1718 EvaluationResultImpl notEqualError(BinaryExpression node, ErrorResult leftOper and) => leftOperand;
1719 1719
1720 EvaluationResultImpl notEqualValid(TypeProvider typeProvider, BinaryExpression node, ValidResult leftOperand) { 1720 EvaluationResultImpl notEqualValid(TypeProvider typeProvider, BinaryExpression node, ValidResult leftOperand) {
1721 try { 1721 try {
1722 return valueOf(leftOperand.value.notEqual(typeProvider, value)); 1722 return _valueOf(leftOperand.value.notEqual(typeProvider, value));
1723 } on EvaluationException catch (exception) { 1723 } on EvaluationException catch (exception) {
1724 return error(node, exception.errorCode); 1724 return _error(node, exception.errorCode);
1725 } 1725 }
1726 } 1726 }
1727 1727
1728 EvaluationResultImpl remainderError(BinaryExpression node, ErrorResult leftOpe rand) => leftOperand; 1728 EvaluationResultImpl remainderError(BinaryExpression node, ErrorResult leftOpe rand) => leftOperand;
1729 1729
1730 EvaluationResultImpl remainderValid(TypeProvider typeProvider, BinaryExpressio n node, ValidResult leftOperand) { 1730 EvaluationResultImpl remainderValid(TypeProvider typeProvider, BinaryExpressio n node, ValidResult leftOperand) {
1731 try { 1731 try {
1732 return valueOf(leftOperand.value.remainder(typeProvider, value)); 1732 return _valueOf(leftOperand.value.remainder(typeProvider, value));
1733 } on EvaluationException catch (exception) { 1733 } on EvaluationException catch (exception) {
1734 return error(node, exception.errorCode); 1734 return _error(node, exception.errorCode);
1735 } 1735 }
1736 } 1736 }
1737 1737
1738 EvaluationResultImpl shiftLeftError(BinaryExpression node, ErrorResult leftOpe rand) => leftOperand; 1738 EvaluationResultImpl shiftLeftError(BinaryExpression node, ErrorResult leftOpe rand) => leftOperand;
1739 1739
1740 EvaluationResultImpl shiftLeftValid(TypeProvider typeProvider, BinaryExpressio n node, ValidResult leftOperand) { 1740 EvaluationResultImpl shiftLeftValid(TypeProvider typeProvider, BinaryExpressio n node, ValidResult leftOperand) {
1741 try { 1741 try {
1742 return valueOf(leftOperand.value.shiftLeft(typeProvider, value)); 1742 return _valueOf(leftOperand.value.shiftLeft(typeProvider, value));
1743 } on EvaluationException catch (exception) { 1743 } on EvaluationException catch (exception) {
1744 return error(node, exception.errorCode); 1744 return _error(node, exception.errorCode);
1745 } 1745 }
1746 } 1746 }
1747 1747
1748 EvaluationResultImpl shiftRightError(BinaryExpression node, ErrorResult leftOp erand) => leftOperand; 1748 EvaluationResultImpl shiftRightError(BinaryExpression node, ErrorResult leftOp erand) => leftOperand;
1749 1749
1750 EvaluationResultImpl shiftRightValid(TypeProvider typeProvider, BinaryExpressi on node, ValidResult leftOperand) { 1750 EvaluationResultImpl shiftRightValid(TypeProvider typeProvider, BinaryExpressi on node, ValidResult leftOperand) {
1751 try { 1751 try {
1752 return valueOf(leftOperand.value.shiftRight(typeProvider, value)); 1752 return _valueOf(leftOperand.value.shiftRight(typeProvider, value));
1753 } on EvaluationException catch (exception) { 1753 } on EvaluationException catch (exception) {
1754 return error(node, exception.errorCode); 1754 return _error(node, exception.errorCode);
1755 } 1755 }
1756 } 1756 }
1757 1757
1758 EvaluationResultImpl timesError(BinaryExpression node, ErrorResult leftOperand ) => leftOperand; 1758 EvaluationResultImpl timesError(BinaryExpression node, ErrorResult leftOperand ) => leftOperand;
1759 1759
1760 EvaluationResultImpl timesValid(TypeProvider typeProvider, BinaryExpression no de, ValidResult leftOperand) { 1760 EvaluationResultImpl timesValid(TypeProvider typeProvider, BinaryExpression no de, ValidResult leftOperand) {
1761 try { 1761 try {
1762 return valueOf(leftOperand.value.times(typeProvider, value)); 1762 return _valueOf(leftOperand.value.times(typeProvider, value));
1763 } on EvaluationException catch (exception) { 1763 } on EvaluationException catch (exception) {
1764 return error(node, exception.errorCode); 1764 return _error(node, exception.errorCode);
1765 } 1765 }
1766 } 1766 }
1767 1767
1768 /** 1768 /**
1769 * Return a result object representing an error associated with the given node . 1769 * Return a result object representing an error associated with the given node .
1770 * 1770 *
1771 * @param node the AST node associated with the error 1771 * @param node the AST node associated with the error
1772 * @param code the error code indicating the nature of the error 1772 * @param code the error code indicating the nature of the error
1773 * @return a result object representing an error associated with the given nod e 1773 * @return a result object representing an error associated with the given nod e
1774 */ 1774 */
1775 ErrorResult error(AstNode node, ErrorCode code) => new ErrorResult.con1(node, code); 1775 ErrorResult _error(AstNode node, ErrorCode code) => new ErrorResult.con1(node, code);
1776 1776
1777 /** 1777 /**
1778 * Return a result object representing the given value. 1778 * Return a result object representing the given value.
1779 * 1779 *
1780 * @param value the value to be represented as a result object 1780 * @param value the value to be represented as a result object
1781 * @return a result object representing the given value 1781 * @return a result object representing the given value
1782 */ 1782 */
1783 ValidResult valueOf(DartObjectImpl value) => new ValidResult(value); 1783 ValidResult _valueOf(DartObjectImpl value) => new ValidResult(value);
1784 } 1784 }
1785 1785
1786 /** 1786 /**
1787 * Instances of the class `BoolState` represent the state of an object represent ing a boolean 1787 * Instances of the class `BoolState` represent the state of an object represent ing a boolean
1788 * value. 1788 * value.
1789 */ 1789 */
1790 class BoolState extends InstanceState { 1790 class BoolState extends InstanceState {
1791 /** 1791 /**
1792 * The value of this instance. 1792 * The value of this instance.
1793 */ 1793 */
(...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after
2637 * object for which there is no type information. 2637 * object for which there is no type information.
2638 */ 2638 */
2639 class DynamicState extends InstanceState { 2639 class DynamicState extends InstanceState {
2640 /** 2640 /**
2641 * The unique instance of this class. 2641 * The unique instance of this class.
2642 */ 2642 */
2643 static DynamicState DYNAMIC_STATE = new DynamicState(); 2643 static DynamicState DYNAMIC_STATE = new DynamicState();
2644 2644
2645 NumState add(InstanceState rightOperand) { 2645 NumState add(InstanceState rightOperand) {
2646 assertNumOrNull(rightOperand); 2646 assertNumOrNull(rightOperand);
2647 return unknownNum(rightOperand); 2647 return _unknownNum(rightOperand);
2648 } 2648 }
2649 2649
2650 IntState bitAnd(InstanceState rightOperand) { 2650 IntState bitAnd(InstanceState rightOperand) {
2651 assertIntOrNull(rightOperand); 2651 assertIntOrNull(rightOperand);
2652 return IntState.UNKNOWN_VALUE; 2652 return IntState.UNKNOWN_VALUE;
2653 } 2653 }
2654 2654
2655 IntState bitNot() => IntState.UNKNOWN_VALUE; 2655 IntState bitNot() => IntState.UNKNOWN_VALUE;
2656 2656
2657 IntState bitOr(InstanceState rightOperand) { 2657 IntState bitOr(InstanceState rightOperand) {
(...skipping 10 matching lines...) Expand all
2668 assertString(rightOperand); 2668 assertString(rightOperand);
2669 return StringState.UNKNOWN_VALUE; 2669 return StringState.UNKNOWN_VALUE;
2670 } 2670 }
2671 2671
2672 BoolState convertToBool() => BoolState.UNKNOWN_VALUE; 2672 BoolState convertToBool() => BoolState.UNKNOWN_VALUE;
2673 2673
2674 StringState convertToString() => StringState.UNKNOWN_VALUE; 2674 StringState convertToString() => StringState.UNKNOWN_VALUE;
2675 2675
2676 NumState divide(InstanceState rightOperand) { 2676 NumState divide(InstanceState rightOperand) {
2677 assertNumOrNull(rightOperand); 2677 assertNumOrNull(rightOperand);
2678 return unknownNum(rightOperand); 2678 return _unknownNum(rightOperand);
2679 } 2679 }
2680 2680
2681 BoolState equalEqual(InstanceState rightOperand) { 2681 BoolState equalEqual(InstanceState rightOperand) {
2682 assertBoolNumStringOrNull(rightOperand); 2682 assertBoolNumStringOrNull(rightOperand);
2683 return BoolState.UNKNOWN_VALUE; 2683 return BoolState.UNKNOWN_VALUE;
2684 } 2684 }
2685 2685
2686 String get typeName => "dynamic"; 2686 String get typeName => "dynamic";
2687 2687
2688 BoolState greaterThan(InstanceState rightOperand) { 2688 BoolState greaterThan(InstanceState rightOperand) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
2721 2721
2722 BoolState logicalNot() => BoolState.UNKNOWN_VALUE; 2722 BoolState logicalNot() => BoolState.UNKNOWN_VALUE;
2723 2723
2724 BoolState logicalOr(InstanceState rightOperand) { 2724 BoolState logicalOr(InstanceState rightOperand) {
2725 assertBool(rightOperand); 2725 assertBool(rightOperand);
2726 return rightOperand.convertToBool(); 2726 return rightOperand.convertToBool();
2727 } 2727 }
2728 2728
2729 NumState minus(InstanceState rightOperand) { 2729 NumState minus(InstanceState rightOperand) {
2730 assertNumOrNull(rightOperand); 2730 assertNumOrNull(rightOperand);
2731 return unknownNum(rightOperand); 2731 return _unknownNum(rightOperand);
2732 } 2732 }
2733 2733
2734 NumState negated() => NumState.UNKNOWN_VALUE; 2734 NumState negated() => NumState.UNKNOWN_VALUE;
2735 2735
2736 NumState remainder(InstanceState rightOperand) { 2736 NumState remainder(InstanceState rightOperand) {
2737 assertNumOrNull(rightOperand); 2737 assertNumOrNull(rightOperand);
2738 return unknownNum(rightOperand); 2738 return _unknownNum(rightOperand);
2739 } 2739 }
2740 2740
2741 IntState shiftLeft(InstanceState rightOperand) { 2741 IntState shiftLeft(InstanceState rightOperand) {
2742 assertIntOrNull(rightOperand); 2742 assertIntOrNull(rightOperand);
2743 return IntState.UNKNOWN_VALUE; 2743 return IntState.UNKNOWN_VALUE;
2744 } 2744 }
2745 2745
2746 IntState shiftRight(InstanceState rightOperand) { 2746 IntState shiftRight(InstanceState rightOperand) {
2747 assertIntOrNull(rightOperand); 2747 assertIntOrNull(rightOperand);
2748 return IntState.UNKNOWN_VALUE; 2748 return IntState.UNKNOWN_VALUE;
2749 } 2749 }
2750 2750
2751 NumState times(InstanceState rightOperand) { 2751 NumState times(InstanceState rightOperand) {
2752 assertNumOrNull(rightOperand); 2752 assertNumOrNull(rightOperand);
2753 return unknownNum(rightOperand); 2753 return _unknownNum(rightOperand);
2754 } 2754 }
2755 2755
2756 /** 2756 /**
2757 * Return an object representing an unknown numeric value whose type is based on the type of the 2757 * Return an object representing an unknown numeric value whose type is based on the type of the
2758 * right-hand operand. 2758 * right-hand operand.
2759 * 2759 *
2760 * @param rightOperand the operand whose type will determine the type of the r esult 2760 * @param rightOperand the operand whose type will determine the type of the r esult
2761 * @return an object representing an unknown numeric value 2761 * @return an object representing an unknown numeric value
2762 */ 2762 */
2763 NumState unknownNum(InstanceState rightOperand) { 2763 NumState _unknownNum(InstanceState rightOperand) {
2764 if (rightOperand is IntState) { 2764 if (rightOperand is IntState) {
2765 return IntState.UNKNOWN_VALUE; 2765 return IntState.UNKNOWN_VALUE;
2766 } else if (rightOperand is DoubleState) { 2766 } else if (rightOperand is DoubleState) {
2767 return DoubleState.UNKNOWN_VALUE; 2767 return DoubleState.UNKNOWN_VALUE;
2768 } 2768 }
2769 return NumState.UNKNOWN_VALUE; 2769 return NumState.UNKNOWN_VALUE;
2770 } 2770 }
2771 } 2771 }
2772 2772
2773 /** 2773 /**
(...skipping 1410 matching lines...) Expand 10 before | Expand all | Expand 10 after
4184 } 4184 }
4185 return BoolState.FALSE_STATE; 4185 return BoolState.FALSE_STATE;
4186 } 4186 }
4187 4187
4188 String get typeName => "Type"; 4188 String get typeName => "Type";
4189 4189
4190 int get hashCode => _element == null ? 0 : _element.hashCode; 4190 int get hashCode => _element == null ? 0 : _element.hashCode;
4191 4191
4192 String toString() => _element == null ? "-unknown-" : _element.name; 4192 String toString() => _element == null ? "-unknown-" : _element.name;
4193 } 4193 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/ast.dart ('k') | pkg/analyzer/lib/src/generated/element.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698