Skip to content

Commit 8e1aabc

Browse files
authored
Run clang-format on all source files (luau-lang#175)
1 parent cd7d368 commit 8e1aabc

File tree

10 files changed

+312
-212
lines changed

10 files changed

+312
-212
lines changed

cli/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ lua_State* setupState(Runtime& runtime)
7171

7272
luteopen_vm(L);
7373
lua_setfield(L, -2, "@lute/vm");
74-
74+
7575
luteopen_system(L);
7676
lua_setfield(L, -2, "@lute/system");
7777

@@ -85,10 +85,10 @@ lua_State* setupState(Runtime& runtime)
8585

8686
lua_pushnil(L);
8787
lua_setglobal(L, "setfenv");
88-
88+
8989
lua_pushnil(L);
9090
lua_setglobal(L, "getfenv");
91-
91+
9292
luaL_sandbox(L);
9393

9494
return L;

cli/tc.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ struct LuteFileResolver : Luau::FileResolver
5757

5858
std::optional<Luau::ModuleInfo> resolveModule(const Luau::ModuleInfo* context, Luau::AstExpr* node) override
5959
{
60-
// TODO: Need to handle requires
60+
// TODO: Need to handle requires
6161
return std::nullopt;
6262
}
6363

@@ -69,7 +69,7 @@ struct LuteFileResolver : Luau::FileResolver
6969
}
7070

7171
private:
72-
// TODO: add require resolver;
72+
// TODO: add require resolver;
7373
};
7474

7575
struct LuteConfigResolver : Luau::ConfigResolver
@@ -168,13 +168,13 @@ static bool reportModuleResult(Luau::Frontend& frontend, const Luau::ModuleName&
168168
}
169169

170170
for (auto& error : cr->errors)
171-
reportError(frontend, error);
171+
reportError(frontend, error);
172172

173173
std::string humanReadableName = frontend.fileResolver->getHumanReadableModuleName(name);
174174
for (auto& error : cr->lintResult.errors)
175-
reportWarning( humanReadableName.c_str(), error);
175+
reportWarning(humanReadableName.c_str(), error);
176176
for (auto& warning : cr->lintResult.warnings)
177-
reportWarning( humanReadableName.c_str(), warning);
177+
reportWarning(humanReadableName.c_str(), warning);
178178

