Skip to content
This repository has been archived by the owner on Mar 8, 2020. It is now read-only.

Commit

Permalink
sdk: remove deprecated symbols
Browse files Browse the repository at this point in the history
Signed-off-by: Denys Smirnov <[email protected]>
  • Loading branch information
Denys Smirnov authored and dennwc committed Apr 12, 2019
1 parent b44cc02 commit 2228a84
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 79 deletions.
34 changes: 13 additions & 21 deletions assets/skeleton/bindata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions driver/fixtures/fixtures.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,6 @@ type SemanticConfig struct {
BlacklistTypes []string
}

// DockerConfig was used to run fixture tests locally using "go test".
//
// Deprecated: use "bblfsh-sdk test"
type DockerConfig struct {
Debug bool
Image string
}

func runsInDocker() bool {
_, err := os.Stat("/.dockerenv")
return err == nil
Expand All @@ -68,7 +60,6 @@ type Suite struct {
BenchName string // fixture name to benchmark (with no extension)

Semantic SemanticConfig
Docker DockerConfig

// VerifyTokens checks that token and positional info matches.
// Executed after the preprocessing stage (in annotated mode).
Expand Down
5 changes: 0 additions & 5 deletions driver/manifest/discovery/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,6 @@ func (arr byStatusAndName) Swap(i, j int) {
arr[i], arr[j] = arr[j], arr[i]
}

// Maintainer is an information about project maintainer.
//
// Deprecated: use manifest.Maintainer
type Maintainer = manifest.Maintainer

// RepositoryURL returns Github repository URL for browsers (not git).
func (d Driver) RepositoryURL() string {
return d.repo.GetHTMLURL()
Expand Down
16 changes: 0 additions & 16 deletions driver/transforms.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,6 @@ type Transforms struct {
// It also changes token key to uast.KeyToken. It should not be done in the
// Preprocess stage, because Semantic annotations are easier on clean native AST.
Annotations []transformer.Transformer

// Code stage is applied directly after annotations and provides a way
// to extract more information from source files, fix positional info, etc.
//
// TODO(dennwc): deprecate and examine drivers; documentation was incorrect
// it was described that the stage runs after Native, but it
// was always running after all annotation stages
//
// Deprecated: see PreprocessCode
Code []transformer.CodeTransformer
}

// Do applies AST transformation pipeline for specified AST subtree.
Expand Down Expand Up @@ -145,12 +135,6 @@ func (t Transforms) do(ctx context.Context, mode Mode, code string, nd nodes.Nod
}
}

// Run a code-assisted post-processing. Deprecated.
// There is no real reason to run it after all other stages except Preprocess.
if err := runAllCode("on-code", t.Code); err != nil {
return nd, err
}

// All native nodes should have a namespace in Semantic mode.
// Set if it was specified in the transform configuration.
if mode >= ModeSemantic && t.Namespace != "" {
Expand Down
10 changes: 0 additions & 10 deletions etc/skeleton/driver/normalizer/annotation.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package normalizer
import (
"github.com/bblfsh/sdk/v3/uast/role"
. "github.com/bblfsh/sdk/v3/uast/transformer"
"github.com/bblfsh/sdk/v3/uast/transformer/positioner"
)

// Native is the of list `transformer.Transformer` to apply to a native AST.
Expand All @@ -19,15 +18,6 @@ var Native = Transformers([][]Transformer{
},
}...)

// Code is a special block of transformations that are applied at the end
// and can access original source code file. It can be used to improve or
// fix positional information.
//
// https://godoc.org/github.com/bblfsh/sdk/v3/uast/transformer/positioner
var Code = []CodeTransformer{
positioner.FromOffset(),
}

// Annotations is a list of individual transformations to annotate a native AST with roles.
var Annotations = []Mapping{
AnnotateType("internal-type", nil, role.Incomplete),
Expand Down
5 changes: 4 additions & 1 deletion etc/skeleton/driver/normalizer/normalizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package normalizer

import (
. "github.com/bblfsh/sdk/v3/uast/transformer"
"github.com/bblfsh/sdk/v3/uast/transformer/positioner"
)

var Preprocess = Transformers([][]Transformer{
Expand Down Expand Up @@ -34,7 +35,9 @@ var Preprocessors = []Mapping{

// PreprocessCode is a preprocessor stage that can use the source code to
// fix tokens and positional information.
var PreprocessCode = []CodeTransformer{}
var PreprocessCode = []CodeTransformer{
positioner.FromOffset(),
}

// Normalizers is the main block of normalization rules to convert native AST to semantic UAST.
var Normalizers = []Mapping{}
1 change: 0 additions & 1 deletion etc/skeleton/driver/normalizer/transforms.go.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ var Transforms = driver.Transforms{
PreprocessCode: PreprocessCode,
Normalize: Normalize,
Annotations: Native,
Code: Code,
}
16 changes: 0 additions & 16 deletions uast/transformer/positioner/positions.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,11 @@ func FromLineCol() Positioner {
return Positioner{method: fromLineCol}
}

// NewFillOffsetFromLineCol fills the Offset field of all Position nodes by using
// their Line and Col.
//
// Deprecated: see FromLineCol
func NewFillOffsetFromLineCol() Positioner {
return FromLineCol()
}

// FromOffset fills the Line and Col fields of all Position nodes by using their Offset.
func FromOffset() Positioner {
return Positioner{method: fromOffset}
}

// NewFillLineColFromOffset fills the Line and Col fields of all Position nodes by using
// their Offset.
//
// Deprecated: see FromOffset
func NewFillLineColFromOffset() Positioner {
return FromOffset()
}

// FromUnicodeOffset fills the Line, Col and Offset fields of all Position nodes by
// interpreting their Offset as a 0-based Unicode character index.
func FromUnicodeOffset() Positioner {
Expand Down

0 comments on commit 2228a84

Please sign in to comment.