Rewrites

dotty.tools.dotc.rewrites.Rewrites
See theRewrites companion class
object Rewrites

Handles rewriting of Scala2 files to Dotty

Attributes

Companion
class
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Rewrites.type

Members list

Type members

Classlikes

case class ActionPatch(srcPos: SourcePosition, replacement: String)

A special type of Patch that instead of just a span, contains the full SourcePosition. This is useful when being used by dotty.tools.dotc.reporting.CodeAction or if the patch doesn't belong to the same file that the actual issue it's addressing is in.

A special type of Patch that instead of just a span, contains the full SourcePosition. This is useful when being used by dotty.tools.dotc.reporting.CodeAction or if the patch doesn't belong to the same file that the actual issue it's addressing is in.

Value parameters

replacement

The Replacement that should go in that position.

srcPos

The SourcePosition of the patch.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Value members

Concrete methods

def applyAction(action: CodeAction)(using Context): Unit

Given a CodeAction take the patches and apply them.

Given a CodeAction take the patches and apply them.

Value parameters

action

The CodeAction containing the patches

Attributes

def overlapsPatch(source: SourceFile, span: Span)(using Context): Boolean

Does span overlap with a patch region of source?

Does span overlap with a patch region of source?

Attributes

def patch(source: SourceFile, span: Span, replacement: String)(using Context): Unit

If -rewrite is set, record a patch that replaces the range given by span in source by replacement

If -rewrite is set, record a patch that replaces the range given by span in source by replacement

Attributes

def patch(span: Span, replacement: String)(using Context): Unit

Patch position in ctx.compilationUnit.source.

Patch position in ctx.compilationUnit.source.

Attributes

def writeBack()(using Context): Unit

If -rewrite is set, apply all patches and overwrite patched source files.

If -rewrite is set, apply all patches and overwrite patched source files.

Attributes