variables method

Map<String, Node> variables ()

Returns the variables list if exist, else creates it.


Map<String, Node> variables() => _variables ??= (rules == null)
    ? <String, Node>{}
    : rules.fold(<String, Node>{}, (Map<String, Node> hash, Node r) {
        if (r is Declaration && r.variable) hash[] = r;

        // when evaluating variables in an import statement, imports have not been eval'd
        // so we need to go inside import statements.
        // guard against root being a string (in the case of inlined less)
        if (r is Import && r.root != null && r.root is VariableMixin) {
          final Map<String, Node> vars = r.root.variables();
          for (final name in vars.keys) {
            if (vars.containsKey(name)) hash[name] = r.root.variable(name);
        return hash;