X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/81345200c95645a1b0d2635520f96ad55dfde63f..ed1e77d3adeb83d26fd1dfb16dd84cabdcefd250:/parser/SourceCode.h?ds=sidebyside diff --git a/parser/SourceCode.h b/parser/SourceCode.h index 73d23db..f4a1902 100644 --- a/parser/SourceCode.h +++ b/parser/SourceCode.h @@ -105,6 +105,9 @@ namespace JSC { SourceCode subExpression(unsigned openBrace, unsigned closeBrace, int firstLine, int startColumn); +#if ENABLE(ES6_ARROWFUNCTION_SYNTAX) + SourceCode subArrowExpression(unsigned startArrowFunction, unsigned endArrowFunction, int firstLine, int startColumn); +#endif private: RefPtr m_provider; int m_startChar; @@ -117,6 +120,16 @@ namespace JSC { { return SourceCode(StringSourceProvider::create(source, url, startPosition), startPosition.m_line.oneBasedInt(), startPosition.m_column.oneBasedInt()); } + +#if ENABLE(ES6_ARROWFUNCTION_SYNTAX) + inline SourceCode SourceCode::subArrowExpression(unsigned startArrowFunction, unsigned endArrowFunction, int firstLine, int startColumn) + { + ASSERT(provider()->source()[startArrowFunction] == '=' && provider()->source()[startArrowFunction + 1] == '>'); + + startColumn += 1; // Convert to base 1. + return SourceCode(provider(), startArrowFunction, endArrowFunction, firstLine, startColumn); + } +#endif inline SourceCode SourceCode::subExpression(unsigned openBrace, unsigned closeBrace, int firstLine, int startColumn) {