Skip to content

Commit

Permalink
save
Browse files Browse the repository at this point in the history
  • Loading branch information
zivkovicmilos committed Oct 25, 2023
1 parent c3ffe95 commit bae0003
Show file tree
Hide file tree
Showing 13 changed files with 14 additions and 134 deletions.
12 changes: 0 additions & 12 deletions gnovm/pkg/gnolang/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,18 +440,6 @@ var (
precs = [][]string{prec1, prec2, prec3, prec4, prec5}
)

// 0 for prec1... -1 if no match.
func lowestMatch(op string) int {
for i, prec := range precs {
for _, op2 := range prec {
if op == op2 {
return i
}
}
}
return -1
}

func Ss(b ...Stmt) []Stmt {
return b
}
Expand Down
24 changes: 0 additions & 24 deletions gnovm/pkg/gnolang/preprocess.go
Original file line number Diff line number Diff line change
Expand Up @@ -3338,23 +3338,6 @@ func elideCompositeExpr(vx *Expr, vt Type) {
}
}

// returns true of x is exactly `nil`.
func isNilExpr(x Expr) bool {
if nx, ok := x.(*NameExpr); ok {
return nx.Name == nilStr
}
return false
}

func isNilComparableKind(k Kind) bool {
switch k {
case SliceKind, MapKind, FuncKind:
return true
default:
return false
}
}

// returns number of args, or if arg is a call result,
// the number of results of the return tuple type.
func countNumArgs(store Store, last BlockNode, n *CallExpr) (numArgs int) {
Expand All @@ -3374,13 +3357,6 @@ func countNumArgs(store Store, last BlockNode, n *CallExpr) (numArgs int) {
}
}

func mergeNames(a, b []Name) []Name {
c := make([]Name, len(a)+len(b))
copy(c, a)
copy(c[len(a):], b)
return c
}

// This is to be run *after* preprocessing is done,
// to determine the order of var decl execution
// (which may include functions which may refer to package vars).
Expand Down
18 changes: 0 additions & 18 deletions gnovm/pkg/gnolang/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,21 +192,3 @@ func (ss *scanner) advanceEscapeSequence() bool {
return ss.done()
}
}

// pops the next monoid term.
// The result is a string enclosed in balanced parentheses,
// brackets, or quotes; or what comes before such things.
// scanner doesn't understand operators, so a polynomial
// expression could be a single monoid as far as this scanner
// is concerned. TODO Chop functions should maybe use this.
func (ss *scanner) popMonoid() string {
startOut := ss.out()
start := ss.idx
for !ss.advance() {
if ss.out() != startOut {
end := ss.idx
return string(ss.rnz[start:end])
}
}
panic("no monoid")
}
8 changes: 3 additions & 5 deletions gnovm/pkg/gnolang/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import (
"github.com/gnolang/gno/tm2/pkg/store"
)

const iavlCacheSize = 1024 * 1024 // TODO increase and parameterize.

// return nil if package doesn't exist.
type PackageGetter func(pkgPath string) (*PackageNode, *PackageValue)

Expand Down Expand Up @@ -626,7 +624,7 @@ func (ds *defaultStore) Flush() {
// XXX
}

//----------------------------------------
// ----------------------------------------
// StoreOp

type StoreOpType uint8
Expand Down Expand Up @@ -723,7 +721,7 @@ func (ds *defaultStore) Print() {
}
}

//----------------------------------------
// ----------------------------------------
// backend keys

func backendObjectKey(oid ObjectID) string {
Expand Down Expand Up @@ -755,7 +753,7 @@ func backendPackagePathKey(path string) string {
return fmt.Sprintf("pkg:" + path)
}

//----------------------------------------
// ----------------------------------------
// builtin types and packages

func InitStoreCaches(store Store) {
Expand Down
1 change: 0 additions & 1 deletion gnovm/pkg/gnolang/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,6 @@ type InterfaceType struct {
}

// General empty interface.
var gEmptyInterfaceType *InterfaceType = &InterfaceType{}

func (it *InterfaceType) IsEmptyInterface() bool {
return len(it.Methods) == 0
Expand Down
10 changes: 0 additions & 10 deletions gnovm/stdlibs/stdlibs.go
Original file line number Diff line number Diff line change
Expand Up @@ -581,13 +581,3 @@ func typedByteArray(ln int, bz *gno.ArrayValue) gno.TypedValue {
tv := gno.TypedValue{T: &gno.ArrayType{Len: ln, Elt: gno.Uint8Type}, V: bz}
return tv
}

func typedByteSlice(bz *gno.SliceValue) gno.TypedValue {
tv := gno.TypedValue{T: &gno.SliceType{Elt: gno.Uint8Type}, V: bz}
return tv
}

func typedNil(t gno.Type) gno.TypedValue {
tv := gno.TypedValue{T: t, V: nil}
return tv
}
12 changes: 4 additions & 8 deletions misc/logos/buffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/gdamore/tcell/v2"
)

//----------------------------------------
// ----------------------------------------
// Buffer

// A Buffer is a buffer area in which to draw.
Expand Down Expand Up @@ -82,7 +82,7 @@ func (bb *Buffer) DrawToScreen(s tcell.Screen) {
}
}

//----------------------------------------
// ----------------------------------------
// Cell

// A terminal character cell.
Expand Down Expand Up @@ -131,10 +131,6 @@ var gDefaultSpaceTStyle = tcell.StyleDefault.
Dim(true).
Background(tcell.ColorGray)

var gDefaultTStyle = gDefaultStyle.GetTStyle().
Foreground(gDefaultForeground).
Background(gDefaultBackground)

// This is where a bit of dynamic logic is performed,
// namely where the attr is used to derive the final style.
func (cc *Cell) GetTCellContent() (mainc rune, combc []rune, tstyle tcell.Style) {
Expand All @@ -161,7 +157,7 @@ func (cc *Cell) GetTCellContent() (mainc rune, combc []rune, tstyle tcell.Style)
return
}

//----------------------------------------
// ----------------------------------------
// View
// analogy: "Buffer:View :: array:slice".

Expand Down Expand Up @@ -205,7 +201,7 @@ func (bs View) GetCell(x, y int) *Cell {
)
}

