با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
blockly > CodeGenerator > finish
متد CodeGenerator.finish()
برای اجرای کد در پایان تولید کد قلاب کنید. کلاسهای فرعی ممکن است این را لغو کنند، به عنوان مثال کد تولید شده را با عبارات واردات یا تعاریف متغیر اضافه کنند.
امضا:
finish(code: string): string;
پارامترها
پارامتر | تایپ کنید | توضیحات |
---|
کد | رشته | کد تولید شده |
برمیگرداند:
رشته
کد تکمیل شده
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-07-25 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","easyToUnderstand","thumb-up"],["مشکلم را برطرف کرد","solvedMyProblem","thumb-up"],["غیره","otherUp","thumb-up"]],[["اطلاعاتی که نیاز دارم وجود ندارد","missingTheInformationINeed","thumb-down"],["بیشازحد پیچیده/ مراحل بسیار زیاد","tooComplicatedTooManySteps","thumb-down"],["قدیمی","outOfDate","thumb-down"],["مشکل ترجمه","translationIssue","thumb-down"],["مشکل کد / نمونهها","samplesCodeIssue","thumb-down"],["غیره","otherDown","thumb-down"]],["تاریخ آخرین بهروزرسانی 2025-07-25 بهوقت ساعت هماهنگ جهانی."],[[["The `CodeGenerator.finish()` method is a hook for executing code after the main code generation process."],["It allows subclasses to modify the final generated code, such as adding import statements or variable definitions."],["The method accepts the generated code as input and returns the modified code."]]],["The `finish()` method in the `CodeGenerator` class allows for post-processing of generated code. It takes a string of generated code as input and returns a string of completed code. Subclasses can override this method to add operations such as prepending import statements or variable definitions to the generated code. The method's core function is to modify and finalize the code generated by the system.\n"]]