Skip to content

Commit 8d5d674

Browse files
committed
Code review from last PRs from @rxbryan
1 parent 01668d0 commit 8d5d674

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

source/cli/metacallcli/source/application.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,9 @@ void application::parameter_iterator::operator()(const char *parameter)
545545
{ "tsx", "ts" },
546546
/* Rust Loader */
547547
{ "rs", "rs" },
548-
{ "c", "c" }
548+
/* C Loader */
549+
{ "c", "c" },
550+
{ "h", "c" }
549551

550552
/* Note: By default js extension uses NodeJS loader instead of JavaScript V8 */
551553
/* Probably in the future we can differenciate between them, but it is not trivial */

source/loaders/c_loader/source/c_loader_impl.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535

3636
#include <metacall/metacall.h>
3737

38-
#include <iostream>
3938
#include <iterator>
4039
#include <map>
4140
#include <new>
@@ -337,14 +336,12 @@ static loader_impl_c_handle c_loader_impl_handle_create(loader_impl_c c_impl)
337336
size_t join_path_size = portability_path_join(loader_lib_path, strlen(loader_lib_path) + 1, include_dir, strlen(include_dir) + 1, join_path, PORTABILITY_PATH_SIZE);
338337
(void)portability_path_canonical(join_path, join_path_size, metacall_incl_path, PORTABILITY_PATH_SIZE);
339338

340-
/*Add metacall include path*/
339+
/* Add metacall include path */
341340
tcc_add_include_path(c_handle->state, metacall_incl_path);
342341

343-
/*Add metacall library path (in other to find libmetacall.so)*/
342+
/* Add metacall library path (in other to find metacall library) */
344343
tcc_add_library_path(c_handle->state, c_impl->libtcc_runtime_path.c_str());
345344

346-
(void)c_impl;
347-
348345
return c_handle;
349346
}
350347

source/loaders/node_loader/bootstrap/lib/bootstrap.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -264,14 +264,14 @@ function node_loader_trampoline_discover_arguments(node) {
264264
function node_loader_trampoline_discover_function(func) {
265265
try {
266266
if (node_loader_trampoline_is_callable(func)) {
267-
// Cherow can't parse native code functions so we can do a workaround
267+
// Espree can't parse native code functions so we can do a workaround
268268
const str = func.toString().replace('{ [native code] }', '{}');
269269
const ast = espree.parse(str, {
270270
ecmaVersion: 13
271271
});
272-
272+
273273
const node = (ast.body[0].type === 'ExpressionStatement') ?
274-
ast.body[0].expression : ast.body[0];
274+
ast.body[0].expression : ast.body[0];
275275

276276
if (node_loader_trampoline_is_valid_symbol(node)) {
277277
const args = node_loader_trampoline_discover_arguments(node);
@@ -284,7 +284,7 @@ function node_loader_trampoline_discover_function(func) {
284284
if (node.id && node.id.name) {
285285
discover['name'] = node.id.name;
286286
}
287-
287+
288288
return discover;
289289
}
290290
}

0 commit comments

Comments
 (0)