Rewrites all returns in a block to specifications of the named value.

For example,

if (condition) {
    return a;
} else {
    return b;
}

is rewritten to

if (condition) {
    returnValue = a;
} else {
    returnValue = b;
}

You should only use this if the block has no early returns, otherwise this changes the semantics of the block.

Usage:

rewrittenBlock= someBlock.transform(RewriteReturnsEditor(returnValueName));
  • RewriteReturnsEditor
    • Basic
      • Identifiable
      • Object
        • Anything
    • Editor
      • ImmediateNarrowingTransformer
        • NarrowingTransformer
          • Transformer

no subtypes hierarchy

Initializer
RewriteReturnsEditor(LIdentifier returnValueName)
Inherited Attributes
Attributes inherited from: Object
hash, string
Methods
transformBlockshared actual Block transformBlock(Block that)
Refines Editor.transformBlock ultimately refines Transformer.transformBlock
Inherited Methods
Methods inherited from: Object
equals
Methods inherited from: Editor
editNode, transformAddAssignmentOperation, transformAddingExpression, transformAliasDec, transformAndAssignmentOperation, transformAndOperation, transformAnnotation, transformAnnotations, transformAnonymousArgument, transformAnyClass, transformAnyCompilationUnit, transformAnyFunction, transformAnyInterface, transformAnyInterfaceDefinition, transformAnyMemberOperator, transformAnySpecifier, transformAnyValue, transformArgumentList, transformArguments, transformArithmeticAssignmentOperation, transformArithmeticOperation, transformAssertion, transformAssignOperation, transformAssigningExpression, transformAssignmentOperation, transformAssignmentStatement, transformAtom, transformBaseExpression, transformBaseMeta, transformBaseType, transformBinaryOperation, transformBlock, transformBody, transformBooleanCondition, transformBound, transformBreak, transformCallableConstructorDefinition, transformCallableParameter, transformCallableType, transformCaseClause, transformCaseExpression, transformCaseItem, transformCaseTypes, transformCatchClause, transformCharacterLiteral, transformClassAliasDefinition, transformClassBody, transformClassDec, transformClassDefinition, transformClassOrInterface, transformClassSpecifier, transformClosedBound, transformCompareOperation, transformComparingExpression, transformComparisonOperation, transformCompilationUnit, transformComplementAssignmentOperation, transformComplementOperation, transformComprehension, transformComprehensionClause, transformCondition, transformConditionalExpression, transformConditions, transformConjoiningExpression, transformConstruction, transformConstructorDec, transformConstructorDefinition, transformContinue, transformControlStructure, transformDec, transformDecQualifier, transformDeclaration, transformDefaultedCallableParameter, transformDefaultedParameter, transformDefaultedParameterReference, transformDefaultedType, transformDefaultedValueParameter, transformDestructure, transformDifferenceOperation, transformDirective, transformDisjoiningExpression, transformDivideAssignmentOperation, transformDynamicBlock, transformDynamicInterfaceDefinition, transformDynamicModifier, transformDynamicValue, transformElementOrSubrangeExpression, transformElseClause, transformElseOperation, transformEntryOperation, transformEntryPattern, transformEntryType, transformEqualOperation, transformEqualityOperation, transformEquatingExpression, transformExistsCondition, transformExistsNonemptyExpression, transformExistsOperation, transformExistsOrNonemptyCondition, transformExponentiatingExpression, transformExponentiationOperation, transformExpression, transformExpressionComprehensionClause, transformExpressionStatement, transformExtendedType, transformExtension, transformExtensionOrConstruction, transformFailClause, transformFinallyClause, transformFloatLiteral, transformForClause, transformForComprehensionClause, transformForFail, transformForIterator, transformFullPackageName, transformFunctionArgument, transformFunctionDec, transformFunctionDeclaration, transformFunctionDefinition, transformFunctionExpression, transformFunctionModifier, transformFunctionShortcutDefinition, transformGivenDec, transformGroupedExpression, transformGroupedType, transformIdenticalOperation, transformIdentifier, transformIdentityOperation, transformIfClause, transformIfComprehensionClause, transformIfElse, transformIfElseExpression, transformImport, transformImportAlias, transformImportElement, transformImportElements, transformImportWildcard, transformInModifier, transformInOperation, transformInitialComprehensionClause, transformInlineDefinitionArgument, transformIntegerLiteral, transformInterfaceAliasDefinition, transformInterfaceBody, transformInterfaceDec, transformInterfaceDefinition, transformIntersectAssignmentOperation, transformIntersectingExpression, transformIntersectionOperation, transformIntersectionType, transformInvertingExpression, transformInvocation, transformInvocationStatement, transformIsCase, transformIsCondition, transformIsOperation, transformIterable, transformIterableType, transformKeySubscript, transformLIdentifier, transformLargeAsOperation, transformLargerOperation, transformLazySpecification, transformLazySpecifier, transformLetExpression, transformLiteral, transformLocalModifier, transformLogicalAssignmentOperation, transformLogicalOperation, transformMainType, transformMatchCase, transformMeasureOperation, transformMeasureSubscript, transformMemberDec, transformMemberMeta, transformMemberNameWithTypeArguments, transformMemberOperator, transformMeta, transformModifier, transformModuleBody, transformModuleCompilationUnit, transformModuleDec, transformModuleDescriptor, transformModuleImport, transformMultiplyAssignmentOperation, transformMultiplyingExpression, transformNameWithTypeArguments, transformNamedArgument, transformNamedArguments, transformNegatingExpression, transformNegationOperation, transformNonemptyCondition, transformNonemptyOperation, transformNotEqualOperation, transformNotOperation, transformObjectArgument, transformObjectDefinition, transformObjectExpression, transformOfOperation, transformOpenBound, transformOperation, transformOptionalType, transformOrAssignmentOperation, transformOrOperation, transformOutModifier, transformOuter, transformPackage, transformPackageCompilationUnit, transformPackageDec, transformPackageDescriptor, transformPackageQualifier, transformParameter, transformParameterReference, transformParameters, transformPattern, transformPatternList, transformPositionalArguments, transformPostfixDecrementOperation, transformPostfixIncrementOperation, transformPostfixOperation, transformPrePostfixingExpression, transformPrefixDecrementOperation, transformPrefixIncrementOperation, transformPrefixOperation, transformPrefixPostfixStatement, transformPrimary, transformPrimaryType, transformProductOperation, transformQualifiedExpression, transformQualifiedType, transformQuotientOperation, transformRangeSubscript, transformRemainderAssignmentOperation, transformRemainderOperation, transformRequiredParameter, transformResource, transformResources, transformReturn, transformSafeMemberOperator, transformSatisfiedTypes, transformScaleOperation, transformScalingExpression, transformSelfReference, transformSequentialType, transformSetAssignmentOperation, transformSetOperation, transformSimpleType, transformSmallAsOperation, transformSmallerOperation, transformSpanFromSubscript, transformSpanOperation, transformSpanSubscript, transformSpanToSubscript, transformSpanningExpression, transformSpecification, transformSpecifiedArgument, transformSpecifiedPattern, transformSpecifiedVariable, transformSpecifier, transformSpreadArgument, transformSpreadMemberOperator, transformSpreadType, transformStatement, transformStringLiteral, transformStringTemplate, transformStructureExpression, transformSubscript, transformSubtractAssignmentOperation, transformSumOperation, transformSuper, transformSwitchCaseElse, transformSwitchCaseElseExpression, transformSwitchCases, transformSwitchClause, transformThenElseExpression, transformThenOperation, transformThis, transformThrow, transformTryCatchFinally, transformTryClause, transformTuple, transformTuplePattern, transformTupleType, transformType, transformTypeAliasDefinition, transformTypeArgument, transformTypeArguments, transformTypeConstraint, transformTypeDec, transformTypeDeclaration, transformTypeIsh, transformTypeList, transformTypeMeta, transformTypeModifier, transformTypeNameWithTypeArguments, transformTypeParameter, transformTypeParameters, transformTypeSpecifier, transformTypedDeclaration, transformTypedVariable, transformUIdentifier, transformUnaryArithmeticOperation, transformUnaryIshOperation, transformUnaryOperation, transformUnaryTypeOperation, transformUnionAssignmentOperation, transformUnionOperation, transformUnionType, transformUnionableType, transformUnioningExpression, transformUnspecifiedVariable, transformValueArgument, transformValueConstructorDefinition, transformValueDec, transformValueDeclaration, transformValueDefinition, transformValueExpression, transformValueGetterDefinition, transformValueModifier, transformValueParameter, transformValueSetterDefinition, transformValueSpecification, transformVariable, transformVariablePattern, transformVariadicParameter, transformVariadicType, transformVariadicVariable, transformVariance, transformVoidModifier, transformWhile, transformWithinOperation
Methods inherited from: ImmediateNarrowingTransformer<Result>
transformAddingExpression, transformAnyClass, transformAnyCompilationUnit, transformAnyFunction, transformAnyInterface, transformAnyInterfaceDefinition, transformAnyMemberOperator, transformAnySpecifier, transformAnyValue, transformArguments, transformArithmeticAssignmentOperation, transformArithmeticOperation, transformAssigningExpression, transformAssignmentOperation, transformAtom, transformBinaryOperation, transformBody, transformBound, transformCaseItem, transformClassOrInterface, transformComparingExpression, transformComparisonOperation, transformComprehensionClause, transformCondition, transformConditionalExpression, transformConjoiningExpression, transformConstructorDefinition, transformControlStructure, transformDec, transformDeclaration, transformDefaultedParameter, transformDirective, transformDisjoiningExpression, transformEqualityOperation, transformEquatingExpression, transformExistsNonemptyExpression, transformExistsOrNonemptyCondition, transformExponentiatingExpression, transformExpression, transformExpressionStatement, transformExtensionOrConstruction, transformIdentifier, transformInitialComprehensionClause, transformInlineDefinitionArgument, transformIntersectingExpression, transformInvertingExpression, transformLiteral, transformLocalModifier, transformLogicalAssignmentOperation, transformLogicalOperation, transformMainType, transformMemberDec, transformMeta, transformModifier, transformMultiplyingExpression, transformNameWithTypeArguments, transformNamedArgument, transformNegatingExpression, transformNode, transformOperation, transformParameter, transformPattern, transformPostfixOperation, transformPrePostfixingExpression, transformPrefixOperation, transformPrimary, transformPrimaryType, transformRangeSubscript, transformRequiredParameter, transformScalingExpression, transformSelfReference, transformSetAssignmentOperation, transformSetOperation, transformSimpleType, transformSpanningExpression, transformSpecification, transformStatement, transformStructureExpression, transformSubscript, transformThenElseExpression, transformType, transformTypeDec, transformTypeDeclaration, transformTypeIsh, transformTypeModifier, transformTypedDeclaration, transformUnaryArithmeticOperation, transformUnaryIshOperation, transformUnaryOperation, transformUnaryTypeOperation, transformUnionableType, transformUnioningExpression, transformValueExpression, transformVariable, transformVariance
Methods inherited from: NarrowingTransformer<Result>
transformAddingExpression, transformAssigningExpression, transformComparingExpression, transformConjoiningExpression, transformDisjoiningExpression, transformEquatingExpression, transformExistsNonemptyExpression, transformExponentiatingExpression, transformIntersectingExpression, transformInvertingExpression, transformMultiplyingExpression, transformNegatingExpression, transformPrePostfixingExpression, transformScalingExpression, transformSpanningExpression, transformStructureExpression, transformThenElseExpression, transformUnioningExpression
Methods inherited from: Transformer<Result>
transformAddAssignmentOperation, transformAliasDec, transformAndAssignmentOperation, transformAndOperation, transformAnnotation, transformAnnotations, transformAnonymousArgument, transformAnyClass, transformAnyCompilationUnit, transformAnyFunction, transformAnyInterface, transformAnyInterfaceDefinition, transformAnyMemberOperator, transformAnySpecifier, transformAnyValue, transformArgumentList, transformArguments, transformArithmeticAssignmentOperation, transformArithmeticOperation, transformAssertion, transformAssignOperation, transformAssignmentOperation, transformAssignmentStatement, transformAtom, transformBaseExpression, transformBaseMeta, transformBaseType, transformBinaryOperation, transformBlock, transformBody, transformBooleanCondition, transformBound, transformBreak, transformCallableConstructorDefinition, transformCallableParameter, transformCallableType, transformCaseClause, transformCaseExpression, transformCaseItem, transformCaseTypes, transformCatchClause, transformCharacterLiteral, transformClassAliasDefinition, transformClassBody, transformClassDec, transformClassDefinition, transformClassOrInterface, transformClassSpecifier, transformClosedBound, transformCompareOperation, transformComparisonOperation, transformCompilationUnit, transformComplementAssignmentOperation, transformComplementOperation, transformComprehension, transformComprehensionClause, transformCondition, transformConditionalExpression, transformConditions, transformConstruction, transformConstructorDec, transformConstructorDefinition, transformContinue, transformControlStructure, transformDec, transformDecQualifier, transformDeclaration, transformDefaultedCallableParameter, transformDefaultedParameter, transformDefaultedParameterReference, transformDefaultedType, transformDefaultedValueParameter, transformDestructure, transformDifferenceOperation, transformDirective, transformDivideAssignmentOperation, transformDynamicBlock, transformDynamicInterfaceDefinition, transformDynamicModifier, transformDynamicValue, transformElementOrSubrangeExpression, transformElseClause, transformElseOperation, transformEntryOperation, transformEntryPattern, transformEntryType, transformEqualOperation, transformEqualityOperation, transformExistsCondition, transformExistsOperation, transformExistsOrNonemptyCondition, transformExponentiationOperation, transformExpression, transformExpressionComprehensionClause, transformExpressionStatement, transformExtendedType, transformExtension, transformExtensionOrConstruction, transformFailClause, transformFinallyClause, transformFloatLiteral, transformForClause, transformForComprehensionClause, transformForFail, transformForIterator, transformFullPackageName, transformFunctionArgument, transformFunctionDec, transformFunctionDeclaration, transformFunctionDefinition, transformFunctionExpression, transformFunctionModifier, transformFunctionShortcutDefinition, transformGivenDec, transformGroupedExpression, transformGroupedType, transformIdenticalOperation, transformIdentifier, transformIdentityOperation, transformIfClause, transformIfComprehensionClause, transformIfElse, transformIfElseExpression, transformImport, transformImportAlias, transformImportElement, transformImportElements, transformImportWildcard, transformInModifier, transformInOperation, transformInitialComprehensionClause, transformInlineDefinitionArgument, transformIntegerLiteral, transformInterfaceAliasDefinition, transformInterfaceBody, transformInterfaceDec, transformInterfaceDefinition, transformIntersectAssignmentOperation, transformIntersectionOperation, transformIntersectionType, transformInvocation, transformInvocationStatement, transformIsCase, transformIsCondition, transformIsOperation, transformIterable, transformIterableType, transformKeySubscript, transformLIdentifier, transformLargeAsOperation, transformLargerOperation, transformLazySpecification, transformLazySpecifier, transformLetExpression, transformLiteral, transformLocalModifier, transformLogicalAssignmentOperation, transformLogicalOperation, transformMainType, transformMatchCase, transformMeasureOperation, transformMeasureSubscript, transformMemberDec, transformMemberMeta, transformMemberNameWithTypeArguments, transformMemberOperator, transformMeta, transformModifier, transformModuleBody, transformModuleCompilationUnit, transformModuleDec, transformModuleDescriptor, transformModuleImport, transformMultiplyAssignmentOperation, transformNameWithTypeArguments, transformNamedArgument, transformNamedArguments, transformNegationOperation, transformNode, transformNonemptyCondition, transformNonemptyOperation, transformNotEqualOperation, transformNotOperation, transformObjectArgument, transformObjectDefinition, transformObjectExpression, transformOfOperation, transformOpenBound, transformOperation, transformOptionalType, transformOrAssignmentOperation, transformOrOperation, transformOutModifier, transformOuter, transformPackage, transformPackageCompilationUnit, transformPackageDec, transformPackageDescriptor, transformPackageQualifier, transformParameter, transformParameterReference, transformParameters, transformPattern, transformPatternList, transformPositionalArguments, transformPostfixDecrementOperation, transformPostfixIncrementOperation, transformPostfixOperation, transformPrefixDecrementOperation, transformPrefixIncrementOperation, transformPrefixOperation, transformPrefixPostfixStatement, transformPrimary, transformPrimaryType, transformProductOperation, transformQualifiedExpression, transformQualifiedType, transformQuotientOperation, transformRangeSubscript, transformRemainderAssignmentOperation, transformRemainderOperation, transformRequiredParameter, transformResource, transformResources, transformReturn, transformSafeMemberOperator, transformSatisfiedTypes, transformScaleOperation, transformSelfReference, transformSequentialType, transformSetAssignmentOperation, transformSetOperation, transformSimpleType, transformSmallAsOperation, transformSmallerOperation, transformSpanFromSubscript, transformSpanOperation, transformSpanSubscript, transformSpanToSubscript, transformSpecification, transformSpecifiedArgument, transformSpecifiedPattern, transformSpecifiedVariable, transformSpecifier, transformSpreadArgument, transformSpreadMemberOperator, transformSpreadType, transformStatement, transformStringLiteral, transformStringTemplate, transformSubscript, transformSubtractAssignmentOperation, transformSumOperation, transformSuper, transformSwitchCaseElse, transformSwitchCaseElseExpression, transformSwitchCases, transformSwitchClause, transformThenOperation, transformThis, transformThrow, transformTryCatchFinally, transformTryClause, transformTuple, transformTuplePattern, transformTupleType, transformType, transformTypeAliasDefinition, transformTypeArgument, transformTypeArguments, transformTypeConstraint, transformTypeDec, transformTypeDeclaration, transformTypeIsh, transformTypeList, transformTypeMeta, transformTypeModifier, transformTypeNameWithTypeArguments, transformTypeParameter, transformTypeParameters, transformTypeSpecifier, transformTypedDeclaration, transformTypedVariable, transformUIdentifier, transformUnaryArithmeticOperation, transformUnaryIshOperation, transformUnaryOperation, transformUnaryTypeOperation, transformUnionAssignmentOperation, transformUnionOperation, transformUnionType, transformUnionableType, transformUnspecifiedVariable, transformValueArgument, transformValueConstructorDefinition, transformValueDec, transformValueDeclaration, transformValueDefinition, transformValueExpression, transformValueGetterDefinition, transformValueModifier, transformValueParameter, transformValueSetterDefinition, transformValueSpecification, transformVariable, transformVariablePattern, transformVariadicParameter, transformVariadicType, transformVariadicVariable, transformVariance, transformVoidModifier, transformWhile, transformWithinOperation