void JsBuiltInEngineInterfaceExtensionObject::InitializePrototypes(ScriptContext * scriptContext) { JavascriptLibrary* library = scriptContext->GetLibrary(); JavascriptString * methodName = JavascriptString::NewWithSz(_u("ArrayIterator"), scriptContext); auto arrayIterator = JavascriptOperators::GetProperty(library->GetChakraLib(), JavascriptOperators::GetPropertyId(methodName, scriptContext), scriptContext); library->arrayIteratorPrototype = DynamicObject::FromVar(JavascriptOperators::GetProperty(DynamicObject::FromVar(arrayIterator), PropertyIds::prototype, scriptContext)); library->arrayIteratorPrototypeBuiltinNextFunction = JavascriptFunction::FromVar(JavascriptOperators::GetProperty(library->arrayIteratorPrototype, PropertyIds::next, scriptContext)); }
DynamicObject* JsBuiltInEngineInterfaceExtensionObject::GetPrototypeFromName(Js::PropertyIds propertyId, ScriptContext* scriptContext) { JavascriptLibrary* library = scriptContext->GetLibrary(); switch (propertyId) { case PropertyIds::Array: return library->arrayPrototype; case PropertyIds::String: return library->stringPrototype; case PropertyIds::__chakraLibrary: return library->GetChakraLib(); default: AssertMsg(false, "Unable to find a prototype that match with this className."); return nullptr; } }