Exemple #1
0
func (p *parser) parseEnterLeave(fn *gocov.Function, entered bool) {
	p.expectNext(token.LPAREN)
	p.expectNext(token.RPAREN)
	if entered {
		fn.Enter()
	} else {
		fn.Leave()
	}
}
Exemple #2
0
func (p *parser) parseRegisterStatement(fn *gocov.Function) {
	p.expectNext(token.LPAREN)
	p.expectNext(token.INT)
	startOffset, _ := strconv.Atoi(p.lit)
	p.expectNext(token.COMMA)
	p.expectNext(token.INT)
	endOffset, _ := strconv.Atoi(p.lit)
	p.expectNext(token.RPAREN)
	p.expectNext(token.COLON)
	p.expectNext(token.IDENT)
	uid := objnameToUid(p.lit)
	stmt := fn.RegisterStatement(startOffset, endOffset)
	if stmt.Uid() != uid {
		panic(fmt.Errorf("uid differs: source must have changed"))
	}
	p.objects[uid] = stmt
}