diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-03-20 10:08:54 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-03-20 10:10:12 +0100 |
commit | 893a886ea38853a1a3e97bcf135ea3cb616cd69a (patch) | |
tree | 5188f8895ce513381917d37115b50f72fb4e64a9 /js/src/jsscript.cpp | |
parent | 7197b308fb97cd8ab7a972df6a3a17a7a265b594 (diff) | |
parent | 6085bfdcecc2529c1037f813e70583c2a776677d (diff) | |
download | UXP-893a886ea38853a1a3e97bcf135ea3cb616cd69a.tar UXP-893a886ea38853a1a3e97bcf135ea3cb616cd69a.tar.gz UXP-893a886ea38853a1a3e97bcf135ea3cb616cd69a.tar.lz UXP-893a886ea38853a1a3e97bcf135ea3cb616cd69a.tar.xz UXP-893a886ea38853a1a3e97bcf135ea3cb616cd69a.zip |
Add support for the function `name` property.
This resolves #78.
Merged remote-tracking branch 'janek/js_function_name_1'
Diffstat (limited to 'js/src/jsscript.cpp')
-rw-r--r-- | js/src/jsscript.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/js/src/jsscript.cpp b/js/src/jsscript.cpp index b568b4b30..929251d8b 100644 --- a/js/src/jsscript.cpp +++ b/js/src/jsscript.cpp @@ -316,6 +316,7 @@ js::XDRScript(XDRState<mode>* xdr, HandleScope scriptEnclosingScope, HandleScrip IsLegacyGenerator, IsStarGenerator, IsAsync, + HasRest, OwnSource, ExplicitUseStrict, SelfHosted, @@ -431,6 +432,8 @@ js::XDRScript(XDRState<mode>* xdr, HandleScope scriptEnclosingScope, HandleScrip scriptBits |= (1 << IsStarGenerator); if (script->asyncKind() == AsyncFunction) scriptBits |= (1 << IsAsync); + if (script->hasRest()) + scriptBits |= (1 << HasRest); if (script->hasSingletons()) scriptBits |= (1 << HasSingleton); if (script->treatAsRunOnce()) @@ -582,6 +585,8 @@ js::XDRScript(XDRState<mode>* xdr, HandleScope scriptEnclosingScope, HandleScrip if (scriptBits & (1 << IsAsync)) script->setAsyncKind(AsyncFunction); + if (scriptBits & (1 << HasRest)) + script->setHasRest(); } JS_STATIC_ASSERT(sizeof(jsbytecode) == 1); @@ -2637,6 +2642,8 @@ JSScript::initFromFunctionBox(ExclusiveContext* cx, HandleScript script, script->isGeneratorExp_ = funbox->isGenexpLambda; script->setGeneratorKind(funbox->generatorKind()); script->setAsyncKind(funbox->asyncKind()); + if (funbox->hasRest()) + script->setHasRest(); PositionalFormalParameterIter fi(script); while (fi && !fi.closedOver()) @@ -3295,6 +3302,7 @@ js::detail::CopyScript(JSContext* cx, HandleScript src, HandleScript dst, dst->needsHomeObject_ = src->needsHomeObject(); dst->isDefaultClassConstructor_ = src->isDefaultClassConstructor(); dst->isAsync_ = src->asyncKind() == AsyncFunction; + dst->hasRest_ = src->hasRest_; if (nconsts != 0) { GCPtrValue* vector = Rebase<GCPtrValue>(dst, src, src->consts()->vector); @@ -4028,6 +4036,7 @@ LazyScript::Create(ExclusiveContext* cx, HandleFunction fun, p.shouldDeclareArguments = false; p.hasThisBinding = false; p.isAsync = false; + p.hasRest = false; p.numClosedOverBindings = closedOverBindings.length(); p.numInnerFunctions = innerFunctions.length(); p.generatorKindBits = GeneratorKindAsBits(NotGenerator); @@ -4169,7 +4178,7 @@ JSScript::hasLoops() bool JSScript::mayReadFrameArgsDirectly() { - return argumentsHasVarBinding() || (function() && function()->hasRest()); + return argumentsHasVarBinding() || hasRest(); } static inline void |