koffi 1.1.0-beta.2 → 1.1.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koffi",
3
- "version": "1.1.0-beta.2",
3
+ "version": "1.1.0-beta.3",
4
4
  "description": "Fast and simple FFI (foreign function interface) for Node.js",
5
5
  "keywords": [
6
6
  "foreign",
package/src/ffi.cc CHANGED
@@ -539,8 +539,9 @@ static bool ParseClassicFunction(Napi::Env env, Napi::String name, Napi::Value r
539
539
  param.type = ResolveType(instance, parameters[j], &param.directions);
540
540
  if (!param.type)
541
541
  return false;
542
- if (param.type->primitive == PrimitiveKind::Void) {
543
- ThrowError<Napi::TypeError>(env, "Type void cannot be used as a parameter");
542
+ if (param.type->primitive == PrimitiveKind::Void ||
543
+ param.type->primitive == PrimitiveKind::Array) {
544
+ ThrowError<Napi::TypeError>(env, "Type %1 cannot be used as a parameter", param.type->name);
544
545
  return false;
545
546
  }
546
547
 
package/src/parser.cc CHANGED
@@ -36,7 +36,7 @@ bool PrototypeParser::Parse(Napi::String proto, FunctionInfo *func)
36
36
 
37
37
  func->ret.type = ParseType();
38
38
  if (func->ret.type->primitive == PrimitiveKind::Array) {
39
- MarkError("You are not allowed to directly return fixed-size arrays");
39
+ MarkError("You are not allowed to directly return C arrays");
40
40
  return false;
41
41
  }
42
42
  if (Match("__cdecl")) {
@@ -69,8 +69,9 @@ bool PrototypeParser::Parse(Napi::String proto, FunctionInfo *func)
69
69
  }
70
70
 
71
71
  param.type = ParseType();
72
- if (param.type->primitive == PrimitiveKind::Void) {
73
- MarkError("Type void cannot be used as a parameter");
72
+ if (param.type->primitive == PrimitiveKind::Void ||
73
+ param.type->primitive == PrimitiveKind::Array) {
74
+ MarkError("Type %1 cannot be used as a parameter", param.type->name);
74
75
  return false;
75
76
  }
76
77