The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
%prefix smop_s1p_flattenedscope
%prototype SMOP__S1P__FlattenedScope
%RI.id flattened lexical scope
%attr SMOP__Object* lexical
%getter lexical
%{
  static SMOP__Object* SMOP__ID__lookup;
%}

%init {
 SMOP__ID__lookup = SMOP__NATIVE__idconst_create("lookup");
%}

%method FETCH
    ___VALUE_FETCH___;
%method STORE
    ___VALUE_STORE___;

%method new
  ret = smop_nagc_alloc(sizeof(smop_s1p_flattenedscope_struct));
  SMOP_REFERENCE(interpreter,RI);
  ret->RI = (SMOP__ResponderInterface*)RI;
  ((smop_s1p_flattenedscope_struct*)ret)->lexical = SMOP__NATIVE__capture_positional(interpreter, capture, 1);

%method postcircumfix:{ }
  smop_nagc_rdlock((SMOP__NAGC__Object*)invocant);
  SMOP__Object* lexical = ((smop_s1p_flattenedscope_struct*)invocant)->lexical;
  smop_nagc_unlock((SMOP__NAGC__Object*)invocant);
  SMOP__Object* symbol = SMOP__NATIVE__capture_positional(interpreter,capture,1);
  ret = SMOP_DISPATCH(interpreter, SMOP_RI(lexical),
    SMOP__ID__lookup,
    SMOP__NATIVE__capture_create(interpreter,
      (SMOP__Object*[]) {
        SMOP_REFERENCE(interpreter,lexical),
        symbol, NULL },
      (SMOP__Object*[]) {NULL}
    ));

%DESTROYALL {
    smop_nagc_wrlock((SMOP__NAGC__Object*)invocant);
    SMOP__Object* lexical = ((smop_s1p_flattenedscope_struct*)invocant)->lexical;
    smop_nagc_unlock((SMOP__NAGC__Object*)invocant);
    SMOP_RELEASE(interpreter,lexical);
    SMOP_RELEASE(interpreter,RI);
%}