LCOV - code coverage report
Current view: top level - boolean_selector-2.1.0/lib/src - evaluator.dart (source / functions) Hit Total Coverage
Test: lcov.info Lines: 3 13 23.1 %
Date: 2021-11-28 14:37:50 Functions: 0 0 -

          Line data    Source code
       1             : // Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
       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.
       4             : 
       5             : import 'ast.dart';
       6             : import 'visitor.dart';
       7             : 
       8             : /// A visitor for evaluating boolean selectors against a specific set of
       9             : /// semantics.
      10             : class Evaluator implements Visitor<bool> {
      11             :   final bool Function(String variable) _semantics;
      12             : 
      13           5 :   Evaluator(this._semantics);
      14             : 
      15           5 :   @override
      16          10 :   bool visitVariable(VariableNode node) => _semantics(node.name);
      17             : 
      18           0 :   @override
      19           0 :   bool visitNot(NotNode node) => !node.child.accept(this);
      20             : 
      21           0 :   @override
      22             :   bool visitOr(OrNode node) =>
      23           0 :       node.left.accept(this) || node.right.accept(this);
      24             : 
      25           0 :   @override
      26             :   bool visitAnd(AndNode node) =>
      27           0 :       node.left.accept(this) && node.right.accept(this);
      28             : 
      29           0 :   @override
      30           0 :   bool visitConditional(ConditionalNode node) => node.condition.accept(this)
      31           0 :       ? node.whenTrue.accept(this)
      32           0 :       : node.whenFalse.accept(this);
      33             : }

Generated by: LCOV version 1.14