"use strict";
/*
 * edge-parser
 *
 * (c) Harminder Virk <virk@adonisjs.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
Object.defineProperty(exports, "__esModule", { value: true });
const edge_error_1 = require("edge-error");
const transformAst_1 = require("../Parser/transformAst");
const UNALLOWED_EXPRESSION_MESSAGE = 'Make sure to render template in async mode before using await expression';
exports.default = {
    toStatement(statement, filename, parser) {
        if (!parser.options.async) {
            const { line, col } = parser.utils.getExpressionLoc(statement);
            throw new edge_error_1.EdgeError(UNALLOWED_EXPRESSION_MESSAGE, 'E_PARSER_ERROR', {
                line,
                col,
                filename,
            });
        }
        statement.argument = (0, transformAst_1.transformAst)(statement.argument, filename, parser);
        return statement;
    },
};
