Comparing version 0.0.32 to 0.0.33
@@ -17,2 +17,5 @@ (function(global) { | ||
var $toString = $Object.prototype.toString; | ||
var $preventExtensions = Object.preventExtensions; | ||
var $seal = Object.seal; | ||
var $isExtensible = Object.isExtensible; | ||
function nonEnum(value) { | ||
@@ -81,3 +84,3 @@ return { | ||
$defineProperty(this, symbolDescriptionProperty, {value: description}); | ||
$freeze(this); | ||
freeze(this); | ||
symbolValues[key] = this; | ||
@@ -94,4 +97,36 @@ } | ||
}); | ||
$freeze(SymbolValue.prototype); | ||
var hashProperty = newUniqueString(); | ||
var hashPropertyDescriptor = {value: undefined}; | ||
var hashObjectProperties = { | ||
hash: {value: undefined}, | ||
self: {value: undefined} | ||
}; | ||
var hashCounter = 0; | ||
function getOwnHashObject(object) { | ||
var hashObject = object[hashProperty]; | ||
if (hashObject && hashObject.self === object) | ||
return hashObject; | ||
if ($isExtensible(object)) { | ||
hashObjectProperties.hash.value = hashCounter++; | ||
hashObjectProperties.self.value = object; | ||
hashPropertyDescriptor.value = $create(null, hashObjectProperties); | ||
$defineProperty(object, hashProperty, hashPropertyDescriptor); | ||
return hashPropertyDescriptor.value; | ||
} | ||
return undefined; | ||
} | ||
function freeze(object) { | ||
getOwnHashObject(object); | ||
return $freeze.apply(this, arguments); | ||
} | ||
function preventExtensions(object) { | ||
getOwnHashObject(object); | ||
return $preventExtensions.apply(this, arguments); | ||
} | ||
function seal(object) { | ||
getOwnHashObject(object); | ||
return $seal.apply(this, arguments); | ||
} | ||
Symbol.iterator = Symbol(); | ||
freeze(SymbolValue.prototype); | ||
function toProperty(name) { | ||
@@ -107,3 +142,3 @@ if (isSymbol(name)) | ||
var name = names[i]; | ||
if (!symbolValues[name]) | ||
if (!symbolValues[name] && name !== hashProperty) | ||
rv.push(name); | ||
@@ -159,2 +194,5 @@ } | ||
$defineProperty(Object.prototype, 'hasOwnProperty', {value: hasOwnProperty}); | ||
$defineProperty(Object, 'freeze', {value: freeze}); | ||
$defineProperty(Object, 'preventExtensions', {value: preventExtensions}); | ||
$defineProperty(Object, 'seal', {value: seal}); | ||
Object.getOwnPropertySymbols = getOwnPropertySymbols; | ||
@@ -172,3 +210,6 @@ function is(left, right) { | ||
for (p = 0; p < length; p++) { | ||
target[props[p]] = source[props[p]]; | ||
var name = props[p]; | ||
if (name === hashProperty) | ||
continue; | ||
target[name] = source[name]; | ||
} | ||
@@ -184,2 +225,5 @@ return target; | ||
for (p = 0; p < length; p++) { | ||
var name = props[p]; | ||
if (name === hashProperty) | ||
continue; | ||
descriptor = $getOwnPropertyDescriptor(source, props[p]); | ||
@@ -196,2 +240,5 @@ $defineProperty(target, props[p], descriptor); | ||
for (var j = 0; j < names.length; j++) { | ||
var name = names[j]; | ||
if (name === hashProperty) | ||
continue; | ||
(function(mod, name) { | ||
@@ -209,7 +256,15 @@ $defineProperty(object, name, { | ||
} | ||
function toObject(value) { | ||
if (value == null) | ||
function isObject(x) { | ||
return x != null && (typeof x === 'object' || typeof x === 'function'); | ||
} | ||
function toObject(x) { | ||
if (x == null) | ||
throw $TypeError(); | ||
return $Object(value); | ||
return $Object(x); | ||
} | ||
function assertObject(x) { | ||
if (!isObject(x)) | ||
throw $TypeError(x + ' is not an Object'); | ||
return x; | ||
} | ||
function spread() { | ||
@@ -385,2 +440,7 @@ var rv = [], | ||
} | ||
}, | ||
handleException: function(ex) { | ||
this.GState = ST_CLOSED; | ||
this.state = END_STATE; | ||
throw ex; | ||
} | ||
@@ -439,5 +499,7 @@ }; | ||
case END_STATE: | ||
return; | ||
this.resolve(this.returnValue); | ||
break; | ||
case RETHROW_STATE: | ||
this.reject(this.storedException); | ||
break; | ||
default: | ||
@@ -447,2 +509,5 @@ this.reject(getInternalError(this.state)); | ||
}; | ||
AsyncFunctionContext.prototype.handleException = function() { | ||
this.state = RETHROW_STATE; | ||
}; | ||
function asyncWrap(innerFunction, self) { | ||
@@ -458,8 +523,5 @@ var moveNext = getMoveNext(innerFunction, self); | ||
}; | ||
ctx.createErrback = function(newState) { | ||
return function(err) { | ||
ctx.state = newState; | ||
ctx.err = err; | ||
moveNext(ctx); | ||
}; | ||
ctx.errback = function(err) { | ||
handleCatch(ctx, err); | ||
moveNext(ctx); | ||
}; | ||
@@ -475,12 +537,3 @@ moveNext(ctx); | ||
} catch (ex) { | ||
ctx.storedException = ex; | ||
var last = ctx.tryStack_[ctx.tryStack_.length - 1]; | ||
if (!last) { | ||
ctx.GState = ST_CLOSED; | ||
ctx.state = END_STATE; | ||
throw ex; | ||
} | ||
ctx.state = last.catch !== undefined ? last.catch : last.finally; | ||
if (last.finallyFallThrough !== undefined) | ||
ctx.finallyFallThrough = last.finallyFallThrough; | ||
handleCatch(ctx, ex); | ||
} | ||
@@ -490,2 +543,13 @@ } | ||
} | ||
function handleCatch(ctx, ex) { | ||
ctx.storedException = ex; | ||
var last = ctx.tryStack_[ctx.tryStack_.length - 1]; | ||
if (!last) { | ||
ctx.handleException(ex); | ||
return; | ||
} | ||
ctx.state = last.catch !== undefined ? last.catch : last.finally; | ||
if (last.finallyFallThrough !== undefined) | ||
ctx.finallyFallThrough = last.finallyFallThrough; | ||
} | ||
function setupGlobals(global) { | ||
@@ -497,2 +561,3 @@ global.Symbol = Symbol; | ||
global.$traceurRuntime = { | ||
assertObject: assertObject, | ||
asyncWrap: asyncWrap, | ||
@@ -512,3 +577,4 @@ createClass: createClass, | ||
type: types, | ||
typeof: typeOf | ||
typeof: typeOf, | ||
getOwnHashObject: getOwnHashObject | ||
}; | ||
@@ -639,3 +705,3 @@ })(typeof global !== 'undefined' ? global : this); | ||
'use strict'; | ||
var $__2 = $traceurRuntime, | ||
var $__2 = $traceurRuntime.assertObject($traceurRuntime), | ||
canonicalizeUrl = $__2.canonicalizeUrl, | ||
@@ -786,5 +852,5 @@ resolveUrl = $__2.resolveUrl, | ||
})(typeof global !== 'undefined' ? global : this); | ||
System.register("traceur-runtime@0.0.32/src/runtime/polyfills/utils", [], function() { | ||
System.register("traceur-runtime@0.0.33/src/runtime/polyfills/utils", [], function() { | ||
"use strict"; | ||
var __moduleName = "traceur-runtime@0.0.32/src/runtime/polyfills/utils"; | ||
var __moduleName = "traceur-runtime@0.0.33/src/runtime/polyfills/utils"; | ||
var toObject = $traceurRuntime.toObject; | ||
@@ -794,2 +860,5 @@ function toUint32(x) { | ||
} | ||
function isObject(x) { | ||
return x && (typeof x === 'object' || typeof x === 'function'); | ||
} | ||
return { | ||
@@ -801,10 +870,13 @@ get toObject() { | ||
return toUint32; | ||
}, | ||
get isObject() { | ||
return isObject; | ||
} | ||
}; | ||
}); | ||
System.register("traceur-runtime@0.0.32/src/runtime/polyfills/ArrayIterator", [], function() { | ||
System.register("traceur-runtime@0.0.33/src/runtime/polyfills/ArrayIterator", [], function() { | ||
"use strict"; | ||
var $__4; | ||
var __moduleName = "traceur-runtime@0.0.32/src/runtime/polyfills/ArrayIterator"; | ||
var $__5 = System.get("traceur-runtime@0.0.32/src/runtime/polyfills/utils"), | ||
var __moduleName = "traceur-runtime@0.0.33/src/runtime/polyfills/ArrayIterator"; | ||
var $__5 = $traceurRuntime.assertObject(System.get("traceur-runtime@0.0.33/src/runtime/polyfills/utils")), | ||
toObject = $__5.toObject, | ||
@@ -883,5 +955,128 @@ toUint32 = $__5.toUint32; | ||
}); | ||
System.register("traceur-runtime@0.0.32/node_modules/rsvp/lib/rsvp/asap", [], function() { | ||
System.register("traceur-runtime@0.0.33/src/runtime/polyfills/Map", [], function() { | ||
"use strict"; | ||
var __moduleName = "traceur-runtime@0.0.32/node_modules/rsvp/lib/rsvp/asap"; | ||
var __moduleName = "traceur-runtime@0.0.33/src/runtime/polyfills/Map"; | ||
var isObject = $traceurRuntime.assertObject(System.get("traceur-runtime@0.0.33/src/runtime/polyfills/utils")).isObject; | ||
var getOwnHashObject = $traceurRuntime.getOwnHashObject; | ||
var $hasOwnProperty = Object.prototype.hasOwnProperty; | ||
var deletedSentinel = {}; | ||
function lookupIndex(map, key) { | ||
if (isObject(key)) { | ||
var hashObject = getOwnHashObject(key); | ||
return hashObject && map.objectIndex_[hashObject.hash]; | ||
} | ||
if (typeof key === 'string') | ||
return map.stringIndex_[key]; | ||
return map.primitiveIndex_[key]; | ||
} | ||
function initMap(map) { | ||
map.entries_ = []; | ||
map.objectIndex_ = Object.create(null); | ||
map.stringIndex_ = Object.create(null); | ||
map.primitiveIndex_ = Object.create(null); | ||
map.deletedCount_ = 0; | ||
} | ||
var Map = function Map() { | ||
var iterable = arguments[0]; | ||
if (!isObject(this)) | ||
throw new TypeError("Constructor Map requires 'new'"); | ||
if ($hasOwnProperty.call(this, 'entries_')) { | ||
throw new TypeError("Map can not be reentrantly initialised"); | ||
} | ||
initMap(this); | ||
if (iterable !== null && iterable !== undefined) { | ||
var iter = iterable[Symbol.iterator]; | ||
if (iter !== undefined) { | ||
for (var $__7 = iterable[Symbol.iterator](), | ||
$__8; !($__8 = $__7.next()).done; ) { | ||
var $__9 = $traceurRuntime.assertObject($__8.value), | ||
key = $__9[0], | ||
value = $__9[1]; | ||
{ | ||
this.set(key, value); | ||
} | ||
} | ||
} | ||
} | ||
}; | ||
($traceurRuntime.createClass)(Map, { | ||
get size() { | ||
return this.entries_.length / 2 - this.deletedCount_; | ||
}, | ||
get: function(key) { | ||
var index = lookupIndex(this, key); | ||
if (index !== undefined) | ||
return this.entries_[index + 1]; | ||
}, | ||
set: function(key, value) { | ||
var objectMode = isObject(key); | ||
var stringMode = typeof key === 'string'; | ||
var index = lookupIndex(this, key); | ||
if (index !== undefined) { | ||
this.entries_[index + 1] = value; | ||
} else { | ||
index = this.entries_.length; | ||
this.entries_[index] = key; | ||
this.entries_[index + 1] = value; | ||
if (objectMode) { | ||
var hashObject = getOwnHashObject(key); | ||
var hash = hashObject.hash; | ||
this.objectIndex_[hash] = index; | ||
} else if (stringMode) { | ||
this.stringIndex_[key] = index; | ||
} else { | ||
this.primitiveIndex_[key] = index; | ||
} | ||
} | ||
return this; | ||
}, | ||
has: function(key) { | ||
return lookupIndex(this, key) !== undefined; | ||
}, | ||
delete: function(key) { | ||
var objectMode = isObject(key); | ||
var stringMode = typeof key === 'string'; | ||
var index; | ||
var hash; | ||
if (objectMode) { | ||
var hashObject = getOwnHashObject(key); | ||
if (hashObject) { | ||
index = this.objectIndex_[hash = hashObject.hash]; | ||
delete this.objectIndex_[hash]; | ||
} | ||
} else if (stringMode) { | ||
index = this.stringIndex_[key]; | ||
delete this.stringIndex_[key]; | ||
} else { | ||
index = this.primitiveIndex_[key]; | ||
delete this.primitiveIndex_[key]; | ||
} | ||
if (index !== undefined) { | ||
this.entries_[index] = deletedSentinel; | ||
this.entries_[index + 1] = undefined; | ||
this.deletedCount_++; | ||
} | ||
}, | ||
clear: function() { | ||
initMap(this); | ||
}, | ||
forEach: function(callbackFn) { | ||
var thisArg = arguments[1]; | ||
for (var i = 0, | ||
len = this.entries_.length; i < len; i += 2) { | ||
var key = this.entries_[i]; | ||
var value = this.entries_[i + 1]; | ||
if (key === deletedSentinel) | ||
continue; | ||
callbackFn.call(thisArg, value, key, this); | ||
} | ||
} | ||
}, {}); | ||
return {get Map() { | ||
return Map; | ||
}}; | ||
}); | ||
System.register("traceur-runtime@0.0.33/node_modules/rsvp/lib/rsvp/asap", [], function() { | ||
"use strict"; | ||
var __moduleName = "traceur-runtime@0.0.33/node_modules/rsvp/lib/rsvp/asap"; | ||
var $__default = function asap(callback, arg) { | ||
@@ -936,16 +1131,19 @@ var length = queue.push([callback, arg]); | ||
}); | ||
System.register("traceur-runtime@0.0.32/src/runtime/polyfills/Promise", [], function() { | ||
System.register("traceur-runtime@0.0.33/src/runtime/polyfills/Promise", [], function() { | ||
"use strict"; | ||
var __moduleName = "traceur-runtime@0.0.32/src/runtime/polyfills/Promise"; | ||
var async = System.get("traceur-runtime@0.0.32/node_modules/rsvp/lib/rsvp/asap").default; | ||
var __moduleName = "traceur-runtime@0.0.33/src/runtime/polyfills/Promise"; | ||
var async = $traceurRuntime.assertObject(System.get("traceur-runtime@0.0.33/node_modules/rsvp/lib/rsvp/asap")).default; | ||
var promiseRaw = {}; | ||
function isPromise(x) { | ||
return x && typeof x === 'object' && x.status_ !== undefined; | ||
} | ||
function idResolveHandler(x) { | ||
return x; | ||
} | ||
function idRejectHandler(x) { | ||
throw x; | ||
} | ||
function chain(promise) { | ||
var onResolve = arguments[1] !== (void 0) ? arguments[1] : (function(x) { | ||
return x; | ||
}); | ||
var onReject = arguments[2] !== (void 0) ? arguments[2] : (function(e) { | ||
throw e; | ||
}); | ||
var onResolve = arguments[1] !== (void 0) ? arguments[1] : idResolveHandler; | ||
var onReject = arguments[2] !== (void 0) ? arguments[2] : idRejectHandler; | ||
var deferred = getDeferred(promise.constructor); | ||
@@ -955,11 +1153,11 @@ switch (promise.status_) { | ||
throw TypeError; | ||
case 'pending': | ||
promise.onResolve_.push([deferred, onResolve]); | ||
promise.onReject_.push([deferred, onReject]); | ||
case 0: | ||
promise.onResolve_.push(onResolve, deferred); | ||
promise.onReject_.push(onReject, deferred); | ||
break; | ||
case 'resolved': | ||
promiseReact(deferred, onResolve, promise.value_); | ||
case +1: | ||
promiseEnqueue(promise.value_, [onResolve, deferred]); | ||
break; | ||
case 'rejected': | ||
promiseReact(deferred, onReject, promise.value_); | ||
case -1: | ||
promiseEnqueue(promise.value_, [onReject, deferred]); | ||
break; | ||
@@ -970,19 +1168,47 @@ } | ||
function getDeferred(C) { | ||
var result = {}; | ||
result.promise = new C((function(resolve, reject) { | ||
result.resolve = resolve; | ||
result.reject = reject; | ||
})); | ||
return result; | ||
if (this === $Promise) { | ||
var promise = promiseInit(new $Promise(promiseRaw)); | ||
return { | ||
promise: promise, | ||
resolve: (function(x) { | ||
promiseResolve(promise, x); | ||
}), | ||
reject: (function(r) { | ||
promiseReject(promise, r); | ||
}) | ||
}; | ||
} else { | ||
var result = {}; | ||
result.promise = new C((function(resolve, reject) { | ||
result.resolve = resolve; | ||
result.reject = reject; | ||
})); | ||
return result; | ||
} | ||
} | ||
function promiseSet(promise, status, value, onResolve, onReject) { | ||
promise.status_ = status; | ||
promise.value_ = value; | ||
promise.onResolve_ = onResolve; | ||
promise.onReject_ = onReject; | ||
return promise; | ||
} | ||
function promiseInit(promise) { | ||
return promiseSet(promise, 0, undefined, [], []); | ||
} | ||
var Promise = function Promise(resolver) { | ||
var $__6 = this; | ||
this.status_ = 'pending'; | ||
this.onResolve_ = []; | ||
this.onReject_ = []; | ||
resolver((function(x) { | ||
promiseResolve($__6, x); | ||
}), (function(r) { | ||
promiseReject($__6, r); | ||
})); | ||
if (resolver === promiseRaw) | ||
return; | ||
if (typeof resolver !== 'function') | ||
throw new TypeError; | ||
var promise = promiseInit(this); | ||
try { | ||
resolver((function(x) { | ||
promiseResolve(promise, x); | ||
}), (function(r) { | ||
promiseReject(promise, r); | ||
})); | ||
} catch (e) { | ||
promiseReject(promise, e); | ||
} | ||
}; | ||
@@ -993,24 +1219,32 @@ ($traceurRuntime.createClass)(Promise, { | ||
}, | ||
then: function() { | ||
var onResolve = arguments[0] !== (void 0) ? arguments[0] : (function(x) { | ||
return x; | ||
}); | ||
var onReject = arguments[1]; | ||
var $__6 = this; | ||
then: function(onResolve, onReject) { | ||
if (typeof onResolve !== 'function') | ||
onResolve = idResolveHandler; | ||
if (typeof onReject !== 'function') | ||
onReject = idRejectHandler; | ||
var that = this; | ||
var constructor = this.constructor; | ||
return chain(this, (function(x) { | ||
return chain(this, function(x) { | ||
x = promiseCoerce(constructor, x); | ||
return x === $__6 ? onReject(new TypeError) : isPromise(x) ? x.then(onResolve, onReject) : onResolve(x); | ||
}), onReject); | ||
return x === that ? onReject(new TypeError) : isPromise(x) ? x.then(onResolve, onReject) : onResolve(x); | ||
}, onReject); | ||
} | ||
}, { | ||
resolve: function(x) { | ||
return new this((function(resolve, reject) { | ||
resolve(x); | ||
})); | ||
if (this === $Promise) { | ||
return promiseSet(new $Promise(promiseRaw), +1, x); | ||
} else { | ||
return new this(function(resolve, reject) { | ||
resolve(x); | ||
}); | ||
} | ||
}, | ||
reject: function(r) { | ||
return new this((function(resolve, reject) { | ||
reject(r); | ||
})); | ||
if (this === $Promise) { | ||
return promiseSet(new $Promise(promiseRaw), -1, r); | ||
} else { | ||
return new this((function(resolve, reject) { | ||
reject(r); | ||
})); | ||
} | ||
}, | ||
@@ -1029,19 +1263,18 @@ cast: function(x) { | ||
var deferred = getDeferred(this); | ||
var count = 0; | ||
var resolutions = []; | ||
try { | ||
for (var i = 0; i < values.length; i++) { | ||
++count; | ||
this.cast(values[i]).then(function(i, x) { | ||
resolutions[i] = x; | ||
if (--count === 0) | ||
deferred.resolve(resolutions); | ||
}.bind(undefined, i), (function(r) { | ||
if (count > 0) | ||
count = 0; | ||
deferred.reject(r); | ||
})); | ||
var count = values.length; | ||
if (count === 0) { | ||
deferred.resolve(resolutions); | ||
} else { | ||
for (var i = 0; i < values.length; i++) { | ||
this.resolve(values[i]).then(function(i, x) { | ||
resolutions[i] = x; | ||
if (--count === 0) | ||
deferred.resolve(resolutions); | ||
}.bind(undefined, i), (function(r) { | ||
deferred.reject(r); | ||
})); | ||
} | ||
} | ||
if (count === 0) | ||
deferred.resolve(resolutions); | ||
} catch (e) { | ||
@@ -1056,3 +1289,3 @@ deferred.reject(e); | ||
for (var i = 0; i < values.length; i++) { | ||
this.cast(values[i]).then((function(x) { | ||
this.resolve(values[i]).then((function(x) { | ||
deferred.resolve(x); | ||
@@ -1069,54 +1302,69 @@ }), (function(r) { | ||
}); | ||
var $Promise = Promise; | ||
var $PromiseReject = $Promise.reject; | ||
function promiseResolve(promise, x) { | ||
promiseDone(promise, 'resolved', x, promise.onResolve_); | ||
promiseDone(promise, +1, x, promise.onResolve_); | ||
} | ||
function promiseReject(promise, r) { | ||
promiseDone(promise, 'rejected', r, promise.onReject_); | ||
promiseDone(promise, -1, r, promise.onReject_); | ||
} | ||
function promiseDone(promise, status, value, reactions) { | ||
if (promise.status_ !== 'pending') | ||
if (promise.status_ !== 0) | ||
return; | ||
for (var i = 0; i < reactions.length; i++) { | ||
promiseReact(reactions[i][0], reactions[i][1], value); | ||
} | ||
promise.status_ = status; | ||
promise.value_ = value; | ||
promise.onResolve_ = promise.onReject_ = undefined; | ||
promiseEnqueue(value, reactions); | ||
promiseSet(promise, status, value); | ||
} | ||
function promiseReact(deferred, handler, x) { | ||
function promiseEnqueue(value, tasks) { | ||
async((function() { | ||
try { | ||
var y = handler(x); | ||
if (y === deferred.promise) | ||
throw new TypeError; | ||
else if (isPromise(y)) | ||
chain(y, deferred.resolve, deferred.reject); | ||
else | ||
deferred.resolve(y); | ||
} catch (e) { | ||
deferred.reject(e); | ||
for (var i = 0; i < tasks.length; i += 2) { | ||
promiseHandle(value, tasks[i], tasks[i + 1]); | ||
} | ||
})); | ||
} | ||
function promiseHandle(value, handler, deferred) { | ||
try { | ||
var result = handler(value); | ||
if (result === deferred.promise) | ||
throw new TypeError; | ||
else if (isPromise(result)) | ||
chain(result, deferred.resolve, deferred.reject); | ||
else | ||
deferred.resolve(result); | ||
} catch (e) { | ||
try { | ||
deferred.reject(e); | ||
} catch (e) {} | ||
} | ||
} | ||
var thenableSymbol = '@@thenable'; | ||
function isObject(x) { | ||
return x && (typeof x === 'object' || typeof x === 'function'); | ||
} | ||
function promiseCoerce(constructor, x) { | ||
if (isPromise(x)) { | ||
return x; | ||
} else if (x && typeof x.then === 'function') { | ||
var p = x[thenableSymbol]; | ||
if (p) { | ||
return p; | ||
} else { | ||
var deferred = getDeferred(constructor); | ||
x[thenableSymbol] = deferred.promise; | ||
try { | ||
x.then(deferred.resolve, deferred.reject); | ||
} catch (e) { | ||
deferred.reject(e); | ||
if (!isPromise(x) && isObject(x)) { | ||
var then; | ||
try { | ||
then = x.then; | ||
} catch (r) { | ||
var promise = $PromiseReject.call(constructor, r); | ||
x[thenableSymbol] = promise; | ||
return promise; | ||
} | ||
if (typeof then === 'function') { | ||
var p = x[thenableSymbol]; | ||
if (p) { | ||
return p; | ||
} else { | ||
var deferred = getDeferred(constructor); | ||
x[thenableSymbol] = deferred.promise; | ||
try { | ||
then.call(x, deferred.resolve, deferred.reject); | ||
} catch (r) { | ||
deferred.reject(r); | ||
} | ||
return deferred.promise; | ||
} | ||
return deferred.promise; | ||
} | ||
} else { | ||
return x; | ||
} | ||
return x; | ||
} | ||
@@ -1127,5 +1375,5 @@ return {get Promise() { | ||
}); | ||
System.register("traceur-runtime@0.0.32/src/runtime/polyfills/String", [], function() { | ||
System.register("traceur-runtime@0.0.33/src/runtime/polyfills/String", [], function() { | ||
"use strict"; | ||
var __moduleName = "traceur-runtime@0.0.32/src/runtime/polyfills/String"; | ||
var __moduleName = "traceur-runtime@0.0.33/src/runtime/polyfills/String"; | ||
var $toString = Object.prototype.toString; | ||
@@ -1299,18 +1547,19 @@ var $indexOf = String.prototype.indexOf; | ||
}); | ||
System.register("traceur-runtime@0.0.32/src/runtime/polyfills/polyfills", [], function() { | ||
System.register("traceur-runtime@0.0.33/src/runtime/polyfills/polyfills", [], function() { | ||
"use strict"; | ||
var __moduleName = "traceur-runtime@0.0.32/src/runtime/polyfills/polyfills"; | ||
var Promise = System.get("traceur-runtime@0.0.32/src/runtime/polyfills/Promise").Promise; | ||
var $__9 = System.get("traceur-runtime@0.0.32/src/runtime/polyfills/String"), | ||
codePointAt = $__9.codePointAt, | ||
contains = $__9.contains, | ||
endsWith = $__9.endsWith, | ||
fromCodePoint = $__9.fromCodePoint, | ||
repeat = $__9.repeat, | ||
raw = $__9.raw, | ||
startsWith = $__9.startsWith; | ||
var $__9 = System.get("traceur-runtime@0.0.32/src/runtime/polyfills/ArrayIterator"), | ||
entries = $__9.entries, | ||
keys = $__9.keys, | ||
values = $__9.values; | ||
var __moduleName = "traceur-runtime@0.0.33/src/runtime/polyfills/polyfills"; | ||
var Map = $traceurRuntime.assertObject(System.get("traceur-runtime@0.0.33/src/runtime/polyfills/Map")).Map; | ||
var Promise = $traceurRuntime.assertObject(System.get("traceur-runtime@0.0.33/src/runtime/polyfills/Promise")).Promise; | ||
var $__12 = $traceurRuntime.assertObject(System.get("traceur-runtime@0.0.33/src/runtime/polyfills/String")), | ||
codePointAt = $__12.codePointAt, | ||
contains = $__12.contains, | ||
endsWith = $__12.endsWith, | ||
fromCodePoint = $__12.fromCodePoint, | ||
repeat = $__12.repeat, | ||
raw = $__12.raw, | ||
startsWith = $__12.startsWith; | ||
var $__12 = $traceurRuntime.assertObject(System.get("traceur-runtime@0.0.33/src/runtime/polyfills/ArrayIterator")), | ||
entries = $__12.entries, | ||
keys = $__12.keys, | ||
values = $__12.values; | ||
function maybeDefineMethod(object, name, value) { | ||
@@ -1337,2 +1586,6 @@ if (!(name in object)) { | ||
} | ||
function polyfillCollections(global) { | ||
if (!global.Map) | ||
global.Map = Map; | ||
} | ||
function polyfillString(String) { | ||
@@ -1355,2 +1608,3 @@ maybeAddFunctions(String.prototype, ['codePointAt', codePointAt, 'contains', contains, 'endsWith', endsWith, 'startsWith', startsWith, 'repeat', repeat]); | ||
polyfillPromise(global); | ||
polyfillCollections(global); | ||
polyfillString(global.String); | ||
@@ -1367,8 +1621,8 @@ polyfillArray(global.Array, global.Symbol); | ||
}); | ||
System.register("traceur-runtime@0.0.32/src/runtime/polyfill-import", [], function() { | ||
System.register("traceur-runtime@0.0.33/src/runtime/polyfill-import", [], function() { | ||
"use strict"; | ||
var __moduleName = "traceur-runtime@0.0.32/src/runtime/polyfill-import"; | ||
var $__11 = System.get("traceur-runtime@0.0.32/src/runtime/polyfills/polyfills"); | ||
var __moduleName = "traceur-runtime@0.0.33/src/runtime/polyfill-import"; | ||
var $__14 = $traceurRuntime.assertObject(System.get("traceur-runtime@0.0.33/src/runtime/polyfills/polyfills")); | ||
return {}; | ||
}); | ||
System.get("traceur-runtime@0.0.32/src/runtime/polyfill-import" + ''); | ||
System.get("traceur-runtime@0.0.33/src/runtime/polyfill-import" + ''); |
{ | ||
"name": "traceur", | ||
"version": "0.0.32", | ||
"version": "0.0.33", | ||
"description": "Experimental ES6 to ES5 compiler", | ||
@@ -48,5 +48,6 @@ "keywords": [ | ||
"semver": "2.2.1", | ||
"traceur": "0.0.31" | ||
"traceur": "0.0.32", | ||
"promises-aplus-tests": "~2.0.4" | ||
}, | ||
"subdomain": "traceur" | ||
} |
@@ -28,2 +28,3 @@ // Copyright 2013 Traceur Authors. | ||
var FromOptionsTransformer = traceur.codegeneration.FromOptionsTransformer; | ||
var PureES6Transformer = traceur.codegeneration.PureES6Transformer; | ||
var Parser = traceur.syntax.Parser; | ||
@@ -62,2 +63,3 @@ var SourceFile = traceur.syntax.SourceFile; | ||
options = merge({ | ||
outputLanguage: 'es5', | ||
modules: 'commonjs', | ||
@@ -80,3 +82,9 @@ filename: '<unknown file>', | ||
tree = transformer.transformAny(tree); | ||
transformer = new FromOptionsTransformer(errorReporter); | ||
if (options.outputLanguage.toLowerCase() === 'es6') { | ||
transformer = new PureES6Transformer(errorReporter); | ||
} else { | ||
transformer = new FromOptionsTransformer(errorReporter); | ||
} | ||
var transformedTree = transformer.transform(tree); | ||
@@ -83,0 +91,0 @@ |
@@ -22,3 +22,2 @@ // Copyright 2012 Traceur Authors. | ||
var ErrorReporter = traceur.util.ErrorReporter; | ||
var TraceurLoader = traceur.runtime.TraceurLoader; | ||
@@ -25,0 +24,0 @@ var LoaderHooks = traceur.runtime.LoaderHooks; |
@@ -26,6 +26,8 @@ // Copyright 2013 Traceur Authors. | ||
fs.readFile(url, 'utf8', function(err, data) { | ||
if (err) | ||
if (err) { | ||
err.message = err.message.replace('ENOENT, open', 'File not found'); | ||
errback(err); | ||
else | ||
} else { | ||
callback(stripShebang(data)); | ||
} | ||
}); | ||
@@ -32,0 +34,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
983767
24909
9