Black Lives Matter. Support the Equal Justice Initiative.

Source file src/go/internal/typeparams/notypeparams.go

Documentation: go/internal/typeparams

     1  // Copyright 2021 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  //go:build !typeparams
     6  // +build !typeparams
     7  
     8  package typeparams
     9  
    10  import (
    11  	"go/ast"
    12  )
    13  
    14  const Enabled = false
    15  
    16  func PackExpr(list []ast.Expr) ast.Expr {
    17  	switch len(list) {
    18  	case 1:
    19  		return list[0]
    20  	default:
    21  		// The parser should not attempt to pack multiple expressions into an
    22  		// IndexExpr if type params are disabled.
    23  		panic("multiple index expressions are unsupported without type params")
    24  	}
    25  }
    26  
    27  func UnpackExpr(expr ast.Expr) []ast.Expr {
    28  	return []ast.Expr{expr}
    29  }
    30  
    31  func IsListExpr(n ast.Node) bool {
    32  	return false
    33  }
    34  
    35  func Get(ast.Node) *ast.FieldList {
    36  	return nil
    37  }
    38  
    39  func Set(node ast.Node, params *ast.FieldList) {
    40  }
    41  

View as plain text