X7ROOT File Manager
Current Path:
/opt/golang/1.19.4/src/cmd/compile/internal/noder
opt
/
golang
/
1.19.4
/
src
/
cmd
/
compile
/
internal
/
noder
/
📁
..
📄
codes.go
(1.27 KB)
📄
decl.go
(10.83 KB)
📄
export.go
(800 B)
📄
expr.go
(14.16 KB)
📄
func.go
(1.9 KB)
📄
helpers.go
(5.96 KB)
📄
import.go
(10.31 KB)
📄
irgen.go
(11.3 KB)
📄
lex.go
(5.06 KB)
📄
lex_test.go
(3.64 KB)
📄
linker.go
(7.05 KB)
📄
noder.go
(13.33 KB)
📄
object.go
(5.56 KB)
📄
posmap.go
(2.02 KB)
📄
quirks.go
(1.8 KB)
📄
reader.go
(58.09 KB)
📄
scopes.go
(1.49 KB)
📄
sizes.go
(4.04 KB)
📄
stencil.go
(79.07 KB)
📄
stmt.go
(8.67 KB)
📄
transform.go
(28.22 KB)
📄
types.go
(16.72 KB)
📄
unified.go
(9.09 KB)
📄
validate.go
(3.09 KB)
📄
writer.go
(41.38 KB)
Editing: func.go
// Copyright 2021 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package noder import ( "cmd/compile/internal/base" "cmd/compile/internal/ir" "cmd/compile/internal/syntax" "cmd/compile/internal/typecheck" "cmd/compile/internal/types" "cmd/internal/src" ) func (g *irgen) funcBody(fn *ir.Func, recv *syntax.Field, sig *syntax.FuncType, block *syntax.BlockStmt) { typecheck.Func(fn) // TODO(mdempsky): Remove uses of ir.CurFunc and // typecheck.DeclContext after we stop relying on typecheck // for desugaring. outerfn, outerctxt := ir.CurFunc, typecheck.DeclContext ir.CurFunc = fn typ := fn.Type() if param := typ.Recv(); param != nil { g.defParam(param, recv, ir.PPARAM) } for i, param := range typ.Params().FieldSlice() { g.defParam(param, sig.ParamList[i], ir.PPARAM) } for i, result := range typ.Results().FieldSlice() { g.defParam(result, sig.ResultList[i], ir.PPARAMOUT) } // We may have type-checked a call to this function already and // calculated its size, including parameter offsets. Now that we've // created the parameter Names, force a recalculation to ensure // their offsets are correct. types.RecalcSize(typ) if block != nil { typecheck.DeclContext = ir.PAUTO fn.Body = g.stmts(block.List) if fn.Body == nil { fn.Body = []ir.Node{ir.NewBlockStmt(src.NoXPos, nil)} } fn.Endlineno = g.makeXPos(block.Rbrace) if base.Flag.Dwarf { g.recordScopes(fn, sig) } } ir.CurFunc, typecheck.DeclContext = outerfn, outerctxt } func (g *irgen) defParam(param *types.Field, decl *syntax.Field, class ir.Class) { typecheck.DeclContext = class var name *ir.Name if decl.Name != nil { name, _ = g.def(decl.Name) } else if class == ir.PPARAMOUT { name = g.obj(g.info.Implicits[decl]) } if name != nil { param.Nname = name param.Sym = name.Sym() // in case it was renamed } }
Upload File
Create Folder