Skip to content

Instantly share code, notes, and snippets.

@olov
Created November 13, 2014 07:33
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save olov/3d62764849a604caeb01 to your computer and use it in GitHub Desktop.
bind-comments
// yoyoyomamama comment on the file (note blank line after it)
// comment bound to function
function foo() {
// comment bound to if-statement
if (a) {
// comment bound to first block
b(); // comment bound to statement
} else if (b) {
// comment bound to second block
b(/* comment bound to expr */ 1);
}
}
// and so one. yah the devil is in the details but this is what we end up figuring out in tooling anyways
// so why not make it explicit with a few rules in the spec. the spec can also allow "free" comments i.e.
// all those that are not covered by any binding rules. Tooling keeps them with best-effort and linters
// can detect the presense of those.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment