Parquery / gocontracts

A tool for design-by-contract in Go
MIT License
111 stars 7 forks source link

added support for single-line functions #32

Closed mristin closed 5 years ago

mristin commented 5 years ago

Single-line functions caused the assertion in updateNonemptyFunc (new: updateMultilineFunc) to panic: we put cursor at the first non-contract statement of the function body and move it back till we expected to reach either a new-line start or a semi-colon (';') indicating the end of the contract block.

However, when a single-line function was given, we would reach the left brace of the function definition like in this function:

func SomeFunc(x int, y int) (result string, err error) { return "" }