Linux vmi284606.contaboserver.net 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64
Apache/2.4.57 (Ubuntu)
: 167.86.127.34 | : 216.73.217.31
Cant Read [ /etc/named.conf ]
7.2.24-0ubuntu0.18.04.17
root
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
README
+ Create Folder
+ Create File
/
usr /
local /
go /
src /
go /
types /
[ HOME SHELL ]
Name
Size
Permission
Action
testdata
[ DIR ]
drwxr-xr-x
api.go
13.6
KB
-rw-r--r--
api_test.go
41.52
KB
-rw-r--r--
assignments.go
8.58
KB
-rw-r--r--
builtins.go
17.25
KB
-rw-r--r--
builtins_test.go
7.54
KB
-rw-r--r--
call.go
13.86
KB
-rw-r--r--
check.go
12.43
KB
-rw-r--r--
check_test.go
8.65
KB
-rw-r--r--
conversions.go
4.86
KB
-rw-r--r--
decl.go
22.25
KB
-rw-r--r--
errors.go
3.14
KB
-rw-r--r--
eval.go
2.92
KB
-rw-r--r--
eval_test.go
7.12
KB
-rw-r--r--
example_test.go
8.77
KB
-rw-r--r--
expr.go
44.32
KB
-rw-r--r--
exprstring.go
4.54
KB
-rw-r--r--
exprstring_test.go
1.76
KB
-rw-r--r--
gccgosizes.go
1016
B
-rw-r--r--
gotype.go
8.4
KB
-rw-r--r--
hilbert_test.go
3.63
KB
-rw-r--r--
initorder.go
8.84
KB
-rw-r--r--
issues_test.go
12.86
KB
-rw-r--r--
labels.go
7.01
KB
-rw-r--r--
lookup.go
13.05
KB
-rw-r--r--
methodset.go
8.38
KB
-rw-r--r--
object.go
14.69
KB
-rw-r--r--
object_test.go
2.82
KB
-rw-r--r--
objset.go
927
B
-rw-r--r--
operand.go
7.46
KB
-rw-r--r--
package.go
2.19
KB
-rw-r--r--
predicates.go
9.01
KB
-rw-r--r--
resolver.go
20.76
KB
-rw-r--r--
resolver_test.go
4.58
KB
-rw-r--r--
return.go
4.23
KB
-rw-r--r--
scope.go
5.48
KB
-rw-r--r--
selection.go
3.99
KB
-rw-r--r--
self_test.go
2.2
KB
-rw-r--r--
sizes.go
6.61
KB
-rw-r--r--
sizes_test.go
2.46
KB
-rw-r--r--
stdlib_test.go
8.32
KB
-rw-r--r--
stmt.go
22.8
KB
-rw-r--r--
token_test.go
1.21
KB
-rw-r--r--
type.go
16.81
KB
-rw-r--r--
typestring.go
7.8
KB
-rw-r--r--
typestring_test.go
6.56
KB
-rw-r--r--
typexpr.go
20.6
KB
-rw-r--r--
universe.go
6.47
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : labels.go
// Copyright 2013 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 types import ( "go/ast" "go/token" ) // labels checks correct label use in body. func (check *Checker) labels(body *ast.BlockStmt) { // set of all labels in this body all := NewScope(nil, body.Pos(), body.End(), "label") fwdJumps := check.blockBranches(all, nil, nil, body.List) // If there are any forward jumps left, no label was found for // the corresponding goto statements. Either those labels were // never defined, or they are inside blocks and not reachable // for the respective gotos. for _, jmp := range fwdJumps { var msg string name := jmp.Label.Name if alt := all.Lookup(name); alt != nil { msg = "goto %s jumps into block" alt.(*Label).used = true // avoid another error } else { msg = "label %s not declared" } check.errorf(jmp.Label.Pos(), msg, name) } // spec: "It is illegal to define a label that is never used." for _, obj := range all.elems { if lbl := obj.(*Label); !lbl.used { check.softErrorf(lbl.pos, "label %s declared but not used", lbl.name) } } } // A block tracks label declarations in a block and its enclosing blocks. type block struct { parent *block // enclosing block lstmt *ast.LabeledStmt // labeled statement to which this block belongs, or nil labels map[string]*ast.LabeledStmt // allocated lazily } // insert records a new label declaration for the current block. // The label must not have been declared before in any block. func (b *block) insert(s *ast.LabeledStmt) { name := s.Label.Name if debug { assert(b.gotoTarget(name) == nil) } labels := b.labels if labels == nil { labels = make(map[string]*ast.LabeledStmt) b.labels = labels } labels[name] = s } // gotoTarget returns the labeled statement in the current // or an enclosing block with the given label name, or nil. func (b *block) gotoTarget(name string) *ast.LabeledStmt { for s := b; s != nil; s = s.parent { if t := s.labels[name]; t != nil { return t } } return nil } // enclosingTarget returns the innermost enclosing labeled // statement with the given label name, or nil. func (b *block) enclosingTarget(name string) *ast.LabeledStmt { for s := b; s != nil; s = s.parent { if t := s.lstmt; t != nil && t.Label.Name == name { return t } } return nil } // blockBranches processes a block's statement list and returns the set of outgoing forward jumps. // all is the scope of all declared labels, parent the set of labels declared in the immediately // enclosing block, and lstmt is the labeled statement this block is associated with (or nil). func (check *Checker) blockBranches(all *Scope, parent *block, lstmt *ast.LabeledStmt, list []ast.Stmt) []*ast.BranchStmt { b := &block{parent: parent, lstmt: lstmt} var ( varDeclPos token.Pos fwdJumps, badJumps []*ast.BranchStmt ) // All forward jumps jumping over a variable declaration are possibly // invalid (they may still jump out of the block and be ok). // recordVarDecl records them for the given position. recordVarDecl := func(pos token.Pos) { varDeclPos = pos badJumps = append(badJumps[:0], fwdJumps...) // copy fwdJumps to badJumps } jumpsOverVarDecl := func(jmp *ast.BranchStmt) bool { if varDeclPos.IsValid() { for _, bad := range badJumps { if jmp == bad { return true } } } return false } blockBranches := func(lstmt *ast.LabeledStmt, list []ast.Stmt) { // Unresolved forward jumps inside the nested block // become forward jumps in the current block. fwdJumps = append(fwdJumps, check.blockBranches(all, b, lstmt, list)...) } var stmtBranches func(ast.Stmt) stmtBranches = func(s ast.Stmt) { switch s := s.(type) { case *ast.DeclStmt: if d, _ := s.Decl.(*ast.GenDecl); d != nil && d.Tok == token.VAR { recordVarDecl(d.Pos()) } case *ast.LabeledStmt: // declare non-blank label if name := s.Label.Name; name != "_" { lbl := NewLabel(s.Label.Pos(), check.pkg, name) if alt := all.Insert(lbl); alt != nil { check.softErrorf(lbl.pos, "label %s already declared", name) check.reportAltDecl(alt) // ok to continue } else { b.insert(s) check.recordDef(s.Label, lbl) } // resolve matching forward jumps and remove them from fwdJumps i := 0 for _, jmp := range fwdJumps { if jmp.Label.Name == name { // match lbl.used = true check.recordUse(jmp.Label, lbl) if jumpsOverVarDecl(jmp) { check.softErrorf( jmp.Label.Pos(), "goto %s jumps over variable declaration at line %d", name, check.fset.Position(varDeclPos).Line, ) // ok to continue } } else { // no match - record new forward jump fwdJumps[i] = jmp i++ } } fwdJumps = fwdJumps[:i] lstmt = s } stmtBranches(s.Stmt) case *ast.BranchStmt: if s.Label == nil { return // checked in 1st pass (check.stmt) } // determine and validate target name := s.Label.Name switch s.Tok { case token.BREAK: // spec: "If there is a label, it must be that of an enclosing // "for", "switch", or "select" statement, and that is the one // whose execution terminates." valid := false if t := b.enclosingTarget(name); t != nil { switch t.Stmt.(type) { case *ast.SwitchStmt, *ast.TypeSwitchStmt, *ast.SelectStmt, *ast.ForStmt, *ast.RangeStmt: valid = true } } if !valid { check.errorf(s.Label.Pos(), "invalid break label %s", name) return } case token.CONTINUE: // spec: "If there is a label, it must be that of an enclosing // "for" statement, and that is the one whose execution advances." valid := false if t := b.enclosingTarget(name); t != nil { switch t.Stmt.(type) { case *ast.ForStmt, *ast.RangeStmt: valid = true } } if !valid { check.errorf(s.Label.Pos(), "invalid continue label %s", name) return } case token.GOTO: if b.gotoTarget(name) == nil { // label may be declared later - add branch to forward jumps fwdJumps = append(fwdJumps, s) return } default: check.invalidAST(s.Pos(), "branch statement: %s %s", s.Tok, name) return } // record label use obj := all.Lookup(name) obj.(*Label).used = true check.recordUse(s.Label, obj) case *ast.AssignStmt: if s.Tok == token.DEFINE { recordVarDecl(s.Pos()) } case *ast.BlockStmt: blockBranches(lstmt, s.List) case *ast.IfStmt: stmtBranches(s.Body) if s.Else != nil { stmtBranches(s.Else) } case *ast.CaseClause: blockBranches(nil, s.Body) case *ast.SwitchStmt: stmtBranches(s.Body) case *ast.TypeSwitchStmt: stmtBranches(s.Body) case *ast.CommClause: blockBranches(nil, s.Body) case *ast.SelectStmt: stmtBranches(s.Body) case *ast.ForStmt: stmtBranches(s.Body) case *ast.RangeStmt: stmtBranches(s.Body) } } for _, s := range list { stmtBranches(s) } return fwdJumps }
Close