[Webkit-unassigned] [Bug 155545] [ES6] Class syntax. Access to new.target inside of the eval should not lead to SyntaxError

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Apr 1 17:30:32 PDT 2016


--- Comment #10 from Saam Barati <sbarati at apple.com> ---
Comment on attachment 275411
  --> https://bugs.webkit.org/attachment.cgi?id=275411

View in context: https://bugs.webkit.org/attachment.cgi?id=275411&action=review

> Source/JavaScriptCore/bytecode/ExecutableInfo.h:34
> +enum class EvalContextType    : uint8_t { None, ProgramEvalContextType, FunctionEvalContextType };

It seems like we don't need ProgramEvalContextType. Wy not just use "None" and "FunctionEvalContext"?

Style: Also, these name don't need to end with "Type". It can just be "FunctionEvalContext" since this is an "enum class"

> Source/JavaScriptCore/parser/Parser.cpp:3866
> +                semanticFailIfFalse(currentScope()->isFunction() || (closestParentOrdinaryFunctionNonLexicalScope()->isEvalContext() && closestParentOrdinaryFunctionNonLexicalScope()->evalContextType() == EvalContextType::FunctionEvalContextType), "new.target is only valid inside functions");

Do we really need to check both "isEvalContext() and evalContextType() == ..."?
It seems based on your assertion in the constructor it's sufficient to just check that "evalContextType() == FunctionEvalContext"

> Source/JavaScriptCore/parser/Parser.h:732
> +    unsigned m_evalContextType;

This should have type EvalContextType, not unsigned.
(The other fields that  are unsigned and do similar things with casting should also have their respective types instead of unsigned. We can fix that in a separate patch. I introduced this ugliness in.)

You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20160402/42263997/attachment.html>

More information about the webkit-unassigned mailing list