Skip to content

One contract per line #331

@0xEAB

Description

@0xEAB

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 {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions