Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit 673c1ab

Browse files
authored
Merge pull request #122 from ZeGentzy/fixes
Fix builds with newer node.
2 parents df90479 + 97c487b commit 673c1ab

File tree

5 files changed

+64
-53
lines changed

5 files changed

+64
-53
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,4 @@ env:
3232
matrix:
3333
- NODE_VERSION=8.9.3
3434
- NODE_VERSION=10
35+
- NODE_VERSION=12

appveyor.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ environment:
44
- nodejs_version: '10'
55
SPELLCHECKER_PREFER_HUNSPELL: true
66
- nodejs_version: '8'
7-
- nodejs_version: '6'
87

98
install:
109
- ps: Install-Product node $env:nodejs_version

package-lock.json

Lines changed: 49 additions & 48 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@
2020
},
2121
"dependencies": {
2222
"any-promise": "^1.3.0",
23-
"nan": "^2.10.0"
23+
"nan": "^2.14.0"
2424
}
2525
}

src/main.cc

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,11 @@ class Spellchecker : public Nan::ObjectWrap {
7171
}
7272

7373
std::vector<uint16_t> text(string->Length() + 1);
74-
string->Write(reinterpret_cast<uint16_t *>(text.data()));
74+
string->Write(
75+
#if V8_MAJOR_VERSION > 6
76+
info.GetIsolate(),
77+
#endif
78+
reinterpret_cast<uint16_t *>(text.data()));
7579

7680
Spellchecker* that = Nan::ObjectWrap::Unwrap<Spellchecker>(info.Holder());
7781
std::vector<MisspelledRange> misspelled_ranges = that->impl->CheckSpelling(text.data(), text.size());
@@ -102,7 +106,11 @@ class Spellchecker : public Nan::ObjectWrap {
102106
Nan::Callback *callback = new Nan::Callback(info[1].As<Function>());
103107

104108
std::vector<uint16_t> corpus(string->Length() + 1);
105-
string->Write(reinterpret_cast<uint16_t *>(corpus.data()));
109+
string->Write(
110+
#if V8_MAJOR_VERSION > 6
111+
info.GetIsolate(),
112+
#endif
113+
reinterpret_cast<uint16_t *>(corpus.data()));
106114

107115
Spellchecker* that = Nan::ObjectWrap::Unwrap<Spellchecker>(info.Holder());
108116

@@ -207,7 +215,9 @@ class Spellchecker : public Nan::ObjectWrap {
207215
Nan::SetPrototypeMethod(tpl, "add", Spellchecker::Add);
208216
Nan::SetPrototypeMethod(tpl, "remove", Spellchecker::Remove);
209217

210-
exports->Set(Nan::New("Spellchecker").ToLocalChecked(), tpl->GetFunction());
218+
Isolate* isolate = exports->GetIsolate();
219+
Local<Context> context = isolate->GetCurrentContext();
220+
exports->Set(Nan::New("Spellchecker").ToLocalChecked(), tpl->GetFunction(context).ToLocalChecked());
211221
}
212222
};
213223

0 commit comments

Comments
 (0)