2016-08-14 22:32:00 -07:00
|
|
|
// Copyright 2016 Google Inc. Use of this source code is governed by an
|
|
|
|
// MIT-style license that can be found in the LICENSE file or at
|
|
|
|
// https://opensource.org/licenses/MIT.
|
|
|
|
|
|
|
|
import 'package:source_span/source_span.dart';
|
|
|
|
|
|
|
|
import '../../../utils.dart';
|
2016-08-14 23:51:29 -07:00
|
|
|
import '../../../visitor/interface/expression.dart';
|
2016-08-14 22:32:00 -07:00
|
|
|
import '../expression.dart';
|
|
|
|
|
|
|
|
class MapExpression implements Expression {
|
|
|
|
final List<List<Expression>> pairs;
|
|
|
|
|
|
|
|
final FileSpan span;
|
|
|
|
|
2016-08-28 14:53:20 -07:00
|
|
|
MapExpression(Iterable<Pair<Expression, Expression>> pairs, this.span)
|
2016-08-14 22:32:00 -07:00
|
|
|
: pairs = new List.unmodifiable(pairs);
|
|
|
|
|
|
|
|
/*=T*/ accept/*<T>*/(ExpressionVisitor/*<T>*/ visitor) =>
|
|
|
|
visitor.visitMapExpression(this);
|
|
|
|
|
|
|
|
String toString() =>
|
|
|
|
'(${pairs.map((pair) => '${pair.first}: ${pair.last}').join(', ')})';
|
|
|
|
}
|