mirror of
https://github.com/denoland/deno.git
synced 2024-11-25 15:29:32 -05:00
Fix cpplint
This commit is contained in:
parent
13582ff3f2
commit
06c0e29118
9 changed files with 14 additions and 22 deletions
|
@ -15,7 +15,7 @@ extern "C" {
|
||||||
|
|
||||||
Deno* deno_new_snapshotter(deno_config config) {
|
Deno* deno_new_snapshotter(deno_config config) {
|
||||||
CHECK(config.will_snapshot);
|
CHECK(config.will_snapshot);
|
||||||
// TODO Support loading snapshots before snapshotting.
|
// TODO(ry) Support loading snapshots before snapshotting.
|
||||||
CHECK_NULL(config.load_snapshot.data_ptr);
|
CHECK_NULL(config.load_snapshot.data_ptr);
|
||||||
auto* creator = new v8::SnapshotCreator(deno::external_references);
|
auto* creator = new v8::SnapshotCreator(deno::external_references);
|
||||||
auto* isolate = creator->GetIsolate();
|
auto* isolate = creator->GetIsolate();
|
||||||
|
|
|
@ -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
|
// In order to export obj as a module, we must iterate over its properties
|
||||||
// and export them each individually.
|
// and export them each individually.
|
||||||
// TODO Find a better way to do this.
|
|
||||||
std::string src = "let globalEval = eval\nlet g = globalEval('this');\n";
|
std::string src = "let globalEval = eval\nlet g = globalEval('this');\n";
|
||||||
auto names = obj->GetOwnPropertyNames(context).ToLocalChecked();
|
auto names = obj->GetOwnPropertyNames(context).ToLocalChecked();
|
||||||
for (uint32_t i = 0; i < names->Length(); i++) {
|
for (uint32_t i = 0; i < names->Length(); i++) {
|
||||||
auto name = names->Get(context, i).ToLocalChecked();
|
auto name = names->Get(context, i).ToLocalChecked();
|
||||||
v8::String::Utf8Value name_utf8val(isolate, name);
|
v8::String::Utf8Value name_utf8val(isolate, name);
|
||||||
const char* name_cstr = ToCString(name_utf8val);
|
const char* name_cstr = ToCString(name_utf8val);
|
||||||
// TODO use format string.
|
|
||||||
src.append("export const ");
|
src.append("export const ");
|
||||||
src.append(name_cstr);
|
src.append(name_cstr);
|
||||||
src.append(" = g.libdeno.builtinModules.");
|
src.append(" = g.libdeno.builtinModules.");
|
||||||
|
@ -396,7 +394,7 @@ v8::MaybeLocal<v8::Module> ResolveCallback(v8::Local<v8::Context> context,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CHECK(referrer_filename.size() != 0);
|
CHECK_NE(referrer_filename.size(), 0);
|
||||||
|
|
||||||
v8::String::Utf8Value specifier_(isolate, specifier);
|
v8::String::Utf8Value specifier_(isolate, specifier);
|
||||||
const char* specifier_c = ToCString(specifier_);
|
const char* specifier_c = ToCString(specifier_);
|
||||||
|
|
|
@ -62,12 +62,6 @@ void deno_delete(Deno* d);
|
||||||
// module import statements.
|
// module import statements.
|
||||||
// Return value: 0 = fail, 1 = success
|
// Return value: 0 = fail, 1 = success
|
||||||
// Get error text with deno_last_exception().
|
// 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,
|
int deno_execute(Deno* d, void* user_data, const char* js_filename,
|
||||||
const char* js_source);
|
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
|
// A non-zero return value, means a JS exception was encountered during the
|
||||||
// libdeno.recv() callback. Check deno_last_exception() for exception text.
|
// 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);
|
int deno_respond(Deno* d, void* user_data, int32_t req_id, deno_buf buf);
|
||||||
|
|
||||||
void deno_check_promise_errors(Deno* d);
|
void deno_check_promise_errors(Deno* d);
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||||
|
#include "exceptions.h"
|
||||||
|
#include <string>
|
||||||
|
|
||||||
namespace deno {
|
namespace deno {
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||||
#ifndef EXCEPTIONS_H_
|
#ifndef EXCEPTIONS_H_
|
||||||
#define EXCEPTIONS_H_
|
#define EXCEPTIONS_H_
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
#include "deno.h"
|
#include "deno.h"
|
||||||
#include "third_party/v8/include/v8.h"
|
#include "third_party/v8/include/v8.h"
|
||||||
#include "third_party/v8/src/base/logging.h"
|
#include "third_party/v8/src/base/logging.h"
|
||||||
|
@ -13,7 +14,7 @@ namespace deno {
|
||||||
// deno_s = Wrapped Isolate.
|
// deno_s = Wrapped Isolate.
|
||||||
class DenoIsolate {
|
class DenoIsolate {
|
||||||
public:
|
public:
|
||||||
DenoIsolate(deno_config config)
|
explicit DenoIsolate(deno_config config)
|
||||||
: isolate_(nullptr),
|
: isolate_(nullptr),
|
||||||
shared_(config.shared),
|
shared_(config.shared),
|
||||||
current_args_(nullptr),
|
current_args_(nullptr),
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
|
#include <string>
|
||||||
#include "file_util.h"
|
#include "file_util.h"
|
||||||
|
|
||||||
deno_buf snapshot = {nullptr, 0, nullptr, 0};
|
deno_buf snapshot = {nullptr, 0, nullptr, 0};
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||||
#ifndef TEST_H
|
#ifndef TEST_H_
|
||||||
#define TEST_H
|
#define TEST_H_
|
||||||
|
|
||||||
#include "deno.h"
|
#include "deno.h"
|
||||||
#include "testing/gtest/include/gtest/gtest.h"
|
#include "testing/gtest/include/gtest/gtest.h"
|
||||||
|
@ -8,4 +8,4 @@
|
||||||
extern deno_buf snapshot; // Loaded in libdeno/test.cc
|
extern deno_buf snapshot; // Loaded in libdeno/test.cc
|
||||||
const deno_buf empty = {nullptr, 0, nullptr, 0};
|
const deno_buf empty = {nullptr, 0, nullptr, 0};
|
||||||
|
|
||||||
#endif // TEST_H
|
#endif // TEST_H_
|
||||||
|
|
|
@ -15,8 +15,8 @@ tslint = os.path.join(third_party_path, "node_modules", "tslint", "bin",
|
||||||
|
|
||||||
os.chdir(root_path)
|
os.chdir(root_path)
|
||||||
run([
|
run([
|
||||||
"python", cpplint, "--filter=-build/include_subdir", "--repository=src",
|
"python", cpplint, "--filter=-build/include_subdir", "--repository=libdeno",
|
||||||
"--extensions=cc,h", "--recursive", "src/."
|
"--extensions=cc,h", "--recursive", "libdeno"
|
||||||
])
|
])
|
||||||
|
|
||||||
run(["node", tslint, "-p", ".", "--exclude", "**/gen/**/*.ts"])
|
run(["node", tslint, "-p", ".", "--exclude", "**/gen/**/*.ts"])
|
||||||
|
|
Loading…
Reference in a new issue