blob: ff69ecc1dc2f03c636fb246f67c482d40f3d160d [file] [log] [blame]
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package state
// State represents the current state of the interpreter.
//
// State is passed as a thread-local value to each starlark module. Builtin functions and
// client code modify the state using the the "fxicfg" builtins, which are globally
// available to all starlark programs.
//
// All starlark code runs single-threaded so this object is not protected by mutexes.
type State struct {
// OutputFiles maps the path of a file to generate to its contents. Paths must be given
// relative to OutputDir.
OutputFiles map[string][]byte
// The output directory where files should be generated, relative to the main entrypoint
// starlark file.
OutputDir string
}
func NewState() *State {
return &State{
OutputFiles: make(map[string][]byte),
}
}