1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

Fix cpplint

This commit is contained in:
Ryan Dahl 2019-01-29 21:31:59 -05:00
parent 13582ff3f2
commit 06c0e29118
9 changed files with 14 additions and 22 deletions

View file

@ -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();

View file

@ -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_);

View file

@ -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);

View file

@ -1,3 +1,6 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
#include "exceptions.h"
#include <string>
namespace deno {

View file

@ -1,3 +1,4 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
#ifndef EXCEPTIONS_H_
#define EXCEPTIONS_H_

View file

@ -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),

View file

@ -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};

View file

@ -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_

View file

@ -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"])