Seeing a `yield` keyword show up in `callbacks` runtime with latest version

14 views
Skip to first unread message

anodos

unread,
Jan 22, 2016, 11:48:22 AM1/22/16
to streamline.js
I have some simple code that looks something like this:

'use strict';

var DB = require('./db');
var db = new DB(_);

Note that this is at the very top level of the file (this isn't inside of a function). When using `callbacks` runtime, I get this code generated:

'use strict';

var regeneratorRuntime = typeof require === 'function' ? require('streamline-runtime/lib/callbacks/regenerator') : Streamline.require('streamline-runtime/lib/callbacks/regenerator');

var _streamline = typeof require === 'function' ? require('streamline-runtime/lib/callbacks/runtime') : Streamline.require('streamline-runtime/lib/callbacks/runtime');

...

var DB = require('./db');
var db = yield _streamline['new'](_filename, 8, DB, 0)(true);


I didn't expect to see a `yield` keyword in a callbacks runtime. Is this expected?

Bruno Jouhier

unread,
Jan 22, 2016, 12:36:00 PM1/22/16
to streamline.js
Aargh, disturbing indeed!

OTOH the following is correctly transformed:

    var DB = require('./db');
    var db = new DB(_);
    db.open(_);

So it should not be too difficult to fix. Can you repost as an issue to https://github.com/Sage/streamlinejs and I'll follow up from there.

Bruno

Bruno Jouhier

unread,
Jan 22, 2016, 1:07:02 PM1/22/16
to streamline.js
Was easy to fix: https://github.com/Sage/babel-plugin-streamline/issues/4

I'm going to publish streamline 2.0 this week-end. The fix will be included. 

anodos

unread,
Jan 26, 2016, 7:52:44 AM1/26/16
to streamline.js
Thank you for your incredibly quick response on this!
Reply all
Reply to author
Forward
0 new messages