Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 353 for Preorder (0.14 sec)

  1. src/go/ast/walk_test.go

    // license that can be found in the LICENSE file.
    
    package ast_test
    
    import (
    	"go/ast"
    	"go/parser"
    	"go/token"
    	"testing"
    )
    
    func TestPreorderBreak(t *testing.T) {
    	// This test checks that Preorder correctly handles a break statement while
    	// in the middle of walking a node. Previously, incorrect handling of the
    	// boolean returned by the yield function resulted in the iterator calling
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 16 16:34:10 UTC 2024
    - 916 bytes
    - Viewed (0)
  2. doc/next/6-stdlib/99-minor/go/ast/66339.md

    The new [Preorder] function returns a convenient iterator over all the
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 15 21:44:50 UTC 2024
    - 95 bytes
    - Viewed (0)
  3. src/cmd/vendor/golang.org/x/tools/go/ast/inspector/inspector.go

    // events. The function f is called only for nodes whose type
    // matches an element of the types slice.
    func (in *Inspector) Preorder(types []ast.Node, f func(ast.Node)) {
    	// Because it avoids postorder calls to f, and the pruning
    	// check, Preorder is almost twice as fast as Nodes. The two
    	// features seem to contribute similar slowdowns (~1.4x each).
    
    	mask := maskOf(types)
    	for i := 0; i < len(in.events); {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Jul 12 20:38:21 UTC 2023
    - 6.6K bytes
    - Viewed (0)
  4. src/go/ast/walk.go

    // call of f(nil).
    func Inspect(node Node, f func(Node) bool) {
    	Walk(inspector(f), node)
    }
    
    // Preorder returns an iterator over all the nodes of the syntax tree
    // beneath (and including) the specified root, in depth-first
    // preorder.
    //
    // For greater control over the traversal of each subtree, use [Inspect].
    func Preorder(root Node) iter.Seq[Node] {
    	return func(yield func(Node) bool) {
    		ok := true
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 16 16:34:10 UTC 2024
    - 6.4K bytes
    - Viewed (0)
  5. src/cmd/vendor/golang.org/x/tools/go/analysis/passes/appends/appends.go

    	Run:      run,
    }
    
    func run(pass *analysis.Pass) (interface{}, error) {
    	inspect := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector)
    
    	nodeFilter := []ast.Node{
    		(*ast.CallExpr)(nil),
    	}
    	inspect.Preorder(nodeFilter, func(n ast.Node) {
    		call := n.(*ast.CallExpr)
    		b, ok := typeutil.Callee(pass.TypesInfo, call).(*types.Builtin)
    		if ok && b.Name() == "append" && len(call.Args) == 1 {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 19 23:33:33 UTC 2023
    - 1.3K bytes
    - Viewed (0)
  6. src/cmd/vendor/golang.org/x/tools/go/analysis/passes/inspect/inspect.go

    //		...
    //		Requires:       []*analysis.Analyzer{inspect.Analyzer},
    //	}
    //
    //	func run(pass *analysis.Pass) (interface{}, error) {
    //		inspect := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector)
    //		inspect.Preorder(nil, func(n ast.Node) {
    //			...
    //		})
    //		return nil, nil
    //	}
    package inspect
    
    import (
    	"reflect"
    
    	"golang.org/x/tools/go/analysis"
    	"golang.org/x/tools/go/ast/inspector"
    )
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 09 01:28:01 UTC 2023
    - 1.4K bytes
    - Viewed (0)
  7. src/cmd/vendor/golang.org/x/tools/go/analysis/passes/shift/shift.go

    	nodeFilter := []ast.Node{
    		(*ast.IfStmt)(nil),
    		(*ast.SwitchStmt)(nil),
    	}
    	inspect.Preorder(nodeFilter, func(n ast.Node) {
    		// TODO(adonovan): move updateDead into this file.
    		updateDead(pass.TypesInfo, dead, n)
    	})
    
    	nodeFilter = []ast.Node{
    		(*ast.AssignStmt)(nil),
    		(*ast.BinaryExpr)(nil),
    	}
    	inspect.Preorder(nodeFilter, func(node ast.Node) {
    		if dead[node] {
    			// Skip shift checks on unreachable nodes.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 02:20:05 UTC 2024
    - 3.5K bytes
    - Viewed (0)
  8. src/cmd/vendor/golang.org/x/tools/go/analysis/passes/defers/defers.go

    			return false // prune
    		}
    		return true
    	}
    
    	inspect := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector)
    
    	nodeFilter := []ast.Node{
    		(*ast.DeferStmt)(nil),
    	}
    
    	inspect.Preorder(nodeFilter, func(n ast.Node) {
    		d := n.(*ast.DeferStmt)
    		ast.Inspect(d.Call, checkDeferCall)
    	})
    
    	return nil, nil
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 19 23:33:33 UTC 2023
    - 1.4K bytes
    - Viewed (0)
  9. analysis/analysis-api-impl-base/tests/org/jetbrains/kotlin/analysis/api/impl/base/test/cases/symbols/AbstractMultiModuleSymbolByPsiTest.kt

            testServices.assertions.assertEqualsToTestDataFileSibling(prettyPrinter.toString(), extension = ".pretty.txt")
        }
    
        /**
         * Processes the descendants of the element using the preorder implementation of tree traversal.
         */
        private inline fun <reified T : PsiElement> PsiElement.forEachDescendantOfType(
            noinline predicate: (T) -> Boolean = { true },
            noinline action: (T) -> Unit,
    Registered: Wed Jun 12 09:53:16 UTC 2024
    - Last Modified: Wed May 22 06:28:34 UTC 2024
    - 3.1K bytes
    - Viewed (0)
  10. src/cmd/vendor/golang.org/x/tools/go/analysis/passes/assign/assign.go

    	Run:      run,
    }
    
    func run(pass *analysis.Pass) (interface{}, error) {
    	inspect := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector)
    
    	nodeFilter := []ast.Node{
    		(*ast.AssignStmt)(nil),
    	}
    	inspect.Preorder(nodeFilter, func(n ast.Node) {
    		stmt := n.(*ast.AssignStmt)
    		if stmt.Tok != token.ASSIGN {
    			return // ignore :=
    		}
    		if len(stmt.Lhs) != len(stmt.Rhs) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 19 23:33:33 UTC 2023
    - 2.4K bytes
    - Viewed (0)
Back to top