//----------------------------------------
// ----------------------------------------
// BufferedView

// A view onto an element.
Expand Down
5 changes: 0 additions & 5 deletions misc/logos/cmd/logos.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ import (
"github.com/gnolang/gno/misc/logos"
)

var (
row = 0
style = tcell.StyleDefault
)

func main() {
encoding.Register()

Expand Down
26 changes: 0 additions & 26 deletions misc/logos/debug.go

This file was deleted.

14 changes: 6 additions & 8 deletions misc/logos/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/gdamore/tcell/v2"
)

//----------------------------------------
// ----------------------------------------
// Page

// A Page has renderable Elem(ents).
Expand Down Expand Up @@ -389,7 +389,7 @@ func (pg *Page) DecCursor(isVertical bool) {
}
}

//----------------------------------------
// ----------------------------------------
// TextElem

type TextElem struct {
Expand Down Expand Up @@ -474,8 +474,6 @@ func (tel *TextElem) Render() (updated bool) {
return true
}

var ctr = 0

func (tel *TextElem) Draw(offset Coord, view View) {
minX, maxX, minY, maxY := computeIntersection(tel.Size, offset, view.Bounds)
for y := minY; y < maxY; y++ {
Expand All @@ -494,7 +492,7 @@ func (tel *TextElem) ProcessEventKey(ev *EventKey) bool {
return false // TODO: clipboard.
}

//----------------------------------------
// ----------------------------------------
// misc.

type Color = tcell.Color
Expand Down Expand Up @@ -728,7 +726,7 @@ func (tt *Attrs) Merge(ot *Attrs) {
tt.Other = ot.Other // TODO merge by key.
}

//----------------------------------------
// ----------------------------------------
// AttrFlags

// NOTE: AttrFlags are merged with a simple or-assign op.
Expand All @@ -752,7 +750,7 @@ type KVPair struct {
Value interface{}
}

//----------------------------------------
// ----------------------------------------
// computeIntersection()

// els: element size
Expand Down Expand Up @@ -812,7 +810,7 @@ func computeIntersection(els Size, elo Coord, vws Size) (minX, maxX, minY, maxY
return
}

//----------------------------------------
// ----------------------------------------
// Misc simple types

type Padding struct {
Expand Down
11 changes: 1 addition & 10 deletions misc/logos/unicode.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ func isCombining(r rune) bool {
return inTable(r, combining)
}

//----------------------------------------
// ----------------------------------------
// from https://github.com/mattn/go-runewidth
// runewidth doesn't expose whether a character is combining or not.
// TODO might as well fork both runewidth and tcell.
Expand Down Expand Up @@ -62,15 +62,6 @@ type interval struct {

type table []interval

func inTables(r rune, ts ...table) bool {
for _, t := range ts {
if inTable(r, t) {
return true
}
}
return false
}

func inTable(r rune, t table) bool {
if r < t[0].first {
return false
Expand Down
1 change: 0 additions & 1 deletion tm2/pkg/bft/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,6 @@ func (n *Node) ConfigureRPC() {
rpccore.SetPubKey(pubKey)
rpccore.SetGenesisDoc(n.genesisDoc)
rpccore.SetProxyAppQuery(n.proxyApp.Query())
rpccore.SetTxEventStore(n.txEventStore)
rpccore.SetConsensusReactor(n.consensusReactor)
rpccore.SetLogger(n.Logger.With("module", "rpc"))
rpccore.SetEventSwitch(n.evsw)
Expand Down
6 changes: 0 additions & 6 deletions tm2/pkg/bft/rpc/core/pipe.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"github.com/gnolang/gno/tm2/pkg/bft/proxy"
cfg "github.com/gnolang/gno/tm2/pkg/bft/rpc/config"
sm "github.com/gnolang/gno/tm2/pkg/bft/state"
"github.com/gnolang/gno/tm2/pkg/bft/state/eventstore"
"github.com/gnolang/gno/tm2/pkg/bft/types"
"github.com/gnolang/gno/tm2/pkg/crypto"
dbm "github.com/gnolang/gno/tm2/pkg/db"
Expand Down Expand Up @@ -68,7 +67,6 @@ var (
// objects
pubKey crypto.PubKey
genDoc *types.GenesisDoc // cache the genesis structure
txEventStore eventstore.TxEventStore
consensusReactor *consensus.ConsensusReactor
evsw events.EventSwitch
gTxDispatcher *txDispatcher
Expand Down Expand Up @@ -115,10 +113,6 @@ func SetProxyAppQuery(appConn proxy.AppConnQuery) {
proxyAppQuery = appConn
}

func SetTxEventStore(indexer eventstore.TxEventStore) {
txEventStore = indexer
}

func SetConsensusReactor(conR *consensus.ConsensusReactor) {
consensusReactor = conR
}
Expand Down

0 comments on commit bae0003

Please sign in to comment.