mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 18:38:10 +00:00
LibJS: Add raw strings to tagged template literals
When calling a function with a tagged template, the first array that is passed in now contains a "raw" property with the raw, escaped strings.
This commit is contained in:
parent
9d0c6a32bd
commit
b5f1df57ed
5 changed files with 52 additions and 9 deletions
|
@ -779,7 +779,13 @@ private:
|
|||
class TemplateLiteral final : public Expression {
|
||||
public:
|
||||
TemplateLiteral(NonnullRefPtrVector<Expression> expressions)
|
||||
: m_expressions(expressions)
|
||||
: m_expressions(move(expressions))
|
||||
{
|
||||
}
|
||||
|
||||
TemplateLiteral(NonnullRefPtrVector<Expression> expressions, NonnullRefPtrVector<Expression> raw_strings)
|
||||
: m_expressions(move(expressions))
|
||||
, m_raw_strings(move(raw_strings))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -787,11 +793,13 @@ public:
|
|||
virtual void dump(int indent) const override;
|
||||
|
||||
const NonnullRefPtrVector<Expression>& expressions() const { return m_expressions; }
|
||||
const NonnullRefPtrVector<Expression>& raw_strings() const { return m_raw_strings; }
|
||||
|
||||
private:
|
||||
virtual const char* class_name() const override { return "TemplateLiteral"; }
|
||||
|
||||
const NonnullRefPtrVector<Expression> m_expressions;
|
||||
const NonnullRefPtrVector<Expression> m_raw_strings;
|
||||
};
|
||||
|
||||
class TaggedTemplateLiteral final : public Expression {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue