X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/93a3786624b2768d89bfa27e46598dc64e2fb70a..ed1e77d3adeb83d26fd1dfb16dd84cabdcefd250:/parser/SourceCode.h?ds=sidebyside diff --git a/parser/SourceCode.h b/parser/SourceCode.h index f221f92..f4a1902 100644 --- a/parser/SourceCode.h +++ b/parser/SourceCode.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008 Apple Inc. All rights reserved. + * Copyright (C) 2008, 2013 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -10,7 +10,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * 3. Neither the name of Apple Inc. ("Apple") nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * @@ -86,6 +86,8 @@ namespace JSC { return m_provider->getRange(m_startChar, m_endChar); } + CString toUTF8() const; + intptr_t providerID() const { if (!m_provider) @@ -103,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; @@ -115,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) {