Skip to content

API Host SourceSpan

Liu.Yandong.Hanks edited this page Aug 19, 2026 · 3 revisions

SourceSpan

诊断信息使用的源代码位置范围。

Source location range used by diagnostics.

命名空间:AuroraScript.Compiler。类型:struct。

Namespace: AuroraScript.Compiler. Kind: struct.

返回 .NET Host API 参考

用途

SourceSpan 是公开宿主类型。通过下方签名选择调用方式;对运行时对象、生命周期和异常,应由宿主在边界处明确处理。

Source location range used by diagnostics.

简单示例

下面是 SourceSpan 的最小使用方式。

A minimal use of SourceSpan.

var span = new SourceSpan
{
    FileName = "main.as",
    StartLine = 1,
    StartColumn = 1,
    EndLine = 1,
    EndColumn = 10
};

Console.WriteLine(span);

成员

static readonly SourceSpan None

读取 None 字段。

Use the member according to its public signature.

Parameters:

  • 无。

    None.

Returns

返回 SourceSpan

Returns SourceSpan.

调用示意

以下示例展示调用形状;将占位实例和参数替换为宿主中的实际值。

The example shows the call shape; replace placeholder instances and arguments with actual host values.

var current = SourceSpan.None;

int StartLine

读取 StartLine 属性。

Use the member according to its public signature.

Parameters:

  • 无。

    None.

Returns

返回 int

Returns int.

调用示意

以下示例展示调用形状;将占位实例和参数替换为宿主中的实际值。

The example shows the call shape; replace placeholder instances and arguments with actual host values.

SourceSpan value = /* 从宿主 API 获取实例 */;
var current = value.StartLine;

int StartColumn

读取 StartColumn 属性。

Use the member according to its public signature.

Parameters:

  • 无。

    None.

Returns

返回 int

Returns int.

调用示意

以下示例展示调用形状;将占位实例和参数替换为宿主中的实际值。

The example shows the call shape; replace placeholder instances and arguments with actual host values.

SourceSpan value = /* 从宿主 API 获取实例 */;
var current = value.StartColumn;

int EndLine

读取 EndLine 属性。

Use the member according to its public signature.

Parameters:

  • 无。

    None.

Returns

返回 int

Returns int.

调用示意

以下示例展示调用形状;将占位实例和参数替换为宿主中的实际值。

The example shows the call shape; replace placeholder instances and arguments with actual host values.

SourceSpan value = /* 从宿主 API 获取实例 */;
var current = value.EndLine;

int EndColumn

读取 EndColumn 属性。

Use the member according to its public signature.

Parameters:

  • 无。

    None.

Returns

返回 int

Returns int.

调用示意

以下示例展示调用形状;将占位实例和参数替换为宿主中的实际值。

The example shows the call shape; replace placeholder instances and arguments with actual host values.

SourceSpan value = /* 从宿主 API 获取实例 */;
var current = value.EndColumn;

int Offset

读取 Offset 属性。

Use the member according to its public signature.

Parameters:

  • 无。

    None.

Returns

返回 int

Returns int.

调用示意

以下示例展示调用形状;将占位实例和参数替换为宿主中的实际值。

The example shows the call shape; replace placeholder instances and arguments with actual host values.

SourceSpan value = /* 从宿主 API 获取实例 */;
var current = value.Offset;

int Length

读取 Length 属性。

Use the member according to its public signature.

Parameters:

  • 无。

    None.

Returns

返回 int

Returns int.

调用示意

以下示例展示调用形状;将占位实例和参数替换为宿主中的实际值。

The example shows the call shape; replace placeholder instances and arguments with actual host values.

SourceSpan value = /* 从宿主 API 获取实例 */;
var current = value.Length;

string FileName

读取 FileName 属性。

Use the member according to its public signature.

Parameters:

  • 无。

    None.

Returns

返回 string

Returns string.

调用示意

以下示例展示调用形状;将占位实例和参数替换为宿主中的实际值。

The example shows the call shape; replace placeholder instances and arguments with actual host values.

SourceSpan value = /* 从宿主 API 获取实例 */;
var current = value.FileName;

string ToString()

调用 ToString 完成其公开操作。

Use the member according to its public signature.

Parameters:

  • 无。

    None.

Returns

返回 string

Returns string.

调用示意

以下示例展示调用形状;将占位实例和参数替换为宿主中的实际值。

The example shows the call shape; replace placeholder instances and arguments with actual host values.

SourceSpan value = /* 从宿主 API 获取实例 */;
var result = value.ToString();

Clone this wiki locally