[webkit-reviews] review granted: [Bug 217576] [JSC] Accept arbitrary module namespace identifier names : [Attachment 416308] Patch
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Wed Dec 16 09:36:03 PST 2020
Darin Adler <darin at apple.com> has granted Yusuke Suzuki <ysuzuki at apple.com>'s
request for review:
Bug 217576: [JSC] Accept arbitrary module namespace identifier names
https://bugs.webkit.org/show_bug.cgi?id=217576
Attachment 416308: Patch
https://bugs.webkit.org/attachment.cgi?id=416308&action=review
--- Comment #8 from Darin Adler <darin at apple.com> ---
Comment on attachment 416308
--> https://bugs.webkit.org/attachment.cgi?id=416308
Patch
View in context: https://bugs.webkit.org/attachment.cgi?id=416308&action=review
> Source/JavaScriptCore/parser/Parser.cpp:3538
> +template <class TreeBuilder> typename TreeBuilder::ExportSpecifier
Parser<LexerType>::parseExportSpecifier(TreeBuilder& context,
Vector<std::pair<const Identifier*, const Identifier*>>&
maybeExportedLocalNames, bool& hasKeywordForLocalBindings, bool&
hasReferencedModuleExportNames)
Could we make this easier to read by using a structure for return values
instead of having so many out arguments?
> Source/JavaScriptCore/parser/Parser.cpp:3566
> - failIfFalse(matchIdentifierOrKeyword(), "Expected an exported name
for the export declaration");
> + failIfFalse(matchIdentifierOrKeyword() || match(STRING), "Expected
an exported name or a module export name string for the export declaration");
> exportedName = m_token.m_data.ident;
> + if (match(STRING))
> + failIfTrue(hasUnpairedSurrogate(exportedName->string()),
"Expected a well-formed-unicode string for the module export name");
Is match(STRING) expensive? I ask because we do the check twice. Pattern also
recurs below.
> Source/WTF/wtf/text/StringView.h:1090
> +inline bool hasUnpairedSurrogate(StringView string)
Might be a little *too* inlined, but we can tweak that later.
More information about the webkit-reviews
mailing list