corba.js 0.1.3 → 0.1.6

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/README.md CHANGED
@@ -229,23 +229,22 @@ and deserialize them based on their IDL description:
229
229
  For each valuetype the IDL compiler will generate three variants
230
230
 
231
231
  * _value.ts: the valuetypes as TypeScript interfaces with only the attributes
232
- * _valuetype.ts: the values types as TypeScript interface with attributes and methods
233
- * _valueimpl.ts: the value types as classes with constructors, which can be initialized from JSON data
234
-
235
- The last one will be used by the ORB to convert the received JSON data
236
- into an object.
232
+ * _valuetype.ts: the valuestypes as TypeScript interface with attributes and methods
237
233
 
238
234
  Unlike a pure JSON exchange, corba.js will also instantiate a user specified
239
235
  class to represent the transmitted data, so that the object has methods we
240
236
  can call.
241
237
 
242
- Ie. the Rectangle class contains a method which needs to be implemented to
243
- be able to instantiate it:
238
+ Ie. for this the Rectangle class will need a special constructor:
244
239
 
245
240
  ```javascript
246
- export class Rectangle extends valueimpl.Rectangle {
247
- constructor(rectangle: Partial<valueimpl.Rectangle>) {
248
- super(rectangle)
241
+ import { GIOPDecoder } from "corba.js"
242
+ import * as value from "../myapp_value"
243
+ import * as valuetype from "../myapp_valuetype"
244
+
245
+ export class Rectangle implements valuetype.Rectangle {
246
+ constructor(init?: Partial<value.Rectangle> | GIOPDecoder) {
247
+ value.initRectangle(this, init)
249
248
  }
250
249
  contains(p: Point): boolean {
251
250
  return this.origin.x <= p.x && p.x <= this.origin.x + this.size.width &&
@@ -254,12 +253,12 @@ be able to instantiate it:
254
253
  }
255
254
  ```
256
255
 
257
- After the valuetypes have been registered in the ORB on client and server
256
+ After the valuetype implementations have been registered in the ORB on client and server
258
257
  side
259
258
 
260
259
  ```javascript
261
- ORB.registerValueType("Point", valueimpl.Point)
262
- ORB.registerValueType("Size", valueimpl.Size)
260
+ ORB.registerValueType("Point", Point)
261
+ ORB.registerValueType("Size", Size)
263
262
  ORB.registerValueType("Rectangle", Rectangle)
264
263
  ```
265
264
 
package/lib/idl/idl.cjs CHANGED
@@ -1238,6 +1238,9 @@ function op_dcl() {
1238
1238
  const t3 = parameter_dcls();
1239
1239
  if (t3 === undefined) {
1240
1240
  lexer.unlex(t2);
1241
+ if (t1.child.length != 0) {
1242
+ throw Error("expected parameter declaration after " + t2.toString());
1243
+ }
1241
1244
  lexer.unlex(t1);
1242
1245
  lexer.unlex(t0);
1243
1246
  return undefined;