mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
This is immensely useful when working on generic code, where the signatures of (many) functions are all that is required, and removing the bodies makes things compile faster, allows tools like creduce to work better and results in less noise in a debugger. Unfortunately the design of refactoring means this currently only works on a single top-level decl, or multiple decls inside a type.
69 lines
2.6 KiB
Modula-2
69 lines
2.6 KiB
Modula-2
#ifndef REFACTORING
|
|
#define REFACTORING(KIND, NAME, ID)
|
|
#endif
|
|
|
|
#ifndef SEMANTIC_REFACTORING
|
|
#define SEMANTIC_REFACTORING(KIND, NAME, ID) REFACTORING(KIND, NAME, ID)
|
|
#endif
|
|
|
|
#ifndef RANGE_REFACTORING
|
|
#define RANGE_REFACTORING(KIND, NAME, ID) SEMANTIC_REFACTORING(KIND, NAME, ID)
|
|
#endif
|
|
|
|
#ifndef CURSOR_REFACTORING
|
|
#define CURSOR_REFACTORING(KIND, NAME, ID) SEMANTIC_REFACTORING(KIND, NAME, ID)
|
|
#endif
|
|
|
|
/// Rename and categorise the symbol occurrences at provided locations
|
|
/// (syntactically).
|
|
REFACTORING(GlobalRename, "Global Rename", rename.global)
|
|
|
|
/// Categorize source ranges for symbol occurrences at provided locations
|
|
/// (syntactically).
|
|
REFACTORING(FindGlobalRenameRanges, "Find Global Rename Ranges", rename.global.find-ranges)
|
|
|
|
/// Find and categorize all occurences of the file-local symbol at a given
|
|
/// location.
|
|
REFACTORING(FindLocalRenameRanges, "Find Local Rename Ranges", rename.local.find-ranges)
|
|
|
|
/// Find and rename all occurences of the file-local symbol at a given
|
|
/// location.
|
|
CURSOR_REFACTORING(LocalRename, "Local Rename", rename.local)
|
|
|
|
CURSOR_REFACTORING(FillProtocolStub, "Add Missing Protocol Requirements", fillstub)
|
|
|
|
CURSOR_REFACTORING(ExpandDefault, "Expand Default", expand.default)
|
|
|
|
CURSOR_REFACTORING(ExpandSwitchCases, "Expand Switch Cases", expand.switch.cases)
|
|
|
|
CURSOR_REFACTORING(LocalizeString, "Localize String", localize.string)
|
|
|
|
CURSOR_REFACTORING(SimplifyNumberLiteral, "Simplify Long Number Literal", simplify.long.number.literal)
|
|
|
|
CURSOR_REFACTORING(CollapseNestedIfExpr, "Collapse Nested If Expression", collapse.nested.if.expr)
|
|
|
|
CURSOR_REFACTORING(ConvertToDoCatch, "Convert To Do/Catch", convert.do.catch)
|
|
|
|
CURSOR_REFACTORING(TrailingClosure, "Convert To Trailing Closure", trailingclosure)
|
|
|
|
RANGE_REFACTORING(ExtractExpr, "Extract Expression", extract.expr)
|
|
|
|
RANGE_REFACTORING(ExtractFunction, "Extract Method", extract.function)
|
|
|
|
RANGE_REFACTORING(ExtractRepeatedExpr, "Extract Repeated Expression", extract.expr.repeated)
|
|
|
|
RANGE_REFACTORING(MoveMembersToExtension, "Move To Extension", move.members.to.extension)
|
|
|
|
RANGE_REFACTORING(ConvertStringsConcatenationToInterpolation, "Convert to String Interpolation", convert.string-concatenation.interpolation)
|
|
|
|
RANGE_REFACTORING(ExpandTernaryExpr, "Expand Ternary Expression", expand.ternary.expr)
|
|
|
|
RANGE_REFACTORING(ConvertToTernaryExpr, "Convert To Ternary Expression", convert.ternary.expr)
|
|
|
|
RANGE_REFACTORING(ReplaceBodiesWithFatalError, "Replace function bodies with fatalError", replace.bodies.with.fatalError)
|
|
|
|
#undef CURSOR_REFACTORING
|
|
#undef RANGE_REFACTORING
|
|
#undef SEMANTIC_REFACTORING
|
|
#undef REFACTORING
|