replaceReadClassMemberInExpression function

Expression replaceReadClassMemberInExpression(
  1. Expression expression,
  2. ReplaceWithName replacer
)

Returns expression with every ReadClassMemberExpr replaced with an equivalently named ReadPropExpr invoked on the receiver returned from replacer.

replacer is passed the name of the ReadClassMemberExpr being replaced.

Any ReadNodeReferenceExpr encountered are promoted to class members and replaced in the same way.

Implementation

o.Expression replaceReadClassMemberInExpression(
    o.Expression expression, ReplaceWithName replacer) {
  var transformer = _ReplaceReadClassMemberTransformer(replacer);
  return expression.visitExpression(transformer, null);
}