Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/workerd/api/api-rtti-test.c++
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,17 @@

// Test building rtti for various APIs.

JSG_RTTI_DECLARE_CONFIGURATION_TYPE(workerd::CompatibilityFlags::Reader);

namespace workerd::api {
namespace {

KJ_TEST("WorkerGlobalScope") {
CompatibilityFlags::Reader flags;
jsg::rtti::Builder().structure<WorkerGlobalScope>(flags);
jsg::rtti::Builder(flags).structure<WorkerGlobalScope>();
}

KJ_TEST("ServiceWorkerGlobalScope") {
CompatibilityFlags::Reader flags;
jsg::rtti::Builder().structure<ServiceWorkerGlobalScope>(flags);
jsg::rtti::Builder(flags).structure<ServiceWorkerGlobalScope>();
}

} // namespace
Expand Down
9 changes: 4 additions & 5 deletions src/workerd/jsg/rtti-test.c++
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@
#include <workerd/jsg/rtti.h>

struct MockConfig {};
JSG_RTTI_DECLARE_CONFIGURATION_TYPE(MockConfig);

namespace workerd::jsg::rtti {
namespace {

template<typename T>
kj::String tType() {
// returns textual encoding of rtti.
Builder builder;
Builder<MockConfig> builder((MockConfig()));
auto type = builder.type<T>();
capnp::TextCodec codec;
return codec.encode(type);
Expand All @@ -24,8 +23,8 @@ kj::String tType() {
template<typename T>
kj::String tStructure() {
// returns textual encoding of structure.
Builder builder;
auto type = builder.structure<T>(MockConfig());
Builder<MockConfig> builder((MockConfig()));
auto type = builder.structure<T>();
capnp::TextCodec codec;
return codec.encode(type);
}
Expand Down Expand Up @@ -111,7 +110,7 @@ KJ_TEST("builtins") {
KJ_EXPECT(tType<v8::Isolate*>() == "(builtin = (type = v8Isolate))");
KJ_EXPECT(tType<v8::Function>() == "(builtin = (type = v8Function))");
KJ_EXPECT(tType<kj::Date>() == "(builtin = (type = kjDate))");
KJ_EXPECT(tType<MockConfig>() == "(builtin = (type = flags))");
KJ_EXPECT(tType<MockConfig>() == "(builtin = (type = configuration))");
KJ_EXPECT(tType<jsg::TypeHandler<kj::Date>>() == "(builtin = (type = jsgTypeHandler))");
}

Expand Down
4 changes: 2 additions & 2 deletions src/workerd/jsg/rtti.capnp
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ struct BuiltinType {
v8Function @7;
# v8::Function

flags @8;
# CompatibilityFlags::Reader
configuration @8;
# api meta configuration object

jsgLock @9;
# jsg::Lock
Expand Down
Loading