Problem

abstract class Problem(    val moduleName: ModuleName?,     val lineNumber: Int,     val characterInFile: Long,     val type: ProblemType,     messagePattern: String,     arguments: Any)

A Problem is produced when encountering an unexpected or less than ideal situation during compilation. Within an interactive system, the problem is presumably presented to the user in some manner, whereas in batch usage multiple problems may simply be collected and later presented in aggregate.

Subclasses (typically anonymous) may override continueCompilation and abortCompilation to specify how a particular problem site can continue or abort compilation, respectively. It is the responsibility of any client problem handler to decide whether to continue compiling or abort. By default, continueCompilation() simply invokes abortCompilation().

Author

Mark van Gulik

Parameters

moduleName

The name of the module in which the problem was encountered, or null if no module is in context.

lineNumber

The one-based line number on which the problem occurred, or zero if there is no suitable line to blame.

characterInFile

The zero-based code point position in the file. Surrogate pairs are treated as a single code point.

type

The ProblemType that classifies this problem.

messagePattern

A String complying with the MessageFormat pattern specification.

arguments

The arguments with which to parameterize the messagePattern.

Constructors

Link copied to clipboard
fun Problem(    moduleName: ModuleName?,     lineNumber: Int,     characterInFile: Long,     type: ProblemType,     messagePattern: String,     vararg arguments: Any)

Construct a new Problem.

Functions

Link copied to clipboard
abstract fun abortCompilation()

Give up compilation. Note that either continueCompilation or this method must be invoked by code handling Problems.

Link copied to clipboard
open fun continueCompilation()

Attempt to continue compiling past this problem. If continuing to compile is inappropriate or impossible for the receiver, then as a convenience, this method simply calls abortCompilation.

Link copied to clipboard
open override fun toString(): String

Properties

Link copied to clipboard
val characterInFile: Long

The approximate location of the problem within the source file as a zero-based subscript of the full-Unicode code points of the file. Surrogate pairs are treated as a single code point. It is strongly recommended that Avail source files are always encoded in the UTF-8 character set. The current compiler as of 2014.01.26 requires source files to be in UTF-8 encoding.

Link copied to clipboard
val lineNumber: Int

The one-based line number within the file in which the problem occurred. This may be approximate. If the problem involves the entire file (file not found, no read access, etc.), a line number of 0 can indicate this.

Link copied to clipboard
val moduleName: ModuleName?

The unresolved, canonical name of the module in which the problem occurred.

Link copied to clipboard
val type: ProblemType

The type of problem that was encountered.