Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/api/hooks.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,10 +10,10 @@ using v8::HandleScope;
using v8::Integer;
using v8::Isolate;
using v8::Local;
using v8::NewStringType;
using v8::Object;
using v8::String;
using v8::Value;
using v8::NewStringType;

void RunAtExit(Environment* env){
env->RunAtExitCallbacks();
Expand Down
2 changes: 1 addition & 1 deletion src/inspector/main_thread_interface.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,8 +14,8 @@ namespace node{
namespaceinspector{
namespace{

using v8_inspector::StringView;
using v8_inspector::StringBuffer;
using v8_inspector::StringView;

template <typename T>
classDeletableWrapper : publicDeletable{
Expand Down
4 changes: 1 addition & 3 deletions src/node_report.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -43,13 +43,11 @@ using v8::HeapSpaceStatistics;
using v8::HeapStatistics;
using v8::Isolate;
using v8::Local;
using v8::Number;
using v8::Object;
using v8::StackTrace;
using v8::String;
using v8::TryCatch;
using v8::Value;
using v8::V8;
using v8::Value;

namespaceper_process= node::per_process;

Expand Down
1 change: 0 additions & 1 deletion src/quic/node_quic_session.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -43,7 +43,6 @@ using crypto::SecureContext;
using v8::Array;
using v8::ArrayBufferView;
using v8::Context;
using v8::Function;
using v8::FunctionCallbackInfo;
using v8::FunctionTemplate;
using v8::HandleScope;
Expand Down
1 change: 0 additions & 1 deletion src/quic/node_quic_socket.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -29,7 +29,6 @@ using crypto::EntropySource;
using crypto::SecureContext;

using v8::ArrayBufferView;
using v8::Boolean;
using v8::Context;
using v8::FunctionCallbackInfo;
using v8::FunctionTemplate;
Expand Down
2 changes: 0 additions & 2 deletions src/quic/node_quic_socket.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,10 +27,8 @@
namespace node{

using v8::Context;
using v8::FunctionCallbackInfo;
using v8::Local;
using v8::Object;
using v8::Value;

namespace quic{

Expand Down
1 change: 0 additions & 1 deletion test/addons/async-hooks-promise/binding.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,7 +6,6 @@ namespace{
using v8::FunctionCallbackInfo;
using v8::Isolate;
using v8::Local;
using v8::NewStringType;
using v8::Object;
using v8::Promise;
using v8::String;
Expand Down
1 change: 0 additions & 1 deletion test/addons/dlopen-ping-pong/binding.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -17,7 +17,6 @@ using v8::FunctionCallbackInfo;
using v8::Isolate;
using v8::Local;
using v8::Object;
using v8::NewStringType;
using v8::String;
using v8::Value;

Expand Down
3 changes: 0 additions & 3 deletions test/addons/non-node-context/binding.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,12 +5,9 @@
namespace{

using v8::Context;
using v8::Function;
using v8::FunctionTemplate;
using v8::Isolate;
using v8::Local;
using v8::MaybeLocal;
using v8::NewStringType;
using v8::Object;
using v8::Script;
using v8::String;
Expand Down
2 changes: 1 addition & 1 deletion test/addons/repl-domain-abort/binding.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,8 +25,8 @@
using v8::Boolean;
using v8::Function;
using v8::FunctionCallbackInfo;
using v8::Local;
using v8::Isolate;
using v8::Local;
using v8::Object;
using v8::Value;

Expand Down
1 change: 0 additions & 1 deletion test/addons/uv-handle-leak/binding.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,7 +6,6 @@ using v8::Context;
using v8::FunctionCallbackInfo;
using v8::Isolate;
using v8::Local;
using v8::Object;
using v8::Value;

// Give these things names in the public namespace so that we can see
Expand Down
2 changes: 1 addition & 1 deletion test/cctest/test_base64.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,8 +5,8 @@

#include"gtest/gtest.h"

using node::base64_encode;
using node::base64_decode;
using node::base64_encode;

TEST(Base64Test, Encode){
auto test = [](constchar* string, constchar* base64_string){
Expand Down
23 changes: 10 additions & 13 deletions test/cctest/test_util.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,6 +3,16 @@
#include "env-inl.h"
#include "gtest/gtest.h"

using node::Calloc;
using node::Malloc;
using node::MaybeStackBuffer;
using node::SPrintF;
using node::StringEqualNoCase;
using node::StringEqualNoCaseN;
using node::ToLower;
using node::UncheckedCalloc;
using node::UncheckedMalloc;

TEST(UtilTest, ListHead){
struct Item{node::ListNode<Item> node_};
typedef node::ListHead<Item, &Item::node_> List;
Expand DownExpand Up@@ -58,7 +68,6 @@ TEST(UtilTest, ListHead){
}

TEST(UtilTest, StringEqualNoCase){
using node::StringEqualNoCase;
EXPECT_FALSE(StringEqualNoCase("a", "b"));
EXPECT_TRUE(StringEqualNoCase("", ""));
EXPECT_TRUE(StringEqualNoCase("equal", "equal"));
Expand All@@ -69,7 +78,6 @@ TEST(UtilTest, StringEqualNoCase){
}

TEST(UtilTest, StringEqualNoCaseN){
using node::StringEqualNoCaseN;
EXPECT_FALSE(StringEqualNoCaseN("a", "b", strlen("a")));
EXPECT_TRUE(StringEqualNoCaseN("", "", strlen("")));
EXPECT_TRUE(StringEqualNoCaseN("equal", "equal", strlen("equal")));
Expand All@@ -84,7 +92,6 @@ TEST(UtilTest, StringEqualNoCaseN){
}

TEST(UtilTest, ToLower){
using node::ToLower;
EXPECT_EQ('0', ToLower('0'));
EXPECT_EQ('a', ToLower('a'));
EXPECT_EQ('a', ToLower('A'));
Expand All@@ -98,31 +105,27 @@ TEST(UtilTest, ToLower){
} while (0)

TEST(UtilTest, Malloc){
using node::Malloc;
TEST_AND_FREE(Malloc<char>(0));
TEST_AND_FREE(Malloc<char>(1));
TEST_AND_FREE(Malloc(0));
TEST_AND_FREE(Malloc(1));
}

TEST(UtilTest, Calloc){
using node::Calloc;
TEST_AND_FREE(Calloc<char>(0));
TEST_AND_FREE(Calloc<char>(1));
TEST_AND_FREE(Calloc(0));
TEST_AND_FREE(Calloc(1));
}

TEST(UtilTest, UncheckedMalloc){
using node::UncheckedMalloc;
TEST_AND_FREE(UncheckedMalloc<char>(0));
TEST_AND_FREE(UncheckedMalloc<char>(1));
TEST_AND_FREE(UncheckedMalloc(0));
TEST_AND_FREE(UncheckedMalloc(1));
}

TEST(UtilTest, UncheckedCalloc){
using node::UncheckedCalloc;
TEST_AND_FREE(UncheckedCalloc<char>(0));
TEST_AND_FREE(UncheckedCalloc<char>(1));
TEST_AND_FREE(UncheckedCalloc(0));
Expand All@@ -131,8 +134,6 @@ TEST(UtilTest, UncheckedCalloc){

template <typename T>
static void MaybeStackBufferBasic(){
using node::MaybeStackBuffer;

MaybeStackBuffer<T> buf;
size_t old_length;
size_t old_capacity;
Expand DownExpand Up@@ -211,8 +212,6 @@ static void MaybeStackBufferBasic(){
}

TEST(UtilTest, MaybeStackBuffer){
using node::MaybeStackBuffer;

MaybeStackBufferBasic<uint8_t>();
MaybeStackBufferBasic<uint16_t>();

Expand DownExpand Up@@ -254,8 +253,6 @@ TEST(UtilTest, MaybeStackBuffer){
}

TEST(UtilTest, SPrintF){
using node::SPrintF;

// %d, %u and %s all do the same thing. The actual C++ type is used to infer
// the right representation.
EXPECT_EQ(SPrintF("%s", false), "false");
Expand Down
2 changes: 1 addition & 1 deletion test/embedding/embedtest.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,8 +16,8 @@ using v8::Local;
using v8::Locker;
using v8::MaybeLocal;
using v8::SealHandleScope;
using v8::Value;
using v8::V8;
using v8::Value;

staticintRunNodeInstance(MultiIsolatePlatform* platform,
const std::vector<std::string>& args,
Expand Down
11 changes: 8 additions & 3 deletions tools/checkimports.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,7 +5,7 @@
import io
import re
import sys

import itertools

def do_exist(file_name, lines, imported):
if not any(not re.match('using \w+::{0};'.format(imported), line) and
Expand DownExpand Up@@ -41,5 +41,10 @@ def is_valid(file_name):
return valid

if __name__ == '__main__':
files = glob.iglob(sys.argv[1] if len(sys.argv) > 1 else 'src/*.cc')
sys.exit(0 if all(map(is_valid, files)) else 1)
if len(sys.argv) > 1:
files = []
for pattern in sys.argv[1:]:
files = itertools.chain(files, glob.iglob(pattern))
else:
files = glob.iglob('src/*.cc')
sys.exit(0 if all(list(map(is_valid, files))) else 1)