179179
return cr->errors.empty() && cr->lintResult.errors.empty();
180180
}
@@ -193,7 +193,7 @@ std::vector<std::string> processSourceFiles(const std::vector<std::string>& sour
193193
{
194194
std::vector<std::string> files;
195195

196-
for (const auto& path :sourceFilesInput)
196+
for (const auto& path : sourceFilesInput)
197197
{
198198
std::string normalized = normalizePath(path);
199199

@@ -264,7 +264,7 @@ int typecheck(const std::vector<std::string>& sourceFilesInput)
264264
std::string humanReadableName = frontend.fileResolver->getHumanReadableModuleName(moduleName);
265265

266266
Luau::TypeError error(location, moduleName, Luau::InternalError{ice.message});
267-
report(
267+
report(
268268
humanReadableName.c_str(),
269269
location,
270270
"InternalCompilerError",
@@ -276,7 +276,7 @@ int typecheck(const std::vector<std::string>& sourceFilesInput)
276276
int failed = 0;
277277

278278
for (const Luau::ModuleName& name : checkedModules)
279-
failed += !reportModuleResult(frontend, name, annotate);
279+
failed += !reportModuleResult(frontend, name, annotate);
280280

281281
if (!configResolver.configErrors.empty())
282282
{

fs/src/fs.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,11 @@ struct FileHandle
117117

118118
l_noret luaL_errorHandle(lua_State* L, FileHandle& handle)
119119
{
120-
#ifdef _MSC_VER
121-
luaL_errorL(L, "Error writing to file with descriptor %Iu\n", handle.fileDescriptor);
122-
#else
123-
luaL_errorL(L, "Error writing to file with descriptor %zu\n", handle.fileDescriptor);
124-
#endif
120+
#ifdef _MSC_VER
121+
luaL_errorL(L, "Error writing to file with descriptor %Iu\n", handle.fileDescriptor);
122+
#else
123+
luaL_errorL(L, "Error writing to file with descriptor %zu\n", handle.fileDescriptor);
124+
#endif
125125
}
126126

127127
void setfield(lua_State* L, const char* index, int value)
@@ -322,7 +322,8 @@ int fs_mkdir(lua_State* L)
322322
return 0;
323323
}
324324

325-
int fs_rmdir(lua_State* L) {
325+
int fs_rmdir(lua_State* L)
326+
{
326327
const char* path = luaL_checkstring(L, 1);
327328

328329
uv_fs_t rmdir_req;

luau/include/lute/luau.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ int luaopen_luau(lua_State* L);
88
// open the library as a table on top of the stack
99
int luteopen_luau(lua_State* L);
1010

11-
namespace luau {
11+
namespace luau
12+
{
1213

1314
int luau_parse(lua_State* L);
1415

luau/src/luau.cpp

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,10 @@ static std::vector<Luau::Comment> commentsWithinSpan(const std::vector<Luau::Com
101101
return result;
102102
}
103103

104-
struct Trivia {
105-
enum TriviaKind {
104+
struct Trivia
105+
{
106+
enum TriviaKind
107+
{
106108
Whitespace,
107109
SingleLineComment,
108110
MultiLineComment,
@@ -118,7 +120,7 @@ struct AstSerialize : public Luau::AstVisitor
118120
lua_State* L;
119121
Luau::CstNodeMap cstNodeMap;
120122
std::string_view source;
121-
Luau::Position currentPosition{0,0};
123+
Luau::Position currentPosition{0, 0};
122124
std::vector<size_t> lineOffsets;
123125
std::vector<Luau::Comment> commentLocations;
124126

@@ -379,15 +381,15 @@ struct AstSerialize : public Luau::AstVisitor
379381

380382
switch (trivia[i].kind)
381383
{
382-
case Trivia::Whitespace:
383-
lua_pushstring(L, "whitespace");
384-
break;
385-
case Trivia::SingleLineComment:
386-
lua_pushstring(L, "comment");
387-
break;
388-
case Trivia::MultiLineComment:
389-
lua_pushstring(L, "blockcomment");
390-
break;
384+
case Trivia::Whitespace:
385+
lua_pushstring(L, "whitespace");
386+
break;
387+
case Trivia::SingleLineComment:
388+
lua_pushstring(L, "comment");
389+
break;
390+
case Trivia::MultiLineComment:
391+
lua_pushstring(L, "blockcomment");
392+
break;
391393
}
392394
lua_setfield(L, -2, "tag");
393395

@@ -597,7 +599,7 @@ struct AstSerialize : public Luau::AstVisitor
597599
serializeToken(node->location.begin, node->local->name.value);
598600
lua_setfield(L, -2, "token"),
599601

600-
serialize(node->local);
602+
serialize(node->local);
601603
lua_setfield(L, -2, "local");
602604

603605
lua_pushboolean(L, node->upvalue);
@@ -1668,10 +1670,12 @@ int load_luau(lua_State* L)
16681670

16691671
} // namespace luau
16701672

1671-
static int index_result(lua_State* L) {
1673+
static int index_result(lua_State* L)
1674+
{
16721675
const std::string* bytecode_string = static_cast<std::string*>(luaL_checkudata(L, 1, COMPILE_RESULT_TYPE));
16731676

1674-
if (std::strcmp(luaL_checkstring(L, 2), "bytecode") == 0) {
1677+
if (std::strcmp(luaL_checkstring(L, 2), "bytecode") == 0)
1678+
{
16751679
lua_pushlstring(L, bytecode_string->c_str(), bytecode_string->size());
16761680

16771681
return 1;

0 commit comments

Comments
 (0)