Comparing version 0.0.14 to 0.0.15
@@ -284,6 +284,10 @@ (function(global) { | ||
} | ||
function generatorWrap(generator) { | ||
function generatorWrap(moveNext) { | ||
var ctx = { | ||
state: 0, | ||
GState: 0 | ||
}; | ||
return addIterator({ | ||
next: function(x) { | ||
switch (generator.GState) { | ||
switch (ctx.GState) { | ||
case ST_EXECUTING: | ||
@@ -298,13 +302,16 @@ throw new Error('"next" on executing generator'); | ||
case ST_SUSPENDED: | ||
generator.GState = ST_EXECUTING; | ||
if (generator.moveNext(x, ACTION_SEND)) { | ||
generator.GState = ST_SUSPENDED; | ||
ctx.GState = ST_EXECUTING; | ||
ctx.action = ACTION_SEND; | ||
ctx.sent = x; | ||
var value = moveNext(ctx); | ||
if (value !== ctx) { | ||
ctx.GState = ST_SUSPENDED; | ||
return { | ||
value: generator.current, | ||
value: value, | ||
done: false | ||
}; | ||
} | ||
generator.GState = ST_CLOSED; | ||
ctx.GState = ST_CLOSED; | ||
return { | ||
value: generator.yieldReturn, | ||
value: ctx.returnValue, | ||
done: true | ||
@@ -315,3 +322,3 @@ }; | ||
throw: function(x) { | ||
switch (generator.GState) { | ||
switch (ctx.GState) { | ||
case ST_EXECUTING: | ||
@@ -322,16 +329,19 @@ throw new Error('"throw" on executing generator'); | ||
case ST_NEWBORN: | ||
generator.GState = ST_CLOSED; | ||
ctx.GState = ST_CLOSED; | ||
throw x; | ||
case ST_SUSPENDED: | ||
generator.GState = ST_EXECUTING; | ||
if (generator.moveNext(x, ACTION_THROW)) { | ||
generator.GState = ST_SUSPENDED; | ||
ctx.GState = ST_EXECUTING; | ||
ctx.action = ACTION_THROW; | ||
ctx.sent = x; | ||
var value = moveNext(ctx); | ||
if (value !== ctx) { | ||
ctx.GState = ST_SUSPENDED; | ||
return { | ||
value: generator.current, | ||
value: value, | ||
done: false | ||
}; | ||
} | ||
generator.GState = ST_CLOSED; | ||
ctx.GState = ST_CLOSED; | ||
return { | ||
value: generator.yieldReturn, | ||
value: ctx.returnValue, | ||
done: true | ||
@@ -343,2 +353,28 @@ }; | ||
} | ||
function asyncWrap(moveNext) { | ||
var ctx = { | ||
state: 0, | ||
GState: 0, | ||
createCallback: function(newState) { | ||
return function(value) { | ||
ctx.state = newState; | ||
ctx.value = value; | ||
moveNext(ctx); | ||
}; | ||
}, | ||
createErrback: function(newState) { | ||
return function(err) { | ||
ctx.state = newState; | ||
ctx.err = err; | ||
moveNext(ctx); | ||
}; | ||
} | ||
}; | ||
ctx.result = new Promise(function(resolve, reject) { | ||
ctx.resolve = resolve; | ||
ctx.reject = reject; | ||
}); | ||
moveNext(ctx); | ||
return ctx.result; | ||
} | ||
function setupGlobals(global) { | ||
@@ -350,2 +386,3 @@ global.Symbol = Symbol; | ||
global.$traceurRuntime = { | ||
asyncWrap: asyncWrap, | ||
createClass: createClass, | ||
@@ -599,2 +636,2 @@ defaultSuperCall: defaultSuperCall, | ||
})(typeof global !== 'undefined' ? global: this); | ||
var $__4 = $traceurRuntime.getModuleImpl("traceur@0.0.14/src/runtime/polyfills/polyfills"); | ||
var $__4 = $traceurRuntime.getModuleImpl("traceur@0.0.15/src/runtime/polyfills/polyfills"); |
{ | ||
"name": "traceur", | ||
"version": "0.0.14", | ||
"version": "0.0.15", | ||
"description": "Experimental ES6 to ES5 compiler", | ||
@@ -48,5 +48,5 @@ "keywords": [ | ||
"semver": "2.2.1", | ||
"traceur": "0.0.13" | ||
"traceur": "0.0.14" | ||
}, | ||
"subdomain": "traceur" | ||
} |
@@ -24,3 +24,4 @@ [![Build Status](https://travis-ci.org/google/traceur-compiler.png)](https://travis-ci.org/google/traceur-compiler) | ||
page to get up and running. You can use some language features right now and | ||
even try it out in your browser [here](http://traceur.jit.su:8099/demo/repl.html). | ||
even try it out in your browser | ||
[here](http://google.github.io/traceur-compiler/demo/repl.html). | ||
Just type in some code and see what Traceur produces. For an idea of what is | ||
@@ -27,0 +28,0 @@ available and what we have in the pipeline, see the |
@@ -23,2 +23,4 @@ // Copyright 2013 Traceur Authors. | ||
var ErrorReporter = traceur.util.ErrorReporter; | ||
var AttachModuleNameTransformer = | ||
traceur.codegeneration.AttachModuleNameTransformer; | ||
var FromOptionsTransformer = traceur.codegeneration.FromOptionsTransformer; | ||
@@ -34,3 +36,7 @@ var Parser = traceur.syntax.Parser; | ||
var tree = parser.parseModule(); | ||
var transformer = new FromOptionsTransformer(reporter); | ||
var moduleName = inputFilePath.replace(/\.js$/, ''); | ||
moduleName = path.relative(__dirname, moduleName).replace(/\\/g,'/'); | ||
var transformer = new AttachModuleNameTransformer(moduleName); | ||
tree = transformer.transformAny(tree); | ||
transformer = new FromOptionsTransformer(reporter); | ||
var transformed = transformer.transform(tree); | ||
@@ -37,0 +43,0 @@ |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
943476
23980
40