summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2019-01-29 21:31:59 -0500
committerRyan Dahl <ry@tinyclouds.org>2019-01-30 15:53:23 -0500
commit06c0e291182f20f207e4c914ae78d3f9ec16e074 (patch)
tree4bb41b0b0efead893d07e113d0b05ee23b738091
parent13582ff3f2478f2e2cafa3042fc6aa96ae5049c5 (diff)
Fix cpplint
-rw-r--r--libdeno/api.cc2
-rw-r--r--libdeno/binding.cc4
-rw-r--r--libdeno/deno.h12
-rw-r--r--libdeno/exceptions.cc3
-rw-r--r--libdeno/exceptions.h1
-rw-r--r--libdeno/internal.h3
-rw-r--r--libdeno/test.cc1
-rw-r--r--libdeno/test.h6
-rwxr-xr-xtools/lint.py4
9 files changed, 14 insertions, 22 deletions
diff --git a/libdeno/api.cc b/libdeno/api.cc
index ebdbea643..1c62cdd5a 100644
--- a/libdeno/api.cc
+++ b/libdeno/api.cc
@@ -15,7 +15,7 @@ extern "C" {
Deno* deno_new_snapshotter(deno_config config) {
CHECK(config.will_snapshot);
- // TODO Support loading snapshots before snapshotting.
+ // TODO(ry) Support loading snapshots before snapshotting.
CHECK_NULL(config.load_snapshot.data_ptr);
auto* creator = new v8::SnapshotCreator(deno::external_references);
auto* isolate = creator->GetIsolate();
diff --git a/libdeno/binding.cc b/libdeno/binding.cc
index effb2a979..39007405f 100644
--- a/libdeno/binding.cc
+++ b/libdeno/binding.cc
@@ -357,14 +357,12 @@ v8::MaybeLocal<v8::Module> ResolveCallback(v8::Local<v8::Context> context,
// In order to export obj as a module, we must iterate over its properties
// and export them each individually.
- // TODO Find a better way to do this.
std::string src = "let globalEval = eval\nlet g = globalEval('this');\n";
auto names = obj->GetOwnPropertyNames(context).ToLocalChecked();
for (uint32_t i = 0; i < names->Length(); i++) {
auto name = names->Get(context, i).ToLocalChecked();
v8::String::Utf8Value name_utf8val(isolate, name);
const char* name_cstr = ToCString(name_utf8val);
- // TODO use format string.
src.append("export const ");
src.append(name_cstr);
src.append(" = g.libdeno.builtinModules.");
@@ -396,7 +394,7 @@ v8::MaybeLocal<v8::Module> ResolveCallback(v8::Local<v8::Context> context,
break;
}
}
- CHECK(referrer_filename.size() != 0);
+ CHECK_NE(referrer_filename.size(), 0);
v8::String::Utf8Value specifier_(isolate, specifier);
const char* specifier_c = ToCString(specifier_);
diff --git a/libdeno/deno.h b/libdeno/deno.h
index 7c8e94244..7568002ae 100644
--- a/libdeno/deno.h
+++ b/libdeno/deno.h
@@ -62,12 +62,6 @@ void deno_delete(Deno* d);
// module import statements.
// Return value: 0 = fail, 1 = success
// Get error text with deno_last_exception().
-//
-// TODO change return value to be const char*. On success the return
-// value is nullptr, on failure it is the JSON exception text that
-// is returned by deno_last_exception(). Remove deno_last_exception().
-// The return string is valid until the next execution of deno_execute or
-// deno_respond (as deno_last_exception is now).
int deno_execute(Deno* d, void* user_data, const char* js_filename,
const char* js_source);
@@ -99,12 +93,6 @@ int deno_execute_mod(Deno* d, void* user_data, const char* js_filename,
//
// A non-zero return value, means a JS exception was encountered during the
// libdeno.recv() callback. Check deno_last_exception() for exception text.
-//
-// TODO change return value to be const char*. On success the return
-// value is nullptr, on failure it is the JSON exception text that
-// is returned by deno_last_exception(). Remove deno_last_exception().
-// The return string is valid until the next execution of deno_execute or
-// deno_respond (as deno_last_exception is now).
int deno_respond(Deno* d, void* user_data, int32_t req_id, deno_buf buf);
void deno_check_promise_errors(Deno* d);
diff --git a/libdeno/exceptions.cc b/libdeno/exceptions.cc
index 5b1e67b93..081e61060 100644
--- a/libdeno/exceptions.cc
+++ b/libdeno/exceptions.cc
@@ -1,3 +1,6 @@
+// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
+#include "exceptions.h"
+#include <string>
namespace deno {
diff --git a/libdeno/exceptions.h b/libdeno/exceptions.h
index fce70e3f3..362bbc0e6 100644
--- a/libdeno/exceptions.h
+++ b/libdeno/exceptions.h
@@ -1,3 +1,4 @@
+// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
#ifndef EXCEPTIONS_H_
#define EXCEPTIONS_H_
diff --git a/libdeno/internal.h b/libdeno/internal.h
index d1b9f1d96..58dae013c 100644
--- a/libdeno/internal.h
+++ b/libdeno/internal.h
@@ -4,6 +4,7 @@
#include <map>
#include <string>
+#include <utility>
#include "deno.h"
#include "third_party/v8/include/v8.h"
#include "third_party/v8/src/base/logging.h"
@@ -13,7 +14,7 @@ namespace deno {
// deno_s = Wrapped Isolate.
class DenoIsolate {
public:
- DenoIsolate(deno_config config)
+ explicit DenoIsolate(deno_config config)
: isolate_(nullptr),
shared_(config.shared),
current_args_(nullptr),
diff --git a/libdeno/test.cc b/libdeno/test.cc
index 4901ba672..a8fcbc63b 100644
--- a/libdeno/test.cc
+++ b/libdeno/test.cc
@@ -1,5 +1,6 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
#include "test.h"
+#include <string>
#include "file_util.h"
deno_buf snapshot = {nullptr, 0, nullptr, 0};
diff --git a/libdeno/test.h b/libdeno/test.h
index 91e7119e8..25ca93988 100644
--- a/libdeno/test.h
+++ b/libdeno/test.h
@@ -1,6 +1,6 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-#ifndef TEST_H
-#define TEST_H
+#ifndef TEST_H_
+#define TEST_H_
#include "deno.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -8,4 +8,4 @@
extern deno_buf snapshot; // Loaded in libdeno/test.cc
const deno_buf empty = {nullptr, 0, nullptr, 0};
-#endif // TEST_H
+#endif // TEST_H_
diff --git a/tools/lint.py b/tools/lint.py
index 4c38d3c69..1e22703b5 100755
--- a/tools/lint.py
+++ b/tools/lint.py
@@ -15,8 +15,8 @@ tslint = os.path.join(third_party_path, "node_modules", "tslint", "bin",
os.chdir(root_path)
run([
- "python", cpplint, "--filter=-build/include_subdir", "--repository=src",
- "--extensions=cc,h", "--recursive", "src/."
+ "python", cpplint, "--filter=-build/include_subdir", "--repository=libdeno",
+ "--extensions=cc,h", "--recursive", "libdeno"
])
run(["node", tslint, "-p", ".", "--exclude", "**/gen/**/*.ts"])