Пример #1
0
  @Override
  public Type _writeOut(BytecodeContext bc, int mode) throws BytecodeException {

    int form = VALUE;
    int type = STRING;
    if (name instanceof Variable && !((Variable) name).fromHash()) {
      GeneratorAdapter adapter = bc.getAdapter();
      String[] arr = VariableString.variableToStringArray((Variable) name, true);
      if (arr.length > 1) {
        form = ARRAY;
        ArrayVisitor av = new ArrayVisitor();
        av.visitBegin(adapter, Types.STRING, arr.length);
        for (int y = 0; y < arr.length; y++) {
          av.visitBeginItem(adapter, y);
          adapter.push(varKeyUpperCase ? arr[y].toUpperCase() : arr[y]);
          av.visitEndItem(bc.getAdapter());
        }
        av.visitEnd();
      } else {
        // VariableString.toExprString(name).writeOut(bc, MODE_REF);
        String str = VariableString.variableToString((Variable) name, true);
        name = LitString.toExprString(varKeyUpperCase ? str.toUpperCase() : str);
        type = Variable.registerKey(bc, VariableString.toExprString(name)) ? KEY : STRING;
      }
    } else {
      // CastString.toExprString(name).writeOut(bc, MODE_REF);
      type = Variable.registerKey(bc, CastString.toExprString(name)) ? KEY : STRING;
    }
    // name.writeOut(bc, MODE_REF);
    super._writeOut(bc, MODE_REF);
    // bc.getAdapter().push(variableString);
    bc.getAdapter().invokeStatic(TYPE_FUNCTION_VALUE, NEW_INSTANCE[type][form]);
    return Types.FUNCTION_VALUE;
  }