move .clang-format up a folder so it affects all our c/cpp files (#14400)

Co-authored-by: nektro <nektro@users.noreply.github.com>
This commit is contained in:
Meghan Denny
2024-10-08 23:04:05 -07:00
committed by GitHub
parent 05e1832c68
commit ca6013acef
8 changed files with 823 additions and 789 deletions

View File

@@ -2,99 +2,100 @@
namespace Zig {
JSC::SyntheticSourceProvider::SyntheticSourceGenerator
generateObjectModuleSourceCode(JSC::JSGlobalObject *globalObject,
JSC::JSObject *object) {
gcProtectNullTolerant(object);
return [object](JSC::JSGlobalObject *lexicalGlobalObject,
JSC::Identifier moduleKey,
Vector<JSC::Identifier, 4> &exportNames,
JSC::MarkedArgumentBuffer &exportValues) -> void {
JSC::VM &vm = lexicalGlobalObject->vm();
GlobalObject *globalObject =
reinterpret_cast<GlobalObject *>(lexicalGlobalObject);
JSC::EnsureStillAliveScope stillAlive(object);
generateObjectModuleSourceCode(JSC::JSGlobalObject* globalObject,
JSC::JSObject* object)
{
gcProtectNullTolerant(object);
return [object](JSC::JSGlobalObject* lexicalGlobalObject,
JSC::Identifier moduleKey,
Vector<JSC::Identifier, 4>& exportNames,
JSC::MarkedArgumentBuffer& exportValues) -> void {
JSC::VM& vm = lexicalGlobalObject->vm();
GlobalObject* globalObject = reinterpret_cast<GlobalObject*>(lexicalGlobalObject);
JSC::EnsureStillAliveScope stillAlive(object);
PropertyNameArray properties(vm, PropertyNameMode::Strings,
PrivateSymbolMode::Exclude);
object->getPropertyNames(globalObject, properties,
DontEnumPropertiesMode::Exclude);
gcUnprotectNullTolerant(object);
PropertyNameArray properties(vm, PropertyNameMode::Strings,
PrivateSymbolMode::Exclude);
object->getPropertyNames(globalObject, properties,
DontEnumPropertiesMode::Exclude);
gcUnprotectNullTolerant(object);
for (auto &entry : properties) {
exportNames.append(entry);
for (auto& entry : properties) {
exportNames.append(entry);
auto scope = DECLARE_CATCH_SCOPE(vm);
JSValue value = object->get(globalObject, entry);
if (scope.exception()) {
scope.clearException();
value = jsUndefined();
}
exportValues.append(value);
}
};
auto scope = DECLARE_CATCH_SCOPE(vm);
JSValue value = object->get(globalObject, entry);
if (scope.exception()) {
scope.clearException();
value = jsUndefined();
}
exportValues.append(value);
}
};
}
JSC::SyntheticSourceProvider::SyntheticSourceGenerator
generateObjectModuleSourceCodeForJSON(JSC::JSGlobalObject *globalObject,
JSC::JSObject *object) {
gcProtectNullTolerant(object);
return [object](JSC::JSGlobalObject *lexicalGlobalObject,
JSC::Identifier moduleKey,
Vector<JSC::Identifier, 4> &exportNames,
JSC::MarkedArgumentBuffer &exportValues) -> void {
JSC::VM &vm = lexicalGlobalObject->vm();
GlobalObject *globalObject =
reinterpret_cast<GlobalObject *>(lexicalGlobalObject);
JSC::EnsureStillAliveScope stillAlive(object);
generateObjectModuleSourceCodeForJSON(JSC::JSGlobalObject* globalObject,
JSC::JSObject* object)
{
gcProtectNullTolerant(object);
return [object](JSC::JSGlobalObject* lexicalGlobalObject,
JSC::Identifier moduleKey,
Vector<JSC::Identifier, 4>& exportNames,
JSC::MarkedArgumentBuffer& exportValues) -> void {
JSC::VM& vm = lexicalGlobalObject->vm();
GlobalObject* globalObject = reinterpret_cast<GlobalObject*>(lexicalGlobalObject);
JSC::EnsureStillAliveScope stillAlive(object);
PropertyNameArray properties(vm, PropertyNameMode::Strings,
PrivateSymbolMode::Exclude);
object->getPropertyNames(globalObject, properties,
DontEnumPropertiesMode::Exclude);
gcUnprotectNullTolerant(object);
PropertyNameArray properties(vm, PropertyNameMode::Strings,
PrivateSymbolMode::Exclude);
object->getPropertyNames(globalObject, properties,
DontEnumPropertiesMode::Exclude);
gcUnprotectNullTolerant(object);
for (auto &entry : properties) {
if (entry == vm.propertyNames->defaultKeyword) {
continue;
}
for (auto& entry : properties) {
if (entry == vm.propertyNames->defaultKeyword) {
continue;
}
exportNames.append(entry);
exportNames.append(entry);
auto scope = DECLARE_CATCH_SCOPE(vm);
JSValue value = object->get(globalObject, entry);
if (scope.exception()) {
scope.clearException();
value = jsUndefined();
}
exportValues.append(value);
}
auto scope = DECLARE_CATCH_SCOPE(vm);
JSValue value = object->get(globalObject, entry);
if (scope.exception()) {
scope.clearException();
value = jsUndefined();
}
exportValues.append(value);
}
exportNames.append(vm.propertyNames->defaultKeyword);
exportValues.append(object);
};
exportNames.append(vm.propertyNames->defaultKeyword);
exportValues.append(object);
};
}
JSC::SyntheticSourceProvider::SyntheticSourceGenerator
generateJSValueModuleSourceCode(JSC::JSGlobalObject *globalObject,
JSC::JSValue value) {
generateJSValueModuleSourceCode(JSC::JSGlobalObject* globalObject,
JSC::JSValue value)
{
if (value.isObject() && !JSC::isJSArray(value)) {
return generateObjectModuleSourceCodeForJSON(globalObject,
value.getObject());
}
if (value.isCell())
gcProtectNullTolerant(value.asCell());
return [value](JSC::JSGlobalObject *lexicalGlobalObject,
JSC::Identifier moduleKey,
Vector<JSC::Identifier, 4> &exportNames,
JSC::MarkedArgumentBuffer &exportValues) -> void {
JSC::VM &vm = lexicalGlobalObject->vm();
exportNames.append(vm.propertyNames->defaultKeyword);
exportValues.append(value);
if (value.isObject() && !JSC::isJSArray(value)) {
return generateObjectModuleSourceCodeForJSON(globalObject,
value.getObject());
}
if (value.isCell())
gcUnprotectNullTolerant(value.asCell());
};
gcProtectNullTolerant(value.asCell());
return [value](JSC::JSGlobalObject* lexicalGlobalObject,
JSC::Identifier moduleKey,
Vector<JSC::Identifier, 4>& exportNames,
JSC::MarkedArgumentBuffer& exportValues) -> void {
JSC::VM& vm = lexicalGlobalObject->vm();
exportNames.append(vm.propertyNames->defaultKeyword);
exportValues.append(value);
if (value.isCell())
gcUnprotectNullTolerant(value.asCell());
};
}
} // namespace Zig
} // namespace Zig