Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement defconst #419

Merged
merged 12 commits into from
Dec 9, 2024
644 changes: 530 additions & 114 deletions pkg/corset/ast.go

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions pkg/corset/binding.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ type Binding interface {
IsFinalised() bool
}

// ============================================================================
// ColumnBinding
// ============================================================================

// ColumnBinding represents something bound to a given column.
type ColumnBinding struct {
// Column's allocated identifier
Expand Down Expand Up @@ -72,12 +76,41 @@ func (p *ColumnBinding) ColumnId() uint {
return p.cid
}

// ============================================================================
// ConstantBinding
// ============================================================================

// ConstantBinding represents a constant definition
type ConstantBinding struct {
// Constant expression which, when evaluated, produces a constant value.
value Expr
}

// IsFinalised checks whether this binding has been finalised yet or not.
func (p *ConstantBinding) IsFinalised() bool {
return true
}

// Context returns the of this constant, noting that constants (by definition)
// do not have a context.
func (p *ConstantBinding) Context() Context {
return tr.VoidContext[string]()
}

// ============================================================================
// ParameterBinding
// ============================================================================

// ParameterBinding represents something bound to a given column.
type ParameterBinding struct {
// Identifies the variable or column index (as appropriate).
index uint
}

// ============================================================================
// FunctionBinding
// ============================================================================

// IsFinalised checks whether this binding has been finalised yet or not.
func (p *ParameterBinding) IsFinalised() bool {
panic("")
Expand Down
Loading
Loading