pulumi/pkg/compiler/symbols.go
joeduffy 9c0c6e6916 Add rudimentary type binding
This change adds rudimentary type binding to phase 2 of the binder.  Note that
we still don't have the notion of predefined types (for the primitives), so this
basically rejects any well-formed Mufile.  Primitives are on deck.
2016-11-16 18:55:20 -08:00

32 lines
847 B
Go

// Copyright 2016 Marapongo, Inc. All rights reserved.
package compiler
import (
"github.com/marapongo/mu/pkg/ast"
)
// Symbol is a named entity that can be referenced and bound to.
type Symbol struct {
Kind SymbolKind // the kind of symbol.
Name ast.Name // the symbol's unique name.
Node *ast.Node // the Node part of the payload data structure.
Real interface{} // the real part of the payload (i.e., the whole structure).
}
// SymbolKind indicates the kind of symbol being registered (e.g., Stack, Service, etc).
type SymbolKind int
const (
SymKindStack SymbolKind = iota
SymKindService
)
func NewStackSymbol(nm ast.Name, stack *ast.Stack) *Symbol {
return &Symbol{SymKindStack, nm, &stack.Node, stack}
}
func NewServiceSymbol(nm ast.Name, svc *ast.Service) *Symbol {
return &Symbol{SymKindService, nm, &svc.Node, svc}
}