()
| 3912 | // 13 Function Definition |
| 3913 | |
| 3914 | function parseFunctionSourceElements() { |
| 3915 | var statement, body = [], token, directive, firstRestricted, |
| 3916 | oldLabelSet, oldInIteration, oldInSwitch, oldInFunctionBody, oldParenthesisCount, |
| 3917 | node = new Node(); |
| 3918 | |
| 3919 | expect('{'); |
| 3920 | |
| 3921 | while (startIndex < length) { |
| 3922 | if (lookahead.type !== Token.StringLiteral) { |
| 3923 | break; |
| 3924 | } |
| 3925 | token = lookahead; |
| 3926 | |
| 3927 | statement = parseStatementListItem(); |
| 3928 | body.push(statement); |
| 3929 | if (statement.expression.type !== Syntax.Literal) { |
| 3930 | // this is not directive |
| 3931 | break; |
| 3932 | } |
| 3933 | directive = source.slice(token.start + 1, token.end - 1); |
| 3934 | if (directive === 'use strict') { |
| 3935 | strict = true; |
| 3936 | if (firstRestricted) { |
| 3937 | tolerateUnexpectedToken(firstRestricted, Messages.StrictOctalLiteral); |
| 3938 | } |
| 3939 | } else { |
| 3940 | if (!firstRestricted && token.octal) { |
| 3941 | firstRestricted = token; |
| 3942 | } |
| 3943 | } |
| 3944 | } |
| 3945 | |
| 3946 | oldLabelSet = state.labelSet; |
| 3947 | oldInIteration = state.inIteration; |
| 3948 | oldInSwitch = state.inSwitch; |
| 3949 | oldInFunctionBody = state.inFunctionBody; |
| 3950 | oldParenthesisCount = state.parenthesizedCount; |
| 3951 | |
| 3952 | state.labelSet = {}; |
| 3953 | state.inIteration = false; |
| 3954 | state.inSwitch = false; |
| 3955 | state.inFunctionBody = true; |
| 3956 | state.parenthesizedCount = 0; |
| 3957 | |
| 3958 | while (startIndex < length) { |
| 3959 | if (match('}')) { |
| 3960 | break; |
| 3961 | } |
| 3962 | body.push(parseStatementListItem()); |
| 3963 | } |
| 3964 | |
| 3965 | expect('}'); |
| 3966 | |
| 3967 | state.labelSet = oldLabelSet; |
| 3968 | state.inIteration = oldInIteration; |
| 3969 | state.inSwitch = oldInSwitch; |
| 3970 | state.inFunctionBody = oldInFunctionBody; |
| 3971 | state.parenthesizedCount = oldParenthesisCount; |
no test coverage detected