MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / expression

Function expression

lib/web/jshint.js:19816–19909  ·  view source on GitHub ↗
(rbp, initial)

Source from the content-addressed store, hash-verified

19814 // They are elements of the parsing method called Top Down Operator Precedence.
19815
19816 function expression(rbp, initial) {
19817 var left, isArray = false, isObject = false, isLetExpr = false;
19818
19819 state.nameStack.push();
19820
19821 // if current expression is a let expression
19822 if (!initial && state.tokens.next.value === "let" && peek(0).value === "(") {
19823 if (!state.inMoz()) {
19824 warning("W118", state.tokens.next, "let expressions");
19825 }
19826 isLetExpr = true;
19827 // create a new block scope we use only for the current expression
19828 state.funct["(scope)"].stack();
19829 advance("let");
19830 advance("(");
19831 state.tokens.prev.fud();
19832 advance(")");
19833 }
19834
19835 if (state.tokens.next.id === "(end)")
19836 error("E006", state.tokens.curr);
19837
19838 var isDangerous =
19839 state.option.asi &&
19840 state.tokens.prev.line !== startLine(state.tokens.curr) &&
19841 _.contains(["]", ")"], state.tokens.prev.id) &&
19842 _.contains(["[", "("], state.tokens.curr.id);
19843
19844 if (isDangerous)
19845 warning("W014", state.tokens.curr, state.tokens.curr.id);
19846
19847 advance();
19848
19849 if (initial) {
19850 state.funct["(verb)"] = state.tokens.curr.value;
19851 state.tokens.curr.beginsStmt = true;
19852 }
19853
19854 if (initial === true && state.tokens.curr.fud) {
19855 left = state.tokens.curr.fud();
19856 } else {
19857 if (state.tokens.curr.nud) {
19858 left = state.tokens.curr.nud(rbp);
19859 } else {
19860 error("E030", state.tokens.curr, state.tokens.curr.id);
19861 }
19862
19863 while (rbp < state.tokens.next.lbp && !isEndOfExpr()) {
19864 isArray = state.tokens.curr.value === "Array";
19865 isObject = state.tokens.curr.value === "Object";
19866
19867 // #527, new Foo.Array(), Foo.Array(), new Foo.Object(), Foo.Object()
19868 // Line breaks in IfStatement heads exist to satisfy the checkJSHint
19869 // "Line too long." error.
19870 if (left && (left.value || (left.first && left.first.value))) {
19871 // If the left.value is not "new", or the left.first.value is a "."
19872 // then safely assume that this is not "new Array()" and possibly
19873 // not "new Object()"...

Callers 15

prefixFunction · 0.70
infixFunction · 0.70
relationFunction · 0.70
assignopFunction · 0.70
bitwiseFunction · 0.70
bitwiseassignopFunction · 0.70
statementFunction · 0.70
blockFunction · 0.70
jshint.jsFile · 0.70
functionparamsFunction · 0.70
doTemplateLiteralFunction · 0.70

Calls 9

peekFunction · 0.85
warningFunction · 0.85
errorFunction · 0.85
isEndOfExprFunction · 0.85
advanceFunction · 0.70
startLineFunction · 0.70
pushMethod · 0.45
containsMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected