snazzy-d/sdc

One contract per line

0xEAB opened this issue · 0 comments

Currently sdfmt formats new-syntax contracts this way:

bool matchArguments(Template t, TemplateArgument[] args, Expression[] fargs,
                    TemplateArgument[] matchedArgs)
		in(t.step == Step.Processed) in(t.parameters.length >= args.length)
		in(matchedArgs.length == t.parameters.length) {
LLVMValueRef declare(Variable v)
		in(v.storage.isGlobal, "locals not supported") in(!v.isFinal)
		in(!v.isRef) {
void moveTo(ref TokenRange fr) in(base is fr.base) in(context is fr.context)
		in(content is fr.content) in(index < fr.index) 

This is not really nice to read.
Couldn’t we give each contract its own line?

Also, one wouldn’t write assertions or oldskool-contracts this way either…

assert(t.step == Step.Processed); assert(t.parameters.length >= args.length);
assert(matchedArgs.length == t.parameters.length);
void moveTo(ref TokenRange fr) in { assert(base is fr.base); assert(context is fr.context);
		assert(content is fr.content); assert(index < fr.index); } do {
void moveTo(ref TokenRange fr) in {
		assert(base is fr.base); assert(context is fr.context);
		assert(content is fr.content); assert(index < fr.index);
	} do {