feat(scriptanalysis): M3.1 shared trust validator + compiler + compile surfaces + tests
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
namespace ZB.MOM.WW.ScadaBridge.ScriptAnalysis;
|
||||
|
||||
/// <summary>
|
||||
/// M3.1: a <b>compile-only</b> mirror of the SiteRuntime
|
||||
/// <c>TriggerExpressionGlobals</c> bind surface. A trigger expression is a bare
|
||||
/// boolean expression referencing <c>Attributes["x"]</c> / <c>Children["c"]</c>
|
||||
/// / <c>Parent</c>; the design-time deploy gate (M3.5) compiles candidate
|
||||
/// trigger expressions against this type to catch undefined symbols.
|
||||
///
|
||||
/// <para>
|
||||
/// Only the read-only bind surface is reproduced — the runtime
|
||||
/// <c>ExtractExpression</c> helper and the snapshot-backed constructor are
|
||||
/// intentionally omitted; they are runtime concerns, not part of what an
|
||||
/// expression binds against. Member bodies are compile-only and throw
|
||||
/// <see cref="NotSupportedException"/>.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public sealed class TriggerCompileSurface
|
||||
{
|
||||
private const string CompileOnly = "compile-only surface";
|
||||
|
||||
/// <summary>Mirrors <c>TriggerExpressionGlobals.Attributes</c>.</summary>
|
||||
public ReadOnlyAttributes Attributes => throw new NotSupportedException(CompileOnly);
|
||||
|
||||
/// <summary>Mirrors <c>TriggerExpressionGlobals.Children</c>.</summary>
|
||||
public ReadOnlyChildren Children => throw new NotSupportedException(CompileOnly);
|
||||
|
||||
/// <summary>Mirrors <c>TriggerExpressionGlobals.Parent</c>.</summary>
|
||||
public ReadOnlyComposition? Parent => throw new NotSupportedException(CompileOnly);
|
||||
|
||||
/// <summary>Compile-only mirror of <c>TriggerExpressionGlobals.ReadOnlyAttributes</c>.</summary>
|
||||
public sealed class ReadOnlyAttributes
|
||||
{
|
||||
/// <summary>Mirrors <c>ReadOnlyAttributes.this[string]</c>.</summary>
|
||||
public object? this[string key] => throw new NotSupportedException(CompileOnly);
|
||||
}
|
||||
|
||||
/// <summary>Compile-only mirror of <c>TriggerExpressionGlobals.ReadOnlyComposition</c>.</summary>
|
||||
public sealed class ReadOnlyComposition
|
||||
{
|
||||
/// <summary>Mirrors <c>ReadOnlyComposition.Attributes</c>.</summary>
|
||||
public ReadOnlyAttributes Attributes => throw new NotSupportedException(CompileOnly);
|
||||
}
|
||||
|
||||
/// <summary>Compile-only mirror of <c>TriggerExpressionGlobals.ReadOnlyChildren</c>.</summary>
|
||||
public sealed class ReadOnlyChildren
|
||||
{
|
||||
/// <summary>Mirrors <c>ReadOnlyChildren.this[string]</c>.</summary>
|
||||
public ReadOnlyComposition this[string compositionName] => throw new NotSupportedException(CompileOnly);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user