コード例 #1
0
ファイル: Esprima.cs プロジェクト: alfredoaguirre/Esprima.Net
        public Node parseArrowFunctionExpression(Options options, Node node)
        {
            bool previousStrict;
            bool previousAllowYield;
            List<Node> body;

            if (hasLineTerminator)
            {
                tolerateUnexpectedToken(lookahead);
            }
            expect("=>");

            previousStrict = strict;
            previousAllowYield = state.allowYield;
            state.allowYield = true;

            body = new List<Node>() { parseConciseBody() };

            if (strict && options.firstRestricted != null)
            {
                throwUnexpectedToken(options.firstRestricted, options.message);
            }
            if (strict && options.stricted != null)
            {
                tolerateUnexpectedToken(options.stricted, options.message);
            }

            strict = previousStrict;
            state.allowYield = previousAllowYield;

            return node.finishArrowFunctionExpression(options.@params, options.defaults, body, null);
            //body.type != Syntax.BlockStatement);
        }