withMethod :: [AccessFlag] -> Text -> [FieldType] -> ReturnType -> CodeGen () -> CodeGen MethodDef
withMethod accessFlags name fts rt body = do
  oldCode <- getMethodCode
  oldNextLocal <- peekNextLocal
  oldNextLabel <- peekNextLabel
  setMethodCode mempty
  setNextLocal 2
  setNextLabel 0
  body
  emit vreturn
  clsName <- getClass
  newCode <- getMethodCode
  let methodDef = mkMethodDef clsName accessFlags name fts rt newCode
  defineMethod methodDef
  setMethodCode oldCode
  setNextLocal oldNextLocal
  setNextLabel oldNextLabel
  return methodDef
withMethod :: [AccessFlag] -> Text -> [FieldType] -> ReturnType -> CodeGen () -> CodeGen MethodDef
withMethod accessFlags name fts rt body = do
  oldCode <- getMethodCode
  oldNextLocal <- peekNextLocal
  oldNextLabel <- peekNextLabel
  setMethodCode mempty
  setNextLocal 2
  setNextLabel 0
  body
  emit vreturn
  clsName <- getClass
  newCode <- getMethodCode
  let methodDef = mkMethodDef clsName accessFlags name fts rt newCode
  defineMethod methodDef
  setMethodCode oldCode
  setNextLocal oldNextLocal
  setNextLabel oldNextLabel
  return methodDef
withMethod accessFlags name fts rt body = do
  oldCode <- getMethodCode
  oldNextLocal <- peekNextLocal
  oldNextLabel <- peekNextLabel
  setMethodCode mempty
  setNextLocal 2
  setNextLabel 0
  body
  emit vreturn
  clsName <- getClass
  newCode <- getMethodCode
  let methodDef = mkMethodDef clsName accessFlags name fts rt newCode
  defineMethod methodDef
  setMethodCode oldCode
  setNextLocal oldNextLocal
  setNextLabel oldNextLabel
  return methodDef