MCPcopy Index your code
hub / github.com/Shopify/go-lua / testThenBlock

Method testThenBlock

parser.go:401–428  ·  view source on GitHub ↗
(escapes int)

Source from the content-addressed store, hash-verified

399}
400
401func (p *parser) testThenBlock(escapes int) int {
402 var jumpFalse int
403 p.next()
404 e := p.expression()
405 p.checkNext(tkThen)
406 if p.t == tkGoto || p.t == tkBreak {
407 e = p.function.GoIfFalse(e)
408 p.function.EnterBlock(false)
409 p.gotoStatement(e.t)
410 p.skipEmptyStatements()
411 if p.blockFollow(false) {
412 p.function.LeaveBlock()
413 return escapes
414 }
415 jumpFalse = p.function.Jump()
416 } else {
417 e = p.function.GoIfTrue(e)
418 p.function.EnterBlock(false)
419 jumpFalse = e.f
420 }
421 p.statementList()
422 p.function.LeaveBlock()
423 if p.t == tkElse || p.t == tkElseif {
424 escapes = p.function.Concatenate(escapes, p.function.Jump())
425 }
426 p.function.PatchToHere(jumpFalse)
427 return escapes
428}
429
430func (p *parser) ifStatement(line int) {
431 escapes := p.testThenBlock(noJump)

Callers 1

ifStatementMethod · 0.95

Calls 14

expressionMethod · 0.95
checkNextMethod · 0.95
gotoStatementMethod · 0.95
skipEmptyStatementsMethod · 0.95
blockFollowMethod · 0.95
statementListMethod · 0.95
GoIfFalseMethod · 0.80
EnterBlockMethod · 0.80
LeaveBlockMethod · 0.80
JumpMethod · 0.80
GoIfTrueMethod · 0.80
ConcatenateMethod · 0.80

Tested by

no test coverage detected