visitReadVarExpr method

  1. @override
void visitReadVarExpr(
  1. ReadVarExpr ast,
  2. EmitterVisitorContext context
)
override

Implementation

@override
void visitReadVarExpr(o.ReadVarExpr ast, EmitterVisitorContext context) {
  var varName = ast.name;
  if (ast.builtin != null) {
    switch (ast.builtin) {
      case o.BuiltinVar.Super:
        varName = 'super';
        break;
      case o.BuiltinVar.This:
        varName = 'this';
        break;
      case o.BuiltinVar.CatchError:
        varName = catchErrorVar.name;
        break;
      case o.BuiltinVar.CatchStack:
        varName = catchStackVar.name;
        break;
      case o.BuiltinVar.MetadataMap:
        varName = 'null';
        break;
      default:
        throw StateError('Unknown builtin variable ${ast.builtin}');
    }
  }
  context.print(varName!);
}