2020-07-12 03:23:01 +00:00
|
|
|
/*
|
2021-04-22 23:53:07 +00:00
|
|
|
* Copyright (c) 2020, Matthew Olsson <mattco@serenityos.org>
|
2020-07-12 03:23:01 +00:00
|
|
|
*
|
2021-04-22 08:24:48 +00:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-07-12 03:23:01 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <AK/Utf8View.h>
|
|
|
|
#include <LibJS/Runtime/GlobalObject.h>
|
2020-09-18 07:49:51 +00:00
|
|
|
#include <LibJS/Runtime/StringIterator.h>
|
2020-07-12 03:23:01 +00:00
|
|
|
|
|
|
|
namespace JS {
|
|
|
|
|
|
|
|
StringIterator* StringIterator::create(GlobalObject& global_object, String string)
|
|
|
|
{
|
2021-06-19 22:21:08 +00:00
|
|
|
return global_object.heap().allocate<StringIterator>(global_object, move(string), *global_object.string_iterator_prototype());
|
2020-07-12 03:23:01 +00:00
|
|
|
}
|
|
|
|
|
2021-06-19 22:21:08 +00:00
|
|
|
StringIterator::StringIterator(String string, Object& prototype)
|
2020-07-12 03:23:01 +00:00
|
|
|
: Object(prototype)
|
|
|
|
, m_string(move(string))
|
|
|
|
, m_iterator(Utf8View(m_string).begin())
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|