visitLiteralMapExpr method

  1. @override
void visitLiteralMapExpr(
  1. LiteralMapExpr ast,
  2. EmitterVisitorContext context
)
override

Implementation

@override
void visitLiteralMapExpr(
    o.LiteralMapExpr ast, EmitterVisitorContext context) {
  var useNewLine = ast.entries.length > 1;
  context.print('{', useNewLine);
  context.incIndent();
  visitAllObjects((List<dynamic> entry) {
    final /* String | Expression */ firstEntry = entry[0];
    if (firstEntry is o.Expression) {
      firstEntry.visitExpression(this, context);
    } else {
      final firstEntryCasted = firstEntry as String;
      context.print(
          escapeSingleQuoteString(firstEntryCasted, _escapeDollarInStrings)!);
    }
    context.print(': ');
    entry[1].visitExpression(this, context);
  }, ast.entries, context, ',', newLine: useNewLine, keepOnSameLine: false);
  context.decIndent();
  context.print('}', useNewLine);
}