MCPcopy
hub / github.com/jquerytools/jquerytools / doFunction

Function doFunction

lib/jslint.js:313–314  ·  view source on GitHub ↗
(i)

Source from the content-addressed store, hash-verified

311stmt('var',varstatement);stmt('new',function(){error("'new' should not be used as a statement.");});function functionparams(){var i,t=nexttoken,p=[];advance('(');nospace();if(nexttoken.id===')'){advance(')');nospace(prevtoken,token);return;}
312for(;;){i=identifier();p.push(i);addlabel(i,'parameter');if(nexttoken.id===','){advance(',');nonadjacent(token,nexttoken);}else{advance(')',t);nospace(prevtoken,token);return p.join(', ');}}}
313function doFunction(i){var s=scope;scope=Object.beget(s);funct={'(name)':i||'"'+anonname+'"','(line)':nexttoken.line+1,'(context)':funct,'(breakage)':0,'(loopage)':0,'(scope)':scope};functions.push(funct);if(i){addlabel(i,'function');}
314funct['(params)']=functionparams();block(false);scope=s;funct=funct['(context)'];}
315blockstmt('function',function(){if(inblock){warning("Function statements cannot be placed in blocks. Use a function expression or move the statement to the top of the outer function.",token);}
316var i=identifier();adjacent(token,nexttoken);addlabel(i,'unused');doFunction(i);if(nexttoken.id==='('&&nexttoken.line===token.line){error("Function statements are not invocable. Wrap the function expression in parens.");}});prefix('function',function(){var i=optionalidentifier();if(i){adjacent(token,nexttoken);}else{nonadjacent(token,nexttoken);}
317doFunction(i);if(funct['(loopage)']&&nexttoken.id!=='('){warning("Be careful when making functions within a loop. Consider putting the function in a closure.");}

Callers 1

jslint.jsFile · 0.85

Calls 3

addlabelFunction · 0.85
functionparamsFunction · 0.85
blockFunction · 0.85

Tested by

no test coverage detected