Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

One contract per line #331

Open
0xEAB opened this issue Oct 22, 2023 · 0 comments
Open

One contract per line #331

0xEAB opened this issue Oct 22, 2023 · 0 comments

Comments

@0xEAB
Copy link
Contributor

0xEAB commented Oct 22, 2023

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 {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant