Lines Matching refs:function
57 // the code. Thus the generated function is not called here.
58 function TestLocalThrows(str, expect) {
59 assertThrows("(function(arg){ 'use strict'; " + str + "})", expect);
62 function TestLocalDoesNotThrow(str) {
63 assertDoesNotThrow("(function(arg){ 'use strict'; " + str + "})()");
114 TestLocalThrows("{ function f() {} let f; }");
115 TestLocalThrows("{ let f; function f() {} }");
116 TestLocalThrows("{ function f() {} var f; }");
117 TestLocalThrows("{ var f; function f() {} }");
118 TestLocalThrows("{ function f() {} function f() {} }");
119 TestLocalThrows("function f() {} let f;");
120 TestLocalThrows("let f; function f() {}");
121 TestLocalDoesNotThrow("function arg() {}");
122 TestLocalDoesNotThrow("function f() {} var f;");
123 TestLocalDoesNotThrow("var f; function f() {}");
124 TestLocalDoesNotThrow("function f() {} function f() {}");
126 function g(f) {
127 function f() { return 1 }
130 assertEquals(1, g(function() { return 2 }))
133 // Test function declarations in source element and
135 function f() {
137 function g0() {
140 function h() { }
142 function h1() { }
146 function g1() { }
151 // Test function declarations in statement position in strict mode.
152 TestLocalThrows("function f() { if (true) function g() {}", SyntaxError);
153 TestLocalThrows("function f() { if (true) {} else function g() {}", SyntaxError);
154 TestLocalThrows("function f() { do function g() {} while (false)", SyntaxError);
155 TestLocalThrows("function f() { while (false) function g() {}", SyntaxError);
156 TestLocalThrows("function f() { label: function g() {}", SyntaxError);
157 TestLocalThrows("function f() { for (;false;) function g() {}", SyntaxError);
158 TestLocalThrows("function f() { switch (true) { case true: function g() {} }", SyntaxError);
159 TestLocalThrows("function f() { switch (true) { default: function g() {} }", SyntaxError);