Commit 89dc1405 authored by Etienne Renault's avatar Etienne Renault

debug: add transformation to ease debuging

* main.go, transform/debug.go: Here.
parent 911fd354
......@@ -133,6 +133,7 @@ func compileTo(path string, src []byte, file *os.File,
}
res = transform.ApplyAll(f, meta, []transform.Transform{
// &transform.Debug{}, // only for debuging a special transformation
&transform.Alive{},
&transform.Channel{
Goroutines: goroutines,
......
// Copyright (C) 2020 Laboratoire de Recherche et Developpement
// de l'EPITA (LRDE).
//
// This file is part of Go2Pins, a tool for Golang model-checking
//
// Go2Pins is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// Go2Pins is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
// License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package transform
import (
"go/printer"
"go/token"
"os"
)
/*
The Debug's purpose is to display the current state of transformation.
*/
type Debug struct {
}
//Pre traversal applies the transformation.
func (t *Debug) Pre(meta *Meta, v *Visitor) bool {
c := v.Cursor()
fset := token.NewFileSet()
printer.Fprint(os.Stdout, fset, c.Node())
return false
}
// Post traversal applies the transformation.
func (t *Debug) Post(meta *Meta, v *Visitor) bool {
return true
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment