es6-transpiler
Advanced tools
Comparing version 0.7.14-2 to 0.7.15
@@ -93,2 +93,3 @@ "use strict"; | ||
, {file: 'lib/stats'} | ||
, {file: 'lib/tmpl'} | ||
@@ -95,0 +96,0 @@ ].reduce(prepareFile, []).forEach(function(file) { |
@@ -16,3 +16,3 @@ /*global require*/ | ||
var BUILD_VERSION = '0.7.14-2'; | ||
var BUILD_VERSION = '0.7.15'; | ||
@@ -51,2 +51,3 @@ var fs = require("fs"); | ||
, require("./transpiler/arrayComprehension") | ||
, require("./transpiler/generatorComprehension") | ||
, require("./transpiler/forOf") | ||
@@ -53,0 +54,0 @@ , require("./transpiler/optimiser") |
@@ -169,3 +169,3 @@ /*global require:false*/ | ||
if ( !regExp_flag_u_support ) { | ||
unescapeUnicode = _2853340231404991943253_1_require___lib_unescapeUnicode_js(); | ||
unescapeUnicode = _6918565771409574479198_1_require___lib_unescapeUnicode_js(); | ||
@@ -249,3 +249,3 @@ extendedRegExp["__polyfill__"] = function(convertUnicodeSequence_Map, codePointsRange_Map) { | ||
updateGlobalRegExpProperties = function() {var $D$1;var $D$2; | ||
$D$1 = 0;$D$2 = $RegExp_keys.length;for( var key ; $D$1 < $D$2; ){key = ($RegExp_keys[$D$1++]); | ||
$D$1 = 0;$D$2 = $RegExp_keys.length;for( var key ;$D$1 < $D$2;){key = ($RegExp_keys[$D$1++]); | ||
extendedRegExp[key] = $RegExp[key]; | ||
@@ -318,3 +318,3 @@ };$D$1 = $D$2 = void 0; | ||
}; | ||
var es6unicodeRangeConverter = _2853340231404991943253_2_require___lib_rangeRegenerate_js(); | ||
var es6unicodeRangeConverter = _6918565771409574479198_2_require___lib_rangeRegenerate_js(); | ||
@@ -369,3 +369,3 @@ var unicodeRange = function(str, code11, code12, char1, code21, code22, char2) { | ||
_2853340231404991943253_3_require___String_fromCodePoint_js(); | ||
_6918565771409574479198_3_require___String_fromCodePoint_js(); | ||
var fromCodePoint = String["fromCodePoint"]; | ||
@@ -508,3 +508,3 @@ var charCodeToString = function(charCode) { | ||
_2853340231404991943253_4_require___String__RE_methods_js()(global, $RegExp, updateGlobalRegExpProperties); | ||
_6918565771409574479198_4_require___String__RE_methods_js()(global, $RegExp, updateGlobalRegExpProperties); | ||
} | ||
@@ -515,3 +515,3 @@ } | ||
;function _2853340231404991943253_1_require___lib_unescapeUnicode_js(){var module = {exports: {}};/*global module:False*/ | ||
;function _6918565771409574479198_1_require___lib_unescapeUnicode_js(){var module = {exports: {}};/*global module:False*/ | ||
/*es6-transpiler symbols:false, has-iterators:false, has-generators: false,*/ | ||
@@ -544,3 +544,3 @@ // call require: from RegExp polyfill | ||
;return module.exports}; | ||
;function _2853340231404991943253_2_require___lib_rangeRegenerate_js(){var module = {exports: {}};/*global module:false*/ | ||
;function _6918565771409574479198_2_require___lib_rangeRegenerate_js(){var module = {exports: {}};/*global module:false*/ | ||
/*es6-transpiler symbols:false, has-iterators:false, has-generators: false,*/ | ||
@@ -570,3 +570,3 @@ // call require: from RegExp polyfill | ||
$D$3 = 0;$D$4 = array.length;for ( var item ; $D$3 < $D$4; ){item = (array[$D$3++]); | ||
$D$3 = 0;$D$4 = array.length;for ( var item ;$D$3 < $D$4;){item = (array[$D$3++]); | ||
if (previous != item) { | ||
@@ -646,3 +646,3 @@ result.push(item); | ||
$D$5 = 0;$D$6 = codePoints.length;for( var code ; $D$5 < $D$6; ){code = (codePoints[$D$5++]); | ||
$D$5 = 0;$D$6 = codePoints.length;for( var code ;$D$5 < $D$6;){code = (codePoints[$D$5++]); | ||
if (predict == code) { | ||
@@ -697,3 +697,3 @@ end = code; | ||
$D$7 = 0;$D$8 = codePoints.length;for ( var codePoint ; $D$7 < $D$8; ){codePoint = (codePoints[$D$7++]); | ||
$D$7 = 0;$D$8 = codePoints.length;for ( var codePoint ;$D$7 < $D$8;){codePoint = (codePoints[$D$7++]); | ||
if (codePoint >= 0xD800 && codePoint <= 0xDBFF) { | ||
@@ -757,3 +757,3 @@ // If a high surrogate is followed by a low surrogate, the two code | ||
;return module.exports}; | ||
;function _2853340231404991943253_3_require___String_fromCodePoint_js(){var module = {exports: {}};/*global module:false*/ | ||
;function _6918565771409574479198_3_require___String_fromCodePoint_js(){var module = {exports: {}};/*global module:false*/ | ||
/*es6-transpiler symbols:false, has-iterators:false, has-generators: false*/ | ||
@@ -765,3 +765,3 @@ // call require: from RegExp polyfill | ||
if ( !_String["fromCodePoint"] )_String["fromCodePoint"] = function fromCodePoint() {var SLICE$0 = Array.prototype.slice;var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol.iterator||'@@iterator';function ITER$0(v,f){if(v){if(Array.isArray(v))return f?v.slice():v;var i,r;if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){i=f.call(v);r=[];}else if((v+'')==='[object Generator]'){i=v;r=[];};if(r) {while((f=i['next']()),f['done']!==true)r.push(f['value']);return r;}}throw new Error(v+' is not iterable')};var $D$9;var $D$10;var codePoints = SLICE$0.call(arguments, 0); | ||
if ( !_String["fromCodePoint"] )_String["fromCodePoint"] = function fromCodePoint() {var SLICE$0 = Array.prototype.slice;var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol.iterator||'@@iterator';var S_MARK$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol["__setObjectSetter__"];function ITER$0(v,f){if(v){if(Array.isArray(v))return f?v.slice():v;var i,r;if(S_MARK$0)S_MARK$0(v);if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){i=f.call(v);r=[];}else if((v+'')==='[object Generator]'){i=v;r=[];};if(S_MARK$0)S_MARK$0(void 0);if(r) {while((f=i['next']()),f['done']!==true)r.push(f['value']);return r;}}throw new Error(v+' is not iterable')};var $D$9;var $D$10;var codePoints = SLICE$0.call(arguments, 0); | ||
if ( !codePoints.length ) { | ||
@@ -772,3 +772,3 @@ return ''; | ||
var codeUnits = []; | ||
$D$9 = 0;$D$10 = codePoints.length;for ( var codePoint ; $D$9 < $D$10; ){codePoint = (codePoints[$D$9++]); | ||
$D$9 = 0;$D$10 = codePoints.length;for ( var codePoint ;$D$9 < $D$10;){codePoint = (codePoints[$D$9++]); | ||
codePoint = Number(codePoint); | ||
@@ -794,3 +794,3 @@ | ||
;return module.exports}; | ||
;function _2853340231404991943253_4_require___String__RE_methods_js(){var module = {exports: {}};/*global module*/ | ||
;function _6918565771409574479198_4_require___String__RE_methods_js(){var module = {exports: {}};/*global module*/ | ||
/*es6-transpiler symbols:false, has-iterators:false, has-generators: false*/ | ||
@@ -797,0 +797,0 @@ // call require: from RegExp polyfill |
@@ -33,2 +33,6 @@ "use strict"; | ||
, '::ComprehensionExpression': function(node) { | ||
if ( node.xGenerator === true ) { | ||
return; | ||
} | ||
var blocks = node.blocks | ||
@@ -63,3 +67,3 @@ , body = node.body | ||
replacementObj.before | ||
+ "for(" + replacementObj.loop + ")" | ||
+ "for(;" + replacementObj.check + ";)" | ||
+ "{" + replacementObj.inner | ||
@@ -66,0 +70,0 @@ ); |
@@ -28,8 +28,30 @@ "use strict"; | ||
this.__currentClassName = null; | ||
this.__currentSuperRefName = null; | ||
this.__superRefName = null; | ||
this.__protoRefName = null; | ||
this.__staticRefName = null; | ||
this.__currentAccessors = null; | ||
this.__currentStaticAccessors = null; | ||
this.__currentFirstStaticAccessor = null; | ||
this.__staticPropertiesCount = 0; | ||
this.__protoPropertiesCount = 0; | ||
} | ||
, createNames: function(node) { | ||
// We need only one unique name for the entire file | ||
if( !this.__superRefName ) { | ||
this.__superRefName = core.unique("super", true); | ||
} | ||
if( !this.__protoRefName ) { | ||
this.__protoRefName = core.unique("$proto", true); | ||
} | ||
if( !this.__staticRefName ) { | ||
this.__staticRefName = core.unique("$static", true); | ||
} | ||
this.__DP = core.bubbledVariableDeclaration(node.$scope, "DP", $defineProperty); | ||
this.__MIXIN = core.bubbledVariableDeclaration(node.$scope, "MIXIN", objectMixinBody.replace("${Object_defineProperty}", this.__DP)); | ||
} | ||
, setup: function(alter, ast, options) { | ||
@@ -94,6 +116,3 @@ if( !this.__isInit ) { | ||
{ | ||
if( !this.__currentSuperRefName ) { | ||
// We need only one unique 'super' name for the entire file | ||
this.__currentSuperRefName = core.unique("super", true); | ||
} | ||
this.createNames(node); | ||
@@ -108,3 +127,3 @@ var isClassExpression = node.type === 'ClassExpression' | ||
, currentClassName = nodeId ? nodeId.name : core.unique("constructor", true) | ||
, SUPER_NAME = this.__currentSuperRefName | ||
, SUPER_NAME = this.__superRefName | ||
, useStrictString = node.strictMode ? "" : "\"use strict\";" | ||
@@ -118,5 +137,6 @@ ; | ||
, extendedClassConstructorPostfix | ||
, objectMixinFunctionName | ||
; | ||
var objectMixinFunctionName = this.__MIXIN; | ||
node["$ClassName"] = currentClassName; | ||
@@ -130,5 +150,2 @@ this.__currentClassName = currentClassName; | ||
if( superClass ) { | ||
var Object_defineProperty_name = core.bubbledVariableDeclaration(node.$scope, "DP", $defineProperty); | ||
objectMixinFunctionName = core.bubbledVariableDeclaration(node.$scope, "MIXIN", objectMixinBody.replace("${Object_defineProperty}", Object_defineProperty_name)); | ||
classStr += SUPER_NAME; | ||
@@ -152,2 +169,6 @@ superClass = isIdentifier(superClass) ? superClass.name : this.alter.get(superClass.range[0], superClass.range[1]); | ||
if ( useStrictString ) { | ||
this.alter.replace(node.body.range[0], node.body.range[0] + 1, '{' + useStrictString); | ||
} | ||
this.__currentAccessors = {}; | ||
@@ -172,19 +193,26 @@ this.__currentStaticAccessors = {}; | ||
astQuery.traverse(classConstructor, this.replaceClassMethodSuperInConstructor); | ||
insertAfterBodyBegin_string = useStrictString + insertAfterBodyBegin_string; | ||
if ( insertAfterBodyBegin_string ) { | ||
this.alter.insert(node.body.range[0] + 1, insertAfterBodyBegin_string); | ||
} | ||
} | ||
else { | ||
this.alter.insert( | ||
node.body.range[0] + 1 | ||
, useStrictString + "function " + currentClassName + "() {" | ||
+ (superClass ? SUPER_NAME + ".apply(this, arguments)" : "") | ||
+ "}" + (insertAfterBodyBegin_string || "") + (extendedClassConstructorPostfix || "") | ||
, {before: true} | ||
); | ||
insertAfterBodyBegin_string = "function " + currentClassName + "() {" | ||
+ (superClass ? SUPER_NAME + ".apply(this, arguments)" : "") | ||
+ "}" + (insertAfterBodyBegin_string || "") + (extendedClassConstructorPostfix || ""); | ||
} | ||
var theEndString = '', tmpVars = []; | ||
if ( this.__staticPropertiesCount ) { | ||
theEndString += (objectMixinFunctionName + '(' + currentClassName + ',' + this.__staticRefName + ');') | ||
tmpVars.push(this.__staticRefName); | ||
} | ||
if ( this.__protoPropertiesCount ) { | ||
theEndString += (objectMixinFunctionName + '(' + currentClassName + '.prototype,' + this.__protoRefName + ');') | ||
tmpVars.push(this.__protoRefName); | ||
} | ||
if ( tmpVars.length ) { | ||
insertAfterBodyBegin_string += ('var ' + tmpVars.join('={},') + '={};'); | ||
tmpVars.push('void 0'); | ||
} | ||
theEndString += tmpVars.join('='); | ||
this.alter.insertBefore(node.body.range[0] + 1, insertAfterBodyBegin_string); | ||
if ( staticAccessorsDefinitionString ) { | ||
@@ -198,3 +226,3 @@ this.alter.insertAfter(this.__currentFirstStaticAccessor.range[1], staticAccessorsDefinitionString); | ||
this.alter.insert(node.range[1] - 1, ";return " + currentClassName + ";"); | ||
this.alter.insert(node.range[1] - 1, theEndString + ";return " + currentClassName + ";"); | ||
@@ -207,2 +235,4 @@ this.alter.insert(node.range[1], | ||
this.__currentClassName = null; | ||
this.__staticPropertiesCount = 0; | ||
this.__protoPropertiesCount = 0; | ||
} | ||
@@ -212,3 +242,3 @@ } | ||
, unwrapSuperCall: function unwrapSuperCall(node, calleeNode, isStatic, property, isConstructor) { | ||
var superRefName = this.__currentSuperRefName; | ||
var superRefName = this.__superRefName; | ||
assert(superRefName); | ||
@@ -257,45 +287,73 @@ | ||
var isStatic = this.__currentClassMethodsStatic = node.static; | ||
var isComputed = node.computed; | ||
var nodeKey = node.key; | ||
var keyRange = isComputed ? nodeKey.bracesRange : nodeKey.range; | ||
if( node.kind === "set" || node.kind === "get" ) { | ||
if ( isStatic && !this.__currentFirstStaticAccessor ) { | ||
this.__currentFirstStaticAccessor = node; | ||
} | ||
if ( isComputed ) { | ||
var targetName = isStatic === true ? this.__currentClassName : this.__currentClassName + '.prototype'; | ||
var isLiteral = nodeKey.type == 'Literal'; | ||
assert(isIdentifier(nodeKey) || isLiteral); | ||
// get [<name>]() -> DP$0(<className>.prototype,<name>, | ||
this.alter.replace(node.range[0], nodeKey.bracesRange[0] + 1, this.__DP + '(' + targetName + ','); | ||
this.alter.replace(nodeKey.range[1], nodeKey.bracesRange[1], ',{"' + node.kind + '":function'); | ||
var name; | ||
if ( isLiteral ) { | ||
name = nodeKey.value; | ||
var nodeValue = node.value; | ||
this.alter.insertAfter(nodeValue.range[1], ',"configurable":true,"enumerable":true});'); | ||
} | ||
else { | ||
name = nodeKey.name; | ||
} | ||
else {// TODO:: make is easiest | ||
if ( isStatic && !this.__currentFirstStaticAccessor ) { | ||
this.__currentFirstStaticAccessor = node; | ||
} | ||
var accessor = isStatic === true | ||
? this.__currentStaticAccessors[name] || (this.__currentStaticAccessors[name] = {}) | ||
: this.__currentAccessors[name] || (this.__currentAccessors[name] = {}) | ||
; | ||
var replacement = accessor[node.kind] = core.unique((isStatic ? "static_" : "") + name + "$" + node.kind, true); | ||
var isLiteral = nodeKey.type == 'Literal'; | ||
assert(isIdentifier(nodeKey) || isLiteral); | ||
if ( isLiteral ) { | ||
accessor.raw = nodeKey.raw; | ||
var name; | ||
if ( isLiteral ) { | ||
name = nodeKey.value; | ||
} | ||
else { | ||
name = nodeKey.name; | ||
} | ||
var accessor = isStatic === true | ||
? this.__currentStaticAccessors[name] || (this.__currentStaticAccessors[name] = {}) | ||
: this.__currentAccessors[name] || (this.__currentAccessors[name] = {}) | ||
; | ||
var replacement = accessor[node.kind] = core.unique((isStatic ? "static_" : "") + name + "$" + node.kind, true); | ||
if ( isLiteral ) { | ||
accessor.raw = nodeKey.raw; | ||
} | ||
this.alter.replace(node.range[0], nodeKey.range[1], "function " + replacement); | ||
} | ||
this.alter.replace(node.range[0], nodeKey.range[1], "function " + replacement); | ||
} | ||
else { | ||
if( isStatic === true ) { | ||
// text change 'method(<something>)' => 'ClassName.method(<something>)' | ||
this.alter.replace(node.range[0], nodeKey.range[0], this.__currentClassName + "."); | ||
if ( isStatic ) { | ||
this.__staticPropertiesCount++; | ||
} | ||
else { | ||
// text change 'method(<something>)' => 'ClassName.prototype.method(<something>)' | ||
this.alter.replace(node.range[0], nodeKey.range[0], this.__currentClassName + ".prototype."); | ||
this.__protoPropertiesCount++; | ||
} | ||
// text change 'method(<something>)' => 'method = function(<something>)' | ||
this.alter.insert(nodeKey.range[1], " = function"); | ||
var targetName$0 = isStatic === true ? this.__staticRefName : this.__protoRefName; | ||
if ( isStatic ) { | ||
// text change 'static method(<something>)' => '$static$0.method(<something>)' | ||
// text change 'static [method](<something>)' => '$static$0[method](<something>)' | ||
this.alter.replace(node.range[0], keyRange[0], targetName$0 + (isComputed ? '' : '.')); | ||
} | ||
else { | ||
// text change 'method(<something>)' => '$proto$0.method(<something>)' | ||
// text change '[method](<something>)' => '$proto$0[method](<something>)' | ||
this.alter.insert(node.range[0], targetName$0 + (isComputed ? '' : '.')); | ||
} | ||
// text change 'method(<something>)' => 'method = function(<something>)', '[method](<something>)' => '[method] = function(<something>)' | ||
this.alter.insert(keyRange[1], " = function"); | ||
this.alter.insertBefore(node.range[1], ';', {extend: true}); | ||
} | ||
@@ -337,3 +395,3 @@ | ||
// text change 'super.a(<some>)' => 'super$0.a(<some>)' | ||
this.alter.replace(node.range[0], node.range[1], this.__currentSuperRefName); | ||
this.alter.replace(node.range[0], node.range[1], this.__superRefName); | ||
} | ||
@@ -340,0 +398,0 @@ else if( isClass(node) ) { |
@@ -40,2 +40,26 @@ /*globals require, module*/ | ||
function isExpressionStatement(node) { | ||
var type; | ||
return node && (type = node.type) | ||
&& (type === "ExpressionStatement"); | ||
} | ||
function isLiteral(node) { | ||
var type; | ||
return node && (type = node.type) | ||
&& (type === "Literal"); | ||
} | ||
function isIdentifier(node) { | ||
var type; | ||
return node && (type = node.type) | ||
&& (type === "Identifier"); | ||
} | ||
function isProperty(node) { | ||
var type; | ||
return node && (type = node.type) | ||
&& (type === "Property"); | ||
} | ||
function isNonFunctionBlock(node) { | ||
@@ -61,3 +85,3 @@ return node && node.type === "BlockStatement" && !isFunction(node.$parent); | ||
&& !(parentType === "MemberExpression" && parent.computed === false && parent.property === node) // obj.$ | ||
&& !(parentType === "Property" && parent.key === node) // {$: ...} | ||
&& !(parentType === "Property" && parent.key === node && parent.computed === false) // {$: ...} not the {[$]: ...} | ||
&& !(parentType === "LabeledStatement" && parent.label === node) // $: ... | ||
@@ -255,2 +279,5 @@ && !(parentType === "CatchClause" && parent.param === node) // catch($) | ||
// TODO:: refactor/redesign this function | ||
if( method.computed ) { | ||
return; | ||
} | ||
@@ -269,3 +296,7 @@ var type = method.type; | ||
// method.kind ca be 'get', 'set', '' | ||
node.$scope.add(this.getKeyName(method.key), xSpecialNode ? "var" : (method.kind || "fun"), method.value); | ||
var name = this.getKeyName(method.key); | ||
if ( !node.$scope.hasOwn(name) ) { | ||
node.$scope.add(name, xSpecialNode ? "var" : (method.kind || "fun"), method.value); | ||
} | ||
}, this); | ||
@@ -638,14 +669,24 @@ | ||
, PropertyToString: function PropertyToString(node) { | ||
assert(node.type === "Literal" || node.type === "Identifier"); | ||
, PropertyToString: function(node) { | ||
var isParentComputedProperty = node && isProperty(node.$parentNode) && node.$parentNode.computed; | ||
var result; | ||
if( node.type === "Literal" ) { | ||
result = "[" + node.raw + "]"; | ||
if ( isParentComputedProperty ) { | ||
return "[" + this.alter.get(node.range[0], node.range[1]) + "]"; | ||
} | ||
else { | ||
result = "." + node.name; | ||
var isPrimitive = isLiteral(node) || isIdentifier(node); | ||
if ( isPrimitive ) { | ||
var result; | ||
if( node.type === "Literal" ) { | ||
result = "[" + node.raw + "]"; | ||
} | ||
else { | ||
result = "." + node.name; | ||
} | ||
return result; | ||
} | ||
return result | ||
assert(false); | ||
} | ||
@@ -773,4 +814,31 @@ | ||
var findUseStrictBlock = function(node) { | ||
if ( isExpressionStatement(node.body[0]) | ||
&& isLiteral(node.body[0].expression) | ||
&& node.body[0].expression.value === 'use strict' | ||
) { | ||
return node.body[0]; | ||
} | ||
}; | ||
if ( node.type === "Program" ) { | ||
begin = 0; | ||
var useStrictBlock = findUseStrictBlock(node); | ||
if ( useStrictBlock ) { | ||
var blockEnd = useStrictBlock.range[1]; | ||
begin = useStrictBlock.expression.range[1]; | ||
if ( !useStrictBlock.$new_semi ) { | ||
if ( !this.alter.getRange(begin, blockEnd).contains(';') ) { | ||
useStrictBlock.$new_semi = true; | ||
this.alter.insertBefore(begin, ';', {extend: true}); | ||
} | ||
else { | ||
begin = blockEnd; | ||
} | ||
} | ||
} | ||
else { | ||
begin = 0; | ||
} | ||
} | ||
@@ -782,4 +850,21 @@ else if( node.type === "ClassDeclaration" || node.type === "ClassExpression" ) { | ||
var isNakedFunction = node.expression === true; | ||
var useStrictBlock$0 = !isNakedFunction && isBlock(node.body) && findUseStrictBlock(node.body); | ||
begin = hoistScopeNodeBody.range[0] + (isNakedFunction ? 0 : 1); | ||
if ( useStrictBlock$0 ) { | ||
var blockEnd$0 = useStrictBlock$0.range[1]; | ||
begin = useStrictBlock$0.expression.range[1]; | ||
if ( !useStrictBlock$0.$new_semi ) { | ||
if ( !this.alter.getRange(begin, blockEnd$0).contains(';') ) { | ||
useStrictBlock$0.$new_semi = true; | ||
this.alter.insertBefore(begin, ';', {extend: true}); | ||
} | ||
else { | ||
begin = blockEnd$0; | ||
} | ||
} | ||
} | ||
else { | ||
begin = hoistScopeNodeBody.range[0] + (isNakedFunction ? 0 : 1); | ||
} | ||
} | ||
@@ -1018,3 +1103,3 @@ else if( node.type === "ComprehensionExpression" ) { | ||
if( bubbledVariable && bubbledVariable.value === variableInitValue ) { | ||
if( bubbledVariable && bubbledVariable.testValue === variableInitValue ) { | ||
return bubbledVariable; | ||
@@ -1036,5 +1121,6 @@ } | ||
var name = core.unique(variableName, true); | ||
var testValue = variableInitValue; | ||
if( variableNamePlaceholder ) { | ||
variableInitValue = variableInitValue.replace(new RegExp(variableNamePlaceholder, "g"), name); | ||
variableInitValue = variableInitValue.replace(new RegExp(variableNamePlaceholder.replace(/([\$\^\&\[\]\(\)\-])/g, '\\$1'), "g"), name); | ||
} | ||
@@ -1044,2 +1130,3 @@ | ||
name: name | ||
, testValue: testValue | ||
, value: variableInitValue | ||
@@ -1298,3 +1385,2 @@ , isFunction: isFunction | ||
else { | ||
// console.log(from, to, options, parentScope.options) | ||
computedOptions.unshift.apply(computedOptions, options.filter(function(record) { | ||
@@ -1352,2 +1438,20 @@ --commentOptionsCount; | ||
} | ||
, __printNode: function(node) { | ||
function hideSpecialProperties(node, deep) { | ||
for ( var prop in node ) if ( node.hasOwnProperty(prop) ) { | ||
if ( deep < 5 && node[prop] && typeof node[prop] === 'object' ) { | ||
hideSpecialProperties(node, deep + 1); | ||
} | ||
if ( prop.charAt(0) === '$' ) { | ||
Object.defineProperty(node, prop, {enumerable: false}); | ||
} | ||
} | ||
} | ||
hideSpecialProperties(node, 0); | ||
console.log(node); | ||
} | ||
}; | ||
@@ -1354,0 +1458,0 @@ |
@@ -329,3 +329,3 @@ "use strict"; | ||
"type": "MemberExpression", | ||
"computed": false, | ||
"computed": element.computed, | ||
"object": { | ||
@@ -332,0 +332,0 @@ "type": "Identifier", |
@@ -18,3 +18,33 @@ "use strict"; | ||
var SymbolIteratorBody = "typeof Symbol!=='undefined'&&Symbol.iterator||'@@iterator'"; | ||
function isFunction(node) { | ||
var type; | ||
return node && (type = node.type) | ||
&& type === "FunctionDeclaration" || type === "FunctionExpression" || type === "ArrowFunctionExpression"; | ||
} | ||
function isBlock(node) { | ||
var type; | ||
return node && (type = node.type) | ||
&& (type === "BlockStatement"); | ||
} | ||
function isIf(node) { | ||
var type; | ||
return node && (type = node.type) | ||
&& (type === "IfStatement"); | ||
} | ||
function isLoop(node) { | ||
var type; | ||
return node && ((type = node.type) === "ForStatement" || type === "ForInStatement" || type === "ForOfStatement" || type === "WhileStatement" || type === "DoWhileStatement"); | ||
} | ||
function isEmptyBody(node) { | ||
var bodyNode = node && node.body; | ||
return bodyNode && !(!isBlock(bodyNode) || bodyNode.body.length); | ||
} | ||
var SymbolIteratorBody = "typeof Symbol!=='undefined'&&Symbol&&Symbol.iterator||'@@iterator'"; | ||
var SymbolPolyfillMarkBody = "typeof Symbol!=='undefined'&&Symbol&&Symbol[\"__setObjectSetter__\"]"; | ||
var getIteratorBody = | ||
@@ -25,3 +55,5 @@ "(v){" + | ||
"var f;" + | ||
"if(typeof v==='object'&&typeof (f=v[${Symbol_iterator}])==='function')return f.call(v);" + | ||
"if(${Symbol_mark})${Symbol_mark}(v);" + | ||
"if(typeof v==='object'&&typeof (f=v[${Symbol_iterator}])==='function'){if(${Symbol_mark})${Symbol_mark}(void 0);return f.call(v);}" + | ||
"if(${Symbol_mark})${Symbol_mark}(void 0);" + | ||
"if((v+'')==='[object Generator]')return v;" + | ||
@@ -58,9 +90,50 @@ "}" + | ||
var replacementObj = this.createForOfReplacement(node, node.body, true); | ||
var replacementObj = this.createForOfReplacement(node, node.body, {cleanup: true}); | ||
var previousBlockNode = node, parent = node.$parentNode; | ||
while ( (previousBlockNode = previousBlockNode.$previousElementSibling) && previousBlockNode != parent ) { | ||
if ( isFunction(previousBlockNode) || isLoop(previousBlockNode) || isIf(previousBlockNode) ) { | ||
break; | ||
} | ||
} | ||
if ( isFunction(previousBlockNode) || isLoop(previousBlockNode) ) { | ||
previousBlockNode = previousBlockNode.body; | ||
} | ||
else if ( isIf(previousBlockNode) ) { | ||
previousBlockNode = previousBlockNode.consequent; | ||
} | ||
else { | ||
previousBlockNode = void 0; | ||
} | ||
if ( previousBlockNode && !isBlock(previousBlockNode) && !previousBlockNode.$isBlock ) { | ||
previousBlockNode.$isBlock = true; | ||
this.alter.insertBefore(previousBlockNode.range[0], '{'); | ||
this.alter.insert(previousBlockNode.range[1], '}'); | ||
} | ||
if ( !hasBlock ) { | ||
node.body.$isBlock = true; | ||
} | ||
this.alter.insert(//before for of | ||
node.range[0] | ||
, replacementObj.before | ||
, {extend: true, applyChanges: true} | ||
, {applyChanges: true, "__newTransitionalSubLogic":true} | ||
); | ||
var from = node.left.range[1] + 1 | ||
, to = insertHeadPosition - (hasBlock ? 1 : 0)//just before { | ||
; | ||
var lineBreaks = !hasBlock && this.alter.getRange(from, to).match(/[\r\n]/g) || []; | ||
//instead for of declaration body: for(var a of b) -> for(var a <forOfString>) | ||
this.alter.remove(from, to); | ||
if ( to < insertHeadPosition) { | ||
this.alter.insertAfter(to, ";" + replacementObj.check + ";)" + lineBreaks.join("")); | ||
} | ||
else { | ||
this.alter.insertBefore(to, ";" + replacementObj.check + ";)" + lineBreaks.join("")); | ||
} | ||
this.alter.insertBefore(//after for of body begin, but before any other insert (loop closure function start, for example) | ||
@@ -70,8 +143,9 @@ insertHeadPosition | ||
); | ||
this.alter.insertAfter(//after for of | ||
node.range[1] | ||
this.alter.insert(//after for of | ||
node.body.range[1] | ||
, (hasBlock ? "" : "}") + replacementObj.after | ||
, {extend: true} | ||
); | ||
this.alter.setState("replaceForOf"); | ||
// TODO:: StringAlter has a bug with {applyChanges: true, "__newTransitionalSubLogic":true}: the remove below does affect the result of alter.get | ||
this.alter.setState("replaceForOf");//TODO:: remove setState | ||
if( replacementObj.remove ) { | ||
@@ -84,19 +158,12 @@ // remove 'var {des, truc, turing}' from for(var {des, truc, turing} of something){ } | ||
} | ||
this.alter.restoreState();//TODO:: remove restoreState | ||
} | ||
var from = node.left.range[1] + 1 | ||
, to = insertHeadPosition - (hasBlock ? 1 : 0)//just before { | ||
; | ||
var lineBreaks = !hasBlock && this.alter.getRange(from, to).match(/[\r\n]/g) || []; | ||
, createForOfReplacement: function(node, bodyNode, options) { | ||
options = options || {}; | ||
this.alter.replace(//instead for of declaration body: for(var a of b) -> for(var a <forOfString>) | ||
from | ||
, to | ||
, replacementObj.loop + ")" + lineBreaks.join("") | ||
); | ||
this.alter.restoreState(); | ||
} | ||
, createForOfReplacement: function(node, bodyNode, needTemporaryVariableCleaning) { | ||
var scopeOptions = core.getScopeOptions(node.$scope, node); | ||
var needIteratorSupport = scopeOptions['has-iterators'] !== false || scopeOptions['has-generators'] !== false; | ||
var needTemporaryVariableCleaning = options.cleanup; | ||
var implicitDeclaration = options.implicitDeclaration; | ||
@@ -106,3 +173,11 @@ var getIteratorFunctionName; | ||
var Symbol_iterator = core.bubbledVariableDeclaration(node.$scope, "S_ITER", SymbolIteratorBody); | ||
getIteratorFunctionName = core.bubbledVariableDeclaration(node.$scope, "GET_ITER", getIteratorBody.replace("${Symbol_iterator}", Symbol_iterator), true); | ||
var Symbol_mark = core.bubbledVariableDeclaration(node.$scope, "S_MARK", SymbolPolyfillMarkBody); | ||
getIteratorFunctionName = core.bubbledVariableDeclaration( | ||
node.$scope | ||
, "GET_ITER" | ||
, getIteratorBody | ||
.replace("${Symbol_iterator}", Symbol_iterator) | ||
.replace(/\$\{Symbol_mark\}/g, Symbol_mark) | ||
, true | ||
); | ||
} | ||
@@ -161,4 +236,4 @@ else { | ||
else { | ||
beforeBeginString += (tempVars[3] + " = (" + this.alter.get(variableInit.range[0], variableInit.range[1]) + ");"); | ||
variableInitString = tempVars[3]; | ||
beforeBeginString += (tempVars[tempVars.length - 1] + " = (" + this.alter.get(variableInit.range[0], variableInit.range[1]) + ");"); | ||
variableInitString = tempVars[tempVars.length - 1]; | ||
} | ||
@@ -169,3 +244,4 @@ | ||
, initString | ||
, afterString = ";" + (needTemporaryVariableCleaning ? (tempVars.join(" = ") + " = void 0;") : "")//cleanup string | ||
, afterString = (needTemporaryVariableCleaning ? (tempVars.join(" = ") + " = void 0;") : "")//cleanup string | ||
, varsDeclaration = '' | ||
; | ||
@@ -182,3 +258,3 @@ | ||
forOfString = | ||
"; " + tempVars[2] + " ? (" + tempVars[0] + " < " + tempVars[1] + ") : !(" + tempVars[1] + " = " + tempVars[0] + "[\"next\"]())[\"done\"]; "; | ||
tempVars[2] + " ? (" + tempVars[0] + " < " + tempVars[1] + ") : !(" + tempVars[1] + " = " + tempVars[0] + "[\"next\"]())[\"done\"]"; | ||
@@ -195,3 +271,3 @@ initString = | ||
forOfString = | ||
"; " + tempVars[0] + " < " + tempVars[1] + "; "; | ||
tempVars[0] + " < " + tempVars[1]; | ||
@@ -205,3 +281,3 @@ initString = | ||
var newDefinitions = []; | ||
innerString = ";" + ( | ||
innerString = ( | ||
destructuring.unwrapDestructuring("var", variableId, variableInit, null, newDefinitions) + ";" | ||
@@ -212,4 +288,20 @@ ).substr(4);//remove "var " | ||
beforeBeginString = "var " + newDefinitions.map(function(a){ return a.id.name }).join(", ") + ";" + beforeBeginString; | ||
var varInit = variableBlock.kind == 'let' ? '=void 0' : ''; | ||
var varsDecls = newDefinitions.map(function(a){ return a.id.name + varInit }); | ||
if ( implicitDeclaration ) { | ||
varsDeclaration += ('var ' + newDefinitions.map(function(a){ return a.id.name }).join(', ') + ';'); | ||
if ( varInit ) { | ||
beforeBeginString = varsDecls.join(';') + ';' + beforeBeginString; | ||
} | ||
} | ||
else { | ||
beforeBeginString = 'var ' + varsDecls.join(', ') + ';' + beforeBeginString; | ||
} | ||
if ( varInit ) { | ||
afterString += (varsDecls.join(';') + ';'); | ||
} | ||
delete variableInit["$raw"]; | ||
@@ -227,6 +319,7 @@ } | ||
before: beforeBeginString | ||
, loop: forOfString | ||
, inner: innerString | ||
, after: afterString | ||
, check: forOfString | ||
, inner: innerString// + ',' + (isEmptyBody(node) ? 'null' : '') | ||
, after: afterString ? ';' + afterString : '' | ||
, remove: variableIdIsDestructuring ? variableBlock.range : void 0 | ||
, declarations: varsDeclaration | ||
} | ||
@@ -233,0 +326,0 @@ } |
@@ -49,3 +49,3 @@ "use strict"; | ||
&& !(parentType === "MemberExpression" && parent.computed === false && parent.property === node) // obj.$ | ||
&& !(parentType === "Property" && parent.key === node) // {$: ...} | ||
&& !(parentType === "Property" && parent.key === node && parent.computed === false) // {$: ...} not the {[$]: ...} | ||
&& !(parentType === "LabeledStatement" && parent.label === node) // $: ... | ||
@@ -308,3 +308,5 @@ && !(parentType === "CatchClause" && parent.param === node) // catch($) | ||
funcCallResult = ";var " + name$1 + ", " + recipient + " = "; | ||
beforeHead += ";var " + name$1 + ";"; | ||
funcCallResult = ";var " + recipient + " = "; | ||
if ( argTypeIsPrimitive ) { | ||
@@ -350,3 +352,6 @@ result = "if(" + name$1 + "===true){" + name$1 + "=void 0;" + keys.exitPoint + " " + recipient + "}"; | ||
this.alter.insertAfter(core.__getNodeBegin(hoistScopeNode), ";var " + name$3 + "=" + keys$0.varName + ";"); | ||
if ( !hoistScopeNode['$__has__' + name$3] ) { | ||
hoistScopeNode['$__has__' + name$3] = true; | ||
this.alter.insertAfter(core.__getNodeBegin(hoistScopeNode), ";var " + name$3 + "=" + keys$0.varName + ";"); | ||
} | ||
} | ||
@@ -386,3 +391,3 @@ | ||
fragmentOption.afterTail = afterTail; | ||
fragmentOption.beforeHead = beforeHead.replace(/;;/g, ";") + funcCallResult; | ||
fragmentOption.beforeHead = (beforeHead + funcCallResult).replace(/;;/g, ";"); | ||
@@ -389,0 +394,0 @@ this.alter.insert(insertHeadPosition, "--head--", fragmentOption); |
@@ -17,2 +17,25 @@ "use strict"; | ||
function isLiteral(node) { | ||
var type; | ||
return node && (type = node.type) | ||
&& (type === "Literal"); | ||
} | ||
var $defineProperty = "Object.defineProperty"; | ||
var $defineProperties = "Object.defineProperties"; | ||
var $GOPDS_P = "Object.getOwnPropertyDescriptors||function(o){" + | ||
"var d=Object.create(null);" + | ||
"for(var p in o)if(o.hasOwnProperty(p)){" + | ||
"d[p]={\"value\":o[p],\"enumerable\":true,\"configurable\":true,\"writable\":true};" + | ||
"}" + | ||
"return d;" + | ||
"}"; | ||
var $GOPDS_A = "function(o){" + | ||
"var d=Object.create(null);" + | ||
"for(var p in o)if(o.hasOwnProperty(p)){" + | ||
"d[p]=o[p];" + | ||
"}" + | ||
"return d;" + | ||
"}"; | ||
var plugin = module.exports = { | ||
@@ -53,2 +76,176 @@ reset: function() { | ||
} | ||
, '::Property[computed=true]': function(node) {//':: !:not(ObjectPattern,ArrayPattern) > Property[computed=true]' | ||
var parent = node.$parent; | ||
if( !isArrayPattern(parent) && !isObjectPattern(parent)//filter destructuring | ||
&& !parent.$uncomputed | ||
) { | ||
parent.$uncomputed = true; | ||
assert(parent.type === 'ObjectExpression'); | ||
this.replaceComputedProperties(parent); | ||
} | ||
} | ||
, replaceComputedProperties: function(node) { | ||
var properties = node.properties; | ||
var beforeString = ''; | ||
var endFragment = '}'; | ||
var computedReplacementStarted = false; | ||
var Object_defineProperty_name; | ||
var Object_defineProperties_name; | ||
var $GOPDS_P_name; | ||
var $GOPDS_A_name; | ||
var objectOpened = ''; | ||
var _this = this; | ||
function closeOpenTag(prevProperty) { | ||
if ( prevProperty ) { | ||
_this.alter.insertAfter(prevProperty.range[1], endFragment, {extend: true}); | ||
} | ||
else { | ||
objectOpened = '},'; | ||
} | ||
} | ||
var property = null, prevProperty; | ||
for ( var i = 0, len = properties.length ; i < len ; i++ ) { | ||
prevProperty = property; | ||
property = properties[i]; | ||
var isComputed = property.computed; | ||
if ( property.kind === 'get' || property.kind === 'set' ) { | ||
if ( property.$objectLiteral_pass ) { | ||
continue; | ||
} | ||
var expectedNextKind = property.kind === 'set' ? 'get' : 'set'; | ||
var nextAccessor = !isComputed && properties[i + 1]; | ||
if ( nextAccessor ) { | ||
if ( nextAccessor.computed || nextAccessor.kind !== expectedNextKind ) { | ||
nextAccessor = void 0; | ||
} | ||
} | ||
if ( nextAccessor ) { | ||
nextAccessor.$objectLiteral_pass = true; | ||
} | ||
closeOpenTag(prevProperty); | ||
if ( isComputed ) { | ||
computedReplacementStarted = true; | ||
if ( !Object_defineProperty_name ) { | ||
Object_defineProperty_name = core.bubbledVariableDeclaration(node.$scope, "DP", $defineProperty); | ||
} | ||
beforeString = Object_defineProperty_name + '(' + beforeString; | ||
} | ||
else { | ||
if ( !Object_defineProperties_name ) { | ||
Object_defineProperties_name = core.bubbledVariableDeclaration(node.$scope, "DPS", $defineProperties); | ||
} | ||
beforeString = Object_defineProperties_name + '(' + beforeString; | ||
if ( !$GOPDS_A_name ) { | ||
$GOPDS_A_name = core.bubbledVariableDeclaration(node.$scope, "GOPDS_A", $GOPDS_A); | ||
} | ||
this.alter.insertBefore(property.range[0], $GOPDS_A_name + '({'); | ||
} | ||
var propKey = property.key; | ||
this.alter.remove(property.range[0], propKey.range[0]);//remove 'set ' or 'get ', or 'set [' or 'get [' | ||
if ( isComputed === true ) { | ||
this.alter.remove(propKey.bracesRange[1] - 1, propKey.bracesRange[1]);//remove ']' | ||
} | ||
this.alter.insertBefore(propKey.range[1], (isComputed ? ',' : ':') + '{"' + property.kind + '":function'); | ||
if ( nextAccessor ) { | ||
var nextAccessorKey = nextAccessor.key; | ||
this.alter.remove(nextAccessor.range[0], nextAccessorKey.range[1]);//remove 'set <name>' or 'get <name>', or 'set [<name>' or 'get [<name>' | ||
if ( nextAccessor.computed === true ) { | ||
this.alter.remove(nextAccessorKey.bracesRange[1] - 1, nextAccessorKey.bracesRange[1]);//remove ']' | ||
} | ||
this.alter.insertBefore(nextAccessorKey.range[1], '"' + nextAccessor.kind + '":function'); | ||
this.alter.insert(nextAccessor.range[1], ',"configurable":true,"enumerable":true}'); | ||
} | ||
else { | ||
var propValue = property.value; | ||
this.alter.insert(propValue.range[1], ',"configurable":true,"enumerable":true}'); | ||
} | ||
endFragment = isComputed ? ')' : '}))'; | ||
} | ||
else if ( isComputed || (computedReplacementStarted && isLiteral(property.key)) ) { | ||
computedReplacementStarted = true; | ||
if ( !Object_defineProperty_name ) { | ||
Object_defineProperty_name = core.bubbledVariableDeclaration(node.$scope, "DP", $defineProperty); | ||
} | ||
beforeString = Object_defineProperty_name + '(' + beforeString; | ||
var propKey$0 = property.key; | ||
if ( isComputed ) { | ||
this.alter.remove(propKey$0.bracesRange[0], propKey$0.bracesRange[0] + 1);//remove '[' | ||
this.alter.remove(propKey$0.bracesRange[1] - 1, propKey$0.bracesRange[1]);//remove ']' | ||
} | ||
else { | ||
property.$literal = true; | ||
} | ||
this.alter.insertBefore(propKey$0.range[1], ',{"value"'); | ||
var propValue$0 = property.value; | ||
this.alter.insert(propValue$0.range[1], ',"configurable":true,"enumerable":true,"writable":true}'); | ||
closeOpenTag(prevProperty); | ||
endFragment = ')'; | ||
} | ||
else if ( computedReplacementStarted ) { | ||
if ( !Object_defineProperties_name ) { | ||
Object_defineProperties_name = core.bubbledVariableDeclaration(node.$scope, "DPS", $defineProperties); | ||
} | ||
beforeString = Object_defineProperties_name + '(' + beforeString; | ||
closeOpenTag(prevProperty); | ||
if ( !$GOPDS_P_name ) { | ||
$GOPDS_P_name = core.bubbledVariableDeclaration(node.$scope, "GOPDS_P", $GOPDS_P); | ||
} | ||
this.alter.insertBefore(property.range[0], $GOPDS_P_name + '({', {extend: true}); | ||
endFragment = '}))'; | ||
computedReplacementStarted = false; | ||
} | ||
} | ||
if ( beforeString ) { | ||
if ( endFragment === '}))' ) { | ||
endFragment = '))'; | ||
} | ||
if ( property.computed === true || property.$literal === true ) {// lastProperty | ||
this.alter.replace(node.range[1] - 1, node.range[1], endFragment, {extend: true});//replace '}' | ||
} | ||
else { | ||
this.alter.insertBefore(node.range[1], endFragment, {extend: true}); | ||
} | ||
this.alter.insertBefore(node.range[0], beforeString, {extend: true}); | ||
if ( objectOpened ) { | ||
this.alter.insert(node.range[0] + 1, objectOpened); | ||
} | ||
} | ||
} | ||
}; | ||
@@ -55,0 +252,0 @@ |
@@ -7,16 +7,8 @@ /*globals module,require*/ | ||
var error = require("./../lib/error"); | ||
var tmpl = require("./../lib/tmpl"); | ||
var core = require("./core"); | ||
var unicode = require("./unicode"); | ||
function generateUUID() { | ||
var d = new Date().getTime(); | ||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { | ||
var r = (d + Math.random()*16)%16 | 0; | ||
d = Math.floor(d/16); | ||
return (c=='x' ? r : (r&0x7|0x8)).toString(16); | ||
}); | ||
}; | ||
var UUID = tmpl.generateUUID(); | ||
var UUID = generateUUID(); | ||
var plugin = module.exports = { | ||
@@ -145,3 +137,3 @@ reset: function() { | ||
while ( quasiCookedString.contains(UUID) ) {// paranoiac mode: on | ||
UUID = generateUUID(); | ||
UUID = tmpl.generateUUID(); | ||
} | ||
@@ -148,0 +140,0 @@ variableNamePlaceholder = UUID; |
@@ -26,3 +26,4 @@ "use strict"; | ||
var SymbolIteratorBody = "typeof Symbol!=='undefined'&&Symbol.iterator||'@@iterator'"; | ||
var SymbolIteratorBody = "typeof Symbol!=='undefined'&&Symbol&&Symbol.iterator||'@@iterator'"; | ||
var SymbolPolyfillMarkBody = "typeof Symbol!=='undefined'&&Symbol&&Symbol[\"__setObjectSetter__\"]"; | ||
var callIteratorBody = | ||
@@ -33,2 +34,3 @@ "(v,f){" + | ||
"var i,r;"+ | ||
"if(${Symbol_mark})${Symbol_mark}(v);" + | ||
"if(typeof v==='object'&&typeof (f=v[${Symbol_iterator}])==='function'){" + | ||
@@ -41,2 +43,3 @@ "i=f.call(v);r=[];" + | ||
"};" + | ||
"if(${Symbol_mark})${Symbol_mark}(void 0);" + | ||
"if(r) {" + | ||
@@ -181,8 +184,3 @@ "while((f=i['next']()),f['done']!==true)r.push(f['value']);" + | ||
); | ||
// if ( !((argsLength === 1 && !isArrayExpression(args[0].argument)) ) ) { | ||
// console.log(argsLength, isArrayExpression(args[0].argument), args[0].argument, needFirstSquareBracket); | ||
// process.exit(0) | ||
// } | ||
this.replaceSpreads(node, args, true); | ||
@@ -226,3 +224,3 @@ } | ||
, replaceSpreads: function(node, elements, innerSpread) {;var $that$0=this;;var $that$0=this;;var $that$0=this;;var $that$0=this;;var $that$0=this;;var $that$0=this;;var $that$0=this;;var $that$0=this;;var $that$0=this;;var $that$0=this;;var $that$0=this;;var $that$0=this;;var $that$0=this;;var $that$0=this; | ||
, replaceSpreads: function(node, elements, innerSpread) {;var $that$0=this; | ||
var self = this; | ||
@@ -232,3 +230,10 @@ | ||
var Symbol_iterator = core.bubbledVariableDeclaration(node.$scope, "S_ITER", SymbolIteratorBody); | ||
return core.bubbledVariableDeclaration(node.$scope, "ITER", callIteratorBody.replace("${Symbol_iterator}", Symbol_iterator), true); | ||
var Symbol_mark = core.bubbledVariableDeclaration(node.$scope, "S_MARK", SymbolPolyfillMarkBody); | ||
return core.bubbledVariableDeclaration(node.$scope | ||
, "ITER" | ||
, callIteratorBody | ||
.replace("${Symbol_iterator}", Symbol_iterator) | ||
.replace(/\$\{Symbol_mark\}/g, Symbol_mark) | ||
, true | ||
); | ||
} | ||
@@ -268,4 +273,2 @@ | ||
if( !concatOpen ) { | ||
// let _isArrayExpression = isArrayExpression(node);// for "NewExpression" and "CallExpression", node is not a SpreadElement | ||
// let from = _isArrayExpression ? node.range[0] : firstElemIsSpreadFlag; | ||
var from = firstElemIsSpreadFlag; | ||
@@ -406,5 +409,2 @@ | ||
} | ||
// else{ | ||
// this.alter.remove(node.range[0], node.range[0] + 1); | ||
// } | ||
} | ||
@@ -411,0 +411,0 @@ else { |
@@ -50,2 +50,3 @@ /*global require*/ | ||
, require("./transpiler/arrayComprehension") | ||
, require("./transpiler/generatorComprehension") | ||
, require("./transpiler/forOf") | ||
@@ -52,0 +53,0 @@ , require("./transpiler/optimiser") |
@@ -11,1 +11,4 @@ // Esprima parser bugs list | ||
var arr = [...[1], 2] | ||
// Error: Line 1: Unexpected token => | ||
var fff = ({x = (() => 1)()}) => (x); |
@@ -27,3 +27,3 @@ // Destructuring: The initializer must be an object. | ||
// Esprima support | ||
// Esprima support #1 | ||
let obj = { | ||
@@ -41,41 +41,5 @@ test: (function({a = 1} = {}){ | ||
// Esprima support #2 | ||
var fff = ({x = (() => 1)()}) => (x); | ||
// --------------------------------------------------- | ||
// Array comprehensions | ||
[for (x of ['a', 'b', 'c']) for (y of [1, 2, 3]) for (z of [9, 8, 7]) (x+y+z)];// -> | ||
//function ITER$0(v,f,fn){if(v){var ia=Array.isArray(v);if(ia&&!fn)return f?v.slice():v;if(ia||(typeof v==='object'&&typeof v['iterator']==='function'))return Array['from'](v,fn);}throw new Error(v+' is not iterable')};var x, y, z; | ||
//[].concat.apply([], ITER$0(['a', 'b', 'c'], false, function(x){return [].concat.apply([], ITER$0([1, 2, 3], false, function(y){return ITER$0([9, 8, 7], false, function(z){return (x+y+z)})}))})); | ||
var arr = [1, 2, 3]; | ||
var arr2 = [5, 6, 7]; | ||
[ for(x of arr) for(y of arr2) if(x % 2) (x * 2 * y) ] | ||
function forOf(result, $a, fun) { | ||
if(Array.isArray($a))for(var $__i = 0, $__len = $a.length ; $__i < $__len ; $__i++)fun.call(result, $a[$__i]); | ||
else Array.from($a, fun.bind(result)) | ||
return result; | ||
} | ||
forOf([], arr, function(x){ forOf(this, arr2, function(){ if(x % 2)this.push(x * 2 * y); }) }) | ||
// -------------------------------------------------------------------- | ||
// Destructuring refactoring | ||
function test1({a}) { | ||
function test2() { | ||
console.log(test1.arguments, a) | ||
} | ||
test2() | ||
} | ||
test1({a: 1}) | ||
function test1(a) { | ||
var a = a.a; | ||
console.log(arguments[0], a) | ||
} | ||
test1({a: 1}) |
{ | ||
"name": "es6-transpiler", | ||
"version": "0.7.14-2", | ||
"version": "0.7.15", | ||
"description": "es6 -> es5", | ||
@@ -5,0 +5,0 @@ "main": "./build/es5/es6-transpiler.js", |
@@ -27,2 +27,3 @@ # es6-transpiler.js | ||
* classes | ||
* generator comprehensions | ||
* destructuring (with default values) | ||
@@ -37,3 +38,6 @@ * block binding (let / const) | ||
* string templates (with tags support) | ||
* object literals (partial support see: [Not supported](#not-supported)) | ||
* object literals: | ||
* methods | ||
* shorthands | ||
* computed properties | ||
* binary/octal numericLiteral | ||
@@ -52,6 +56,4 @@ * unicode code point escapes | ||
* modules | ||
* generators / generator comprehensions | ||
* generators | ||
* symbols | ||
* object literals: | ||
* computed properties | ||
* RegExp: | ||
@@ -58,0 +60,0 @@ * 'u' flag in runtime (via polyfill) for the newly generated patterns: |
var Board = (function(){var DP$0 = Object.defineProperty;"use strict"; | ||
var Board = (function(){"use strict";var DP$0 = Object.defineProperty;var MIXIN$0 = function(t,s){for(var p in s){if(s.hasOwnProperty(p)){DP$0(t,p,Object.getOwnPropertyDescriptor(s,p));}}return t}; | ||
function Board(el) { | ||
@@ -4,0 +4,0 @@ this.element = document.getElementById(el); |
@@ -1,9 +0,9 @@ | ||
var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol.iterator||'@@iterator';function GET_ITER$0(v){if(v){if(Array.isArray(v))return 0;var f;if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function')return f.call(v);if((v+'')==='[object Generator]')return v;}throw new Error(v+' is not iterable')}; | ||
var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol.iterator||'@@iterator';var S_MARK$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol["__setObjectSetter__"];function GET_ITER$0(v){if(v){if(Array.isArray(v))return 0;var f;if(S_MARK$0)S_MARK$0(v);if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){if(S_MARK$0)S_MARK$0(void 0);return f.call(v);}if(S_MARK$0)S_MARK$0(void 0);if((v+'')==='[object Generator]')return v;}throw new Error(v+' is not iterable')}; | ||
{ | ||
// simple / body in head and body in tail | ||
var result; | ||
result = (function(){var $D$0;var $D$1;var $D$2;var $D$3;var $D$4;var $D$5;var $D$6;var $D$7;var $D$8;var $D$9;var $D$10;var $D$11;var $result$0 = [], x,y,z;$D$3 = (['a', 'b', 'c']);$D$0 = GET_ITER$0($D$3);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? $D$3.length : void 0);for(; $D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"]; ){x = ($D$2 ? $D$3[$D$0++] : $D$1["value"]);$D$7 = ([1, 2, 3]);$D$4 = GET_ITER$0($D$7);$D$6 = $D$4 === 0;$D$5 = ($D$6 ? $D$7.length : void 0);for(; $D$6 ? ($D$4 < $D$5) : !($D$5 = $D$4["next"]())["done"]; ){y = ($D$6 ? $D$7[$D$4++] : $D$5["value"]);$D$11 = ([9, 8, 7]);$D$8 = GET_ITER$0($D$11);$D$10 = $D$8 === 0;$D$9 = ($D$10 ? $D$11.length : void 0);for(; $D$10 ? ($D$8 < $D$9) : !($D$9 = $D$8["next"]())["done"]; ){z = ($D$10 ? $D$11[$D$8++] : $D$9["value"]);{$result$0.push(x+y+z)}};};};;return $result$0})(); | ||
result = (function(){var $D$0;var $D$1;var $D$2;var $D$3;var $D$4;var $D$5;var $D$6;var $D$7;var $D$8;var $D$9;var $D$10;var $D$11;var $result$0 = [], x,y,z;$D$3 = (['a', 'b', 'c']);$D$0 = GET_ITER$0($D$3);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? $D$3.length : void 0);for(;$D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"];){x = ($D$2 ? $D$3[$D$0++] : $D$1["value"]);$D$7 = ([1, 2, 3]);$D$4 = GET_ITER$0($D$7);$D$6 = $D$4 === 0;$D$5 = ($D$6 ? $D$7.length : void 0);for(;$D$6 ? ($D$4 < $D$5) : !($D$5 = $D$4["next"]())["done"];){y = ($D$6 ? $D$7[$D$4++] : $D$5["value"]);$D$11 = ([9, 8, 7]);$D$8 = GET_ITER$0($D$11);$D$10 = $D$8 === 0;$D$9 = ($D$10 ? $D$11.length : void 0);for(;$D$10 ? ($D$8 < $D$9) : !($D$9 = $D$8["next"]())["done"];){z = ($D$10 ? $D$11[$D$8++] : $D$9["value"]);{$result$0.push(x+y+z)}}}};return $result$0})(); | ||
console.log(result.join(",") === "a19,a18,a17,a29,a28,a27,a39,a38,a37,b19,b18,b17,b29,b28,b27,b39,b38,b37,c19,c18,c17,c29,c28,c27,c39,c38,c37"); | ||
result = (function(){var $D$12;var $D$13;var $D$14;var $D$15;var $D$16;var $D$17;var $D$18;var $D$19;var $D$20;var $D$21;var $D$22;var $D$23;var $result$1 = [], x,y,z;$D$15 = (['a', 'b', 'c']);$D$12 = GET_ITER$0($D$15);$D$14 = $D$12 === 0;$D$13 = ($D$14 ? $D$15.length : void 0);for(; $D$14 ? ($D$12 < $D$13) : !($D$13 = $D$12["next"]())["done"]; ){x = ($D$14 ? $D$15[$D$12++] : $D$13["value"]);$D$19 = ([1, 2, 3]);$D$16 = GET_ITER$0($D$19);$D$18 = $D$16 === 0;$D$17 = ($D$18 ? $D$19.length : void 0);for(; $D$18 ? ($D$16 < $D$17) : !($D$17 = $D$16["next"]())["done"]; ){y = ($D$18 ? $D$19[$D$16++] : $D$17["value"]);$D$23 = ([9, 8, 7]);$D$20 = GET_ITER$0($D$23);$D$22 = $D$20 === 0;$D$21 = ($D$22 ? $D$23.length : void 0);for(; $D$22 ? ($D$20 < $D$21) : !($D$21 = $D$20["next"]())["done"]; ){z = ($D$22 ? $D$23[$D$20++] : $D$21["value"]);{$result$1.push(x+y+z)}};};};;return $result$1})(); | ||
result = (function(){var $D$12;var $D$13;var $D$14;var $D$15;var $D$16;var $D$17;var $D$18;var $D$19;var $D$20;var $D$21;var $D$22;var $D$23;var $result$1 = [], x,y,z;$D$15 = (['a', 'b', 'c']);$D$12 = GET_ITER$0($D$15);$D$14 = $D$12 === 0;$D$13 = ($D$14 ? $D$15.length : void 0);for(;$D$14 ? ($D$12 < $D$13) : !($D$13 = $D$12["next"]())["done"];){x = ($D$14 ? $D$15[$D$12++] : $D$13["value"]);$D$19 = ([1, 2, 3]);$D$16 = GET_ITER$0($D$19);$D$18 = $D$16 === 0;$D$17 = ($D$18 ? $D$19.length : void 0);for(;$D$18 ? ($D$16 < $D$17) : !($D$17 = $D$16["next"]())["done"];){y = ($D$18 ? $D$19[$D$16++] : $D$17["value"]);$D$23 = ([9, 8, 7]);$D$20 = GET_ITER$0($D$23);$D$22 = $D$20 === 0;$D$21 = ($D$22 ? $D$23.length : void 0);for(;$D$22 ? ($D$20 < $D$21) : !($D$21 = $D$20["next"]())["done"];){z = ($D$22 ? $D$23[$D$20++] : $D$21["value"]);{$result$1.push(x+y+z)}}}};return $result$1})(); | ||
console.log(result.join(",") === "a19,a18,a17,a29,a28,a27,a39,a38,a37,b19,b18,b17,b29,b28,b27,b39,b38,b37,c19,c18,c17,c29,c28,c27,c39,c38,c37"); | ||
@@ -18,6 +18,6 @@ } | ||
var result$0; | ||
result$0 = (function(){var $D$24;var $D$25;var $D$26;var $D$27;var $D$28;var $D$29;var $result$2 = [], x,y;$D$24 = GET_ITER$0(arr);$D$26 = $D$24 === 0;$D$25 = ($D$26 ? arr.length : void 0);for(; $D$26 ? ($D$24 < $D$25) : !($D$25 = $D$24["next"]())["done"]; ){x = ($D$26 ? arr[$D$24++] : $D$25["value"]);$D$27 = GET_ITER$0(arr2);$D$29 = $D$27 === 0;$D$28 = ($D$29 ? arr2.length : void 0);for(; $D$29 ? ($D$27 < $D$28) : !($D$28 = $D$27["next"]())["done"]; ){y = ($D$29 ? arr2[$D$27++] : $D$28["value"]);if(x % 2){$result$2.push(x * 2 * y)}};};;return $result$2})(); | ||
result$0 = (function(){var $D$24;var $D$25;var $D$26;var $D$27;var $D$28;var $D$29;var $result$2 = [], x,y;$D$24 = GET_ITER$0(arr);$D$26 = $D$24 === 0;$D$25 = ($D$26 ? arr.length : void 0);for(;$D$26 ? ($D$24 < $D$25) : !($D$25 = $D$24["next"]())["done"];){x = ($D$26 ? arr[$D$24++] : $D$25["value"]);$D$27 = GET_ITER$0(arr2);$D$29 = $D$27 === 0;$D$28 = ($D$29 ? arr2.length : void 0);for(;$D$29 ? ($D$27 < $D$28) : !($D$28 = $D$27["next"]())["done"];){y = ($D$29 ? arr2[$D$27++] : $D$28["value"]);if(x % 2){$result$2.push(x * 2 * y)}}};return $result$2})(); | ||
console.log(result$0.join("|") === [10, 12, 14, 30, 36, 42].join("|")); | ||
result$0 = (function(){var $D$30;var $D$31;var $D$32;var $D$33;var $D$34;var $D$35;var $result$3 = [], x,y;$D$30 = GET_ITER$0(arr);$D$32 = $D$30 === 0;$D$31 = ($D$32 ? arr.length : void 0);for(; $D$32 ? ($D$30 < $D$31) : !($D$31 = $D$30["next"]())["done"]; ){x = ($D$32 ? arr[$D$30++] : $D$31["value"]);$D$33 = GET_ITER$0(arr2);$D$35 = $D$33 === 0;$D$34 = ($D$35 ? arr2.length : void 0);for(; $D$35 ? ($D$33 < $D$34) : !($D$34 = $D$33["next"]())["done"]; ){y = ($D$35 ? arr2[$D$33++] : $D$34["value"]);if(x % 2){$result$3.push(x * 2 * y)}};};;return $result$3})(); | ||
result$0 = (function(){var $D$30;var $D$31;var $D$32;var $D$33;var $D$34;var $D$35;var $result$3 = [], x,y;$D$30 = GET_ITER$0(arr);$D$32 = $D$30 === 0;$D$31 = ($D$32 ? arr.length : void 0);for(;$D$32 ? ($D$30 < $D$31) : !($D$31 = $D$30["next"]())["done"];){x = ($D$32 ? arr[$D$30++] : $D$31["value"]);$D$33 = GET_ITER$0(arr2);$D$35 = $D$33 === 0;$D$34 = ($D$35 ? arr2.length : void 0);for(;$D$35 ? ($D$33 < $D$34) : !($D$34 = $D$33["next"]())["done"];){y = ($D$35 ? arr2[$D$33++] : $D$34["value"]);if(x % 2){$result$3.push(x * 2 * y)}}};return $result$3})(); | ||
console.log(result$0.join("|") === [10, 12, 14, 30, 36, 42].join("|")); | ||
@@ -31,3 +31,3 @@ } | ||
var result$1; | ||
result$1 = (function(){var $D$36;var $D$37;var $D$38;var $result$4 = [];var a, b;$D$36 = GET_ITER$0(arr$0);$D$38 = $D$36 === 0;$D$37 = ($D$38 ? arr$0.length : void 0);for(; $D$38 ? ($D$36 < $D$37) : !($D$37 = $D$36["next"]())["done"]; ){;a = (b = ($D$38 ? arr$0[$D$36++] : $D$37["value"])).a, b = b.b;if(b !== 999){$result$4.push("_" + a)}};;return $result$4})(); | ||
result$1 = (function(){var $D$36;var $D$37;var $D$38;var $result$4 = [];var a, b;$D$36 = GET_ITER$0(arr$0);$D$38 = $D$36 === 0;$D$37 = ($D$38 ? arr$0.length : void 0);for(;$D$38 ? ($D$36 < $D$37) : !($D$37 = $D$36["next"]())["done"];){a = (b = ($D$38 ? arr$0[$D$36++] : $D$37["value"])).a, b = b.b;if(b !== 999){$result$4.push("_" + a)}};return $result$4})(); | ||
console.log(result$1.join("|") === ["_1", "_2", "_3", "_4", "_5"].join("|")); | ||
@@ -41,3 +41,3 @@ } | ||
var result$2; | ||
result$2 = (function(){var $D$39;var $D$40;var $D$41;var $result$5 = [];var a, b;$D$39 = GET_ITER$0(arr$1);$D$41 = $D$39 === 0;$D$40 = ($D$41 ? arr$1.length : void 0);for(; $D$41 ? ($D$39 < $D$40) : !($D$40 = $D$39["next"]())["done"]; ){;a = (b = ($D$41 ? arr$1[$D$39++] : $D$40["value"])).a, b = b.b;if((function(b){return b !== 999})(b)){$result$5.push(( | ||
result$2 = (function(){var $D$39;var $D$40;var $D$41;var $result$5 = [];var a, b;$D$39 = GET_ITER$0(arr$1);$D$41 = $D$39 === 0;$D$40 = ($D$41 ? arr$1.length : void 0);for(;$D$41 ? ($D$39 < $D$40) : !($D$40 = $D$39["next"]())["done"];){a = (b = ($D$41 ? arr$1[$D$39++] : $D$40["value"])).a, b = b.b;if((function(b){return b !== 999})(b)){$result$5.push(( | ||
function (a) { | ||
@@ -50,3 +50,3 @@ var obj = { | ||
} | ||
)(a))}};;return $result$5})(); | ||
)(a))}};return $result$5})(); | ||
console.log(result$2.join("|") === ["_1", "_2", "_3", "_4", "_5"].join("|")); | ||
@@ -60,3 +60,3 @@ } | ||
var result$3; | ||
result$3 = (function(){var $D$42;var $D$43;var $D$44;var $result$6 = [];var A, B, C;$D$42 = GET_ITER$0(arr$2);$D$44 = $D$42 === 0;$D$43 = ($D$44 ? arr$2.length : void 0);for(; $D$44 ? ($D$42 < $D$43) : !($D$43 = $D$42["next"]())["done"]; ){;A = ((A = (C = ($D$44 ? arr$2[$D$42++] : $D$43["value"])).a) === void 0 ? 'A' : A), B = ((B = C.b) === void 0 ? 'B' : B), C = ((C = C.c) === void 0 ? 'C' : C);{$result$6.push(A + B + C)}};;return $result$6})(); | ||
result$3 = (function(){var $D$42;var $D$43;var $D$44;var $result$6 = [];var A, B, C;$D$42 = GET_ITER$0(arr$2);$D$44 = $D$42 === 0;$D$43 = ($D$44 ? arr$2.length : void 0);for(;$D$44 ? ($D$42 < $D$43) : !($D$43 = $D$42["next"]())["done"];){A = ((A = (C = ($D$44 ? arr$2[$D$42++] : $D$43["value"])).a) === void 0 ? 'A' : A), B = ((B = C.b) === void 0 ? 'B' : B), C = ((C = C.c) === void 0 ? 'C' : C);{$result$6.push(A + B + C)}};return $result$6})(); | ||
console.log(result$3.join("|") === ["a1b1C","Ab2c3","a3Bc3","a4b4C","Ab5c5","a6Bc6"].join("|")); | ||
@@ -71,3 +71,3 @@ } | ||
, getResult: function() { | ||
return (function(){var $D$45;var $D$46;var $D$47;var $D$48;var $D$49;var $D$50;var $D$51;var $D$52;var $result$7 = [], x,y;$D$48 = (this.arr);$D$45 = GET_ITER$0($D$48);$D$47 = $D$45 === 0;$D$46 = ($D$47 ? $D$48.length : void 0);for(; $D$47 ? ($D$45 < $D$46) : !($D$46 = $D$45["next"]())["done"]; ){x = ($D$47 ? $D$48[$D$45++] : $D$46["value"]);$D$52 = (this.arr2);$D$49 = GET_ITER$0($D$52);$D$51 = $D$49 === 0;$D$50 = ($D$51 ? $D$52.length : void 0);for(; $D$51 ? ($D$49 < $D$50) : !($D$50 = $D$49["next"]())["done"]; ){y = ($D$51 ? $D$52[$D$49++] : $D$50["value"]);{$result$7.push(x + y)}};};;return $result$7}).call(this) | ||
return (function(){var $D$45;var $D$46;var $D$47;var $D$48;var $D$49;var $D$50;var $D$51;var $D$52;var $result$7 = [], x,y;$D$48 = (this.arr);$D$45 = GET_ITER$0($D$48);$D$47 = $D$45 === 0;$D$46 = ($D$47 ? $D$48.length : void 0);for(;$D$47 ? ($D$45 < $D$46) : !($D$46 = $D$45["next"]())["done"];){x = ($D$47 ? $D$48[$D$45++] : $D$46["value"]);$D$52 = (this.arr2);$D$49 = GET_ITER$0($D$52);$D$51 = $D$49 === 0;$D$50 = ($D$51 ? $D$52.length : void 0);for(;$D$51 ? ($D$49 < $D$50) : !($D$50 = $D$49["next"]())["done"];){y = ($D$51 ? $D$52[$D$49++] : $D$50["value"]);{$result$7.push(x + y)}}};return $result$7}).call(this) | ||
} | ||
@@ -74,0 +74,0 @@ } |
@@ -1,2 +0,2 @@ | ||
var SLICE$0 = Array.prototype.slice;var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol.iterator||'@@iterator';function ITER$0(v,f){if(v){if(Array.isArray(v))return f?v.slice():v;var i,r;if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){i=f.call(v);r=[];}else if((v+'')==='[object Generator]'){i=v;r=[];};if(r) {while((f=i['next']()),f['done']!==true)r.push(f['value']);return r;}}throw new Error(v+' is not iterable')}; | ||
var SLICE$0 = Array.prototype.slice;var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol.iterator||'@@iterator';var S_MARK$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol["__setObjectSetter__"];function ITER$0(v,f){if(v){if(Array.isArray(v))return f?v.slice():v;var i,r;if(S_MARK$0)S_MARK$0(v);if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){i=f.call(v);r=[];}else if((v+'')==='[object Generator]'){i=v;r=[];};if(S_MARK$0)S_MARK$0(void 0);if(r) {while((f=i['next']()),f['done']!==true)r.push(f['value']);return r;}}throw new Error(v+' is not iterable')}; | ||
{ | ||
@@ -3,0 +3,0 @@ var test11 = function(a) {var a = a.a;var rest = SLICE$0.call(arguments, 1);return [a, rest[0]]} |
@@ -1,316 +0,316 @@ | ||
var SLICE$0 = Array.prototype.slice;"use strict"; | ||
"use strict";var SLICE$0 = Array.prototype.slice; | ||
var a = 1; | ||
{ | ||
var a$0 = 2;// | ||
var a$0 = 2;// | ||
} | ||
{ | ||
var test = { | ||
test: function(){return 1} | ||
} | ||
console.log(test.test() === 1) | ||
var test = { | ||
test: function(){return 1} | ||
} | ||
console.log(test.test() === 1) | ||
{ | ||
var test$0 = { | ||
test: function(a){var a = a.a;var rest = SLICE$0.call(arguments, 1);return a+rest[0]} | ||
} | ||
console.log(test$0.test({a: 1}, 2, 999) === 3) | ||
} | ||
{ | ||
var test$0 = { | ||
test: function(a){var a = a.a;var rest = SLICE$0.call(arguments, 1);return a+rest[0]} | ||
} | ||
console.log(test$0.test({a: 1}, 2, 999) === 3) | ||
} | ||
(function() {var this$0 = this; | ||
(function() {var this$0 = this; | ||
var test = { | ||
test: function(){return 1+this$0.test} | ||
} | ||
console.log(test.test() === 101) | ||
var test = { | ||
test: function(){return 1+this$0.test} | ||
} | ||
console.log(test.test() === 101) | ||
{ | ||
var test$1 = { | ||
test: function(a){var a = a.a;var rest = SLICE$0.call(arguments, 1);return a+rest[0]+this$0.test} | ||
} | ||
console.log(test$1.test({a: 1}, 2, 999) === 103) | ||
} | ||
{ | ||
var test$1 = { | ||
test: function(a){var a = a.a;var rest = SLICE$0.call(arguments, 1);return a+rest[0]+this$0.test} | ||
} | ||
console.log(test$1.test({a: 1}, 2, 999) === 103) | ||
} | ||
}).call({test: 100}) | ||
}).call({test: 100}) | ||
} | ||
{ | ||
var test$2 = { | ||
test: function(){return 2} | ||
} | ||
console.log(test$2.test() === 2) | ||
var test$2 = { | ||
test: function(){return 2} | ||
} | ||
console.log(test$2.test() === 2) | ||
{ | ||
var test$3 = { | ||
test: function(a){var a = a.a;var rest = SLICE$0.call(arguments, 1);return a+rest[0]} | ||
} | ||
console.log(test$3.test({a: 2}, 2, 999) === 4) | ||
} | ||
{ | ||
var test$3 = { | ||
test: function(a){var a = a.a;var rest = SLICE$0.call(arguments, 1);return a+rest[0]} | ||
} | ||
console.log(test$3.test({a: 2}, 2, 999) === 4) | ||
} | ||
(function() {var this$0 = this; | ||
(function() {var this$0 = this; | ||
var test = { | ||
test: function(){return 2+this$0.test} | ||
} | ||
console.log(test.test() === 102) | ||
var test = { | ||
test: function(){return 2+this$0.test} | ||
} | ||
console.log(test.test() === 102) | ||
{ | ||
var test$4 = { | ||
test: function(a){var a = a.a;var rest = SLICE$0.call(arguments, 1);return a+rest[0]+this$0.test} | ||
} | ||
console.log(test$4.test({a: 2}, 2, 999) === 104) | ||
} | ||
{ | ||
var test$4 = { | ||
test: function(a){var a = a.a;var rest = SLICE$0.call(arguments, 1);return a+rest[0]+this$0.test} | ||
} | ||
console.log(test$4.test({a: 2}, 2, 999) === 104) | ||
} | ||
}).call({test: 100}) | ||
}).call({test: 100}) | ||
} | ||
{ | ||
var test$5 = { | ||
test: function(){return (1, 3)} | ||
} | ||
console.log(test$5.test() === 3) | ||
var test$5 = { | ||
test: function(){return (1, 3)} | ||
} | ||
console.log(test$5.test() === 3) | ||
{ | ||
var test$6 = { | ||
test: function(a){var a = a.a;var rest = SLICE$0.call(arguments, 1);return (1, a+rest[0])} | ||
} | ||
console.log(test$6.test({a: 3}, 2, 999) === 5) | ||
} | ||
{ | ||
var test$6 = { | ||
test: function(a){var a = a.a;var rest = SLICE$0.call(arguments, 1);return (1, a+rest[0])} | ||
} | ||
console.log(test$6.test({a: 3}, 2, 999) === 5) | ||
} | ||
(function() {var this$0 = this; | ||
(function() {var this$0 = this; | ||
var test = { | ||
test: function(){return (1, 3+this$0.test)} | ||
} | ||
console.log(test.test() === 103) | ||
var test = { | ||
test: function(){return (1, 3+this$0.test)} | ||
} | ||
console.log(test.test() === 103) | ||
{ | ||
var test$7 = { | ||
test: function(a){var a = a.a;var rest = SLICE$0.call(arguments, 1);return (1, a+rest[0]+this$0.test)} | ||
} | ||
console.log(test$7.test({a: 3}, 2, 999) === 105) | ||
} | ||
{ | ||
var test$7 = { | ||
test: function(a){var a = a.a;var rest = SLICE$0.call(arguments, 1);return (1, a+rest[0]+this$0.test)} | ||
} | ||
console.log(test$7.test({a: 3}, 2, 999) === 105) | ||
} | ||
}).call({test: 100}) | ||
}).call({test: 100}) | ||
} | ||
{ | ||
var test$8 = { | ||
test: function(){return [3, 4]} | ||
} | ||
console.log(test$8.test().join("|") === [3, 4].join("|")) | ||
var test$8 = { | ||
test: function(){return [3, 4]} | ||
} | ||
console.log(test$8.test().join("|") === [3, 4].join("|")) | ||
{ | ||
var test$9 = { | ||
test: function(a){var a = a.a;var rest = SLICE$0.call(arguments, 1);return [a, rest[0]]} | ||
} | ||
console.log(test$9.test({a: 4}, 2, 999).join("|") === [4, 2].join("|")) | ||
} | ||
{ | ||
var test$9 = { | ||
test: function(a){var a = a.a;var rest = SLICE$0.call(arguments, 1);return [a, rest[0]]} | ||
} | ||
console.log(test$9.test({a: 4}, 2, 999).join("|") === [4, 2].join("|")) | ||
} | ||
(function() {var this$0 = this; | ||
(function() {var this$0 = this; | ||
var test = { | ||
test: function(){return [3, 4, this$0.test]} | ||
} | ||
console.log(test.test().join("|") === [3, 4, 100].join("|")) | ||
var test = { | ||
test: function(){return [3, 4, this$0.test]} | ||
} | ||
console.log(test.test().join("|") === [3, 4, 100].join("|")) | ||
{ | ||
var test$10 = { | ||
test: function(a){var a = a.a;var rest = SLICE$0.call(arguments, 1);return [a, rest[0], this$0.test]} | ||
} | ||
console.log(test$10.test({a: 4}, 2, 999).join("|") === [4, 2, 100].join("|")) | ||
} | ||
{ | ||
var test$10 = { | ||
test: function(a){var a = a.a;var rest = SLICE$0.call(arguments, 1);return [a, rest[0], this$0.test]} | ||
} | ||
console.log(test$10.test({a: 4}, 2, 999).join("|") === [4, 2, 100].join("|")) | ||
} | ||
}).call({test: 100}) | ||
}).call({test: 100}) | ||
} | ||
{ | ||
var test$11 = { | ||
test: function() | ||
{return 5} | ||
var test$11 = { | ||
test: function() | ||
{return 5} | ||
} | ||
console.log(test$11.test() === 5) | ||
} | ||
console.log(test$11.test() === 5) | ||
{ | ||
var test$12 = { | ||
test: function(a) | ||
{var a = a.a;var rest = SLICE$0.call(arguments, 1);return a+rest[0]} | ||
} | ||
console.log(test$12.test({a: 5}, 2, 999) === 7) | ||
} | ||
{ | ||
var test$12 = { | ||
test: function(a) | ||
{var a = a.a;var rest = SLICE$0.call(arguments, 1);return a+rest[0]} | ||
(function() {var this$0 = this; | ||
} | ||
console.log(test$12.test({a: 5}, 2, 999) === 7) | ||
} | ||
var test = { | ||
test: function() | ||
{return 5 + this$0.test} | ||
} | ||
console.log(test.test() === 105) | ||
(function() {var this$0 = this; | ||
{ | ||
var test$13 = { | ||
test: function(a) | ||
{var a = a.a;var rest = SLICE$0.call(arguments, 1);return a+rest[0]+this$0.test} | ||
} | ||
console.log(test$13.test({a: 5}, 2, 999) === 107) | ||
} | ||
var test = { | ||
test: function() | ||
{return 5 + this$0.test} | ||
} | ||
console.log(test.test() === 105) | ||
{ | ||
var test$13 = { | ||
test: function(a) | ||
{var a = a.a;var rest = SLICE$0.call(arguments, 1);return a+rest[0]+this$0.test} | ||
} | ||
console.log(test$13.test({a: 5}, 2, 999) === 107) | ||
} | ||
}).call({test: 100}) | ||
}).call({test: 100}) | ||
} | ||
{ | ||
var test$14 = { | ||
test: function() | ||
{return [5, 6]} | ||
var test$14 = { | ||
test: function() | ||
{return [5, 6]} | ||
} | ||
console.log(test$14.test().join("|") === [5, 6].join("|")) | ||
} | ||
console.log(test$14.test().join("|") === [5, 6].join("|")) | ||
{ | ||
var test$15 = { | ||
test: function(a) | ||
{var a = a.a;var rest = SLICE$0.call(arguments, 1);return [a, rest[0]]} | ||
} | ||
console.log(test$15.test({a: 6}, 2, 999).join("|") === [6, 2].join("|")) | ||
} | ||
{ | ||
var test$15 = { | ||
test: function(a) | ||
{var a = a.a;var rest = SLICE$0.call(arguments, 1);return [a, rest[0]]} | ||
(function() {var this$0 = this; | ||
} | ||
console.log(test$15.test({a: 6}, 2, 999).join("|") === [6, 2].join("|")) | ||
} | ||
var test = { | ||
test: function() | ||
{return [5, 6, this$0.test]} | ||
} | ||
console.log(test.test().join("|") === [5, 6, 100].join("|")) | ||
(function() {var this$0 = this; | ||
{ | ||
var test$16 = { | ||
test: function(a) | ||
{var a = a.a;var rest = SLICE$0.call(arguments, 1);return [a, rest[0], this$0.test]} | ||
} | ||
console.log(test$16.test({a: 6}, 2, 999).join("|") === [6, 2, 100].join("|")) | ||
} | ||
var test = { | ||
test: function() | ||
{return [5, 6, this$0.test]} | ||
} | ||
console.log(test.test().join("|") === [5, 6, 100].join("|")) | ||
{ | ||
var test$16 = { | ||
test: function(a) | ||
{var a = a.a;var rest = SLICE$0.call(arguments, 1);return [a, rest[0], this$0.test]} | ||
} | ||
console.log(test$16.test({a: 6}, 2, 999).join("|") === [6, 2, 100].join("|")) | ||
} | ||
}).call({test: 100}) | ||
}).call({test: 100}) | ||
} | ||
{ | ||
var test$17 = { | ||
test: /*com1*/function(/*com2*/)/*com3-1*//*com3-2*///com4 | ||
/*com5*/{return 7}//com6 | ||
/*com7*/ //com8 | ||
} | ||
console.log(test$17.test() === 7) | ||
var test$17 = { | ||
test: /*com1*/function(/*com2*/)/*com3-1*//*com3-2*///com4 | ||
/*com5*/{return 7}//com6 | ||
/*com7*/ //com8 | ||
} | ||
console.log(test$17.test() === 7) | ||
{ | ||
var test$18 = { | ||
test: /*com1*/function(/*com2*/a/*com3-3*/)/*com3-4*//*com3-5*///com4 | ||
/*com5*/{var a = a.a;var rest = SLICE$0.call(arguments, 1);return a+rest[0]}//com6 | ||
/*com7*/ //com8 | ||
} | ||
console.log(test$18.test({a: 7}, 2, 999) === 9) | ||
} | ||
{ | ||
var test$18 = { | ||
test: /*com1*/function(/*com2*/a/*com3-3*/)/*com3-4*//*com3-5*///com4 | ||
/*com5*/{var a = a.a;var rest = SLICE$0.call(arguments, 1);return a+rest[0]}//com6 | ||
/*com7*/ //com8 | ||
} | ||
console.log(test$18.test({a: 7}, 2, 999) === 9) | ||
} | ||
(function() {var this$0 = this; | ||
(function() {var this$0 = this; | ||
var test = { | ||
test: /*com1*/function(/*com2*/)/*com3-1*//*com3-2*///com4 | ||
/*com5*/{return 7+this$0.test}//com6 | ||
/*com7*/ //com8 | ||
} | ||
console.log(test.test() === 107) | ||
var test = { | ||
test: /*com1*/function(/*com2*/)/*com3-1*//*com3-2*///com4 | ||
/*com5*/{return 7+this$0.test}//com6 | ||
/*com7*/ //com8 | ||
} | ||
console.log(test.test() === 107) | ||
{ | ||
var test$19 = { | ||
test: /*com1*/function(/*com2*/a/*com3-3*/)/*com3-4*//*com3-5*///com4 | ||
/*com5*/{var a = a.a;var rest = SLICE$0.call(arguments, 1);return a+rest[0]+this$0.test}//com6 | ||
/*com7*/ //com8 | ||
} | ||
console.log(test$19.test({a: 7}, 2, 999) === 109) | ||
} | ||
{ | ||
var test$19 = { | ||
test: /*com1*/function(/*com2*/a/*com3-3*/)/*com3-4*//*com3-5*///com4 | ||
/*com5*/{var a = a.a;var rest = SLICE$0.call(arguments, 1);return a+rest[0]+this$0.test}//com6 | ||
/*com7*/ //com8 | ||
} | ||
console.log(test$19.test({a: 7}, 2, 999) === 109) | ||
} | ||
}).call({test: 100}) | ||
}).call({test: 100}) | ||
} | ||
{ | ||
var test$20 = { | ||
test: /*com1*/function(/*com2*/)/*com3-1*//*com3-2*///com4 | ||
/*com5*/{return [7, 8]}//com6 | ||
/*com7*/ //com8 | ||
} | ||
console.log(test$20.test().join("|") === [7, 8].join("|")) | ||
var test$20 = { | ||
test: /*com1*/function(/*com2*/)/*com3-1*//*com3-2*///com4 | ||
/*com5*/{return [7, 8]}//com6 | ||
/*com7*/ //com8 | ||
} | ||
console.log(test$20.test().join("|") === [7, 8].join("|")) | ||
{ | ||
var test$21 = { | ||
test: /*com1*/function(/*com2*/a/*com3-3*/)/*com3-4*//*com3-5*///com4 | ||
/*com5*/{var a = a.a;var rest = SLICE$0.call(arguments, 1);return [a, rest[0]]}//com6 | ||
/*com7*/ //com8 | ||
} | ||
console.log(test$21.test({a: 8}, 2, 999).join("|") === [8, 2].join("|")) | ||
} | ||
{ | ||
var test$21 = { | ||
test: /*com1*/function(/*com2*/a/*com3-3*/)/*com3-4*//*com3-5*///com4 | ||
/*com5*/{var a = a.a;var rest = SLICE$0.call(arguments, 1);return [a, rest[0]]}//com6 | ||
/*com7*/ //com8 | ||
} | ||
console.log(test$21.test({a: 8}, 2, 999).join("|") === [8, 2].join("|")) | ||
} | ||
(function() {var this$0 = this; | ||
(function() {var this$0 = this; | ||
var test = { | ||
test: /*com1*/function(/*com2*/)/*com3-1*//*com3-2*///com4 | ||
/*com5*/{return [7, 8, this$0.test]}//com6 | ||
/*com7*/ //com8 | ||
} | ||
console.log(test.test().join("|") === [7, 8, 100].join("|")) | ||
var test = { | ||
test: /*com1*/function(/*com2*/)/*com3-1*//*com3-2*///com4 | ||
/*com5*/{return [7, 8, this$0.test]}//com6 | ||
/*com7*/ //com8 | ||
} | ||
console.log(test.test().join("|") === [7, 8, 100].join("|")) | ||
{ | ||
var test$22 = { | ||
test: /*com1*/function(/*com2*/a/*com3-3*/)/*com3-4*//*com3-5*///com4 | ||
/*com5*/{var a = a.a;var rest = SLICE$0.call(arguments, 1);return [a, rest[0], this$0.test]}//com6 | ||
/*com7*/ //com8 | ||
} | ||
console.log(test$22.test({a: 8}, 2, 999).join("|") === [8, 2, 100].join("|")) | ||
} | ||
{ | ||
var test$22 = { | ||
test: /*com1*/function(/*com2*/a/*com3-3*/)/*com3-4*//*com3-5*///com4 | ||
/*com5*/{var a = a.a;var rest = SLICE$0.call(arguments, 1);return [a, rest[0], this$0.test]}//com6 | ||
/*com7*/ //com8 | ||
} | ||
console.log(test$22.test({a: 8}, 2, 999).join("|") === [8, 2, 100].join("|")) | ||
} | ||
}).call({test: 100}) | ||
}).call({test: 100}) | ||
} | ||
{ | ||
var test$23 = { | ||
test: /*com1*/function(/*com2*/)/*com3-1*//*com3-2*/{return (1,//com4 | ||
/*com5*/9//com6 | ||
/*com7*/)}//com8 | ||
} | ||
console.log(test$23.test() === 9) | ||
var test$23 = { | ||
test: /*com1*/function(/*com2*/)/*com3-1*//*com3-2*/{return (1,//com4 | ||
/*com5*/9//com6 | ||
/*com7*/)}//com8 | ||
} | ||
console.log(test$23.test() === 9) | ||
{ | ||
var test$24 = { | ||
test: /*com1*/function(/*com2*/a/*com3-3*/)/*com3-4*//*com3-5*/{var a = a.a;var rest = SLICE$0.call(arguments, 1);return (1,//com4 | ||
/*com5*/a+rest[0]//com6 | ||
/*com7*/)}//com8 | ||
} | ||
console.log(test$24.test({a: 9}, 2, 999) === 11) | ||
} | ||
{ | ||
var test$24 = { | ||
test: /*com1*/function(/*com2*/a/*com3-3*/)/*com3-4*//*com3-5*/{var a = a.a;var rest = SLICE$0.call(arguments, 1);return (1,//com4 | ||
/*com5*/a+rest[0]//com6 | ||
/*com7*/)}//com8 | ||
} | ||
console.log(test$24.test({a: 9}, 2, 999) === 11) | ||
} | ||
(function() {var this$0 = this; | ||
(function() {var this$0 = this; | ||
var test = { | ||
test: /*com1*/function(/*com2*/)/*com3-1*//*com3-2*/{return (1,//com4 | ||
/*com5*/9+this$0.test//com6 | ||
/*com7*/)}//com8 | ||
} | ||
console.log(test.test() === 109) | ||
var test = { | ||
test: /*com1*/function(/*com2*/)/*com3-1*//*com3-2*/{return (1,//com4 | ||
/*com5*/9+this$0.test//com6 | ||
/*com7*/)}//com8 | ||
} | ||
console.log(test.test() === 109) | ||
{ | ||
var test$25 = { | ||
test: /*com1*/function(/*com2*/a/*com3-3*/)/*com3-4*//*com3-5*/{var a = a.a;var rest = SLICE$0.call(arguments, 1);return (1,//com4 | ||
/*com5*/a+rest[0]+this$0.test//com6 | ||
/*com7*/)}//com8 | ||
} | ||
console.log(test$25.test({a: 9}, 2, 999) === 111) | ||
} | ||
{ | ||
var test$25 = { | ||
test: /*com1*/function(/*com2*/a/*com3-3*/)/*com3-4*//*com3-5*/{var a = a.a;var rest = SLICE$0.call(arguments, 1);return (1,//com4 | ||
/*com5*/a+rest[0]+this$0.test//com6 | ||
/*com7*/)}//com8 | ||
} | ||
console.log(test$25.test({a: 9}, 2, 999) === 111) | ||
} | ||
}).call({test: 100}) | ||
}).call({test: 100}) | ||
} |
@@ -1,5 +0,5 @@ | ||
var DP$0 = Object.defineProperty; | ||
var DP$0 = Object.defineProperty;var MIXIN$0 = function(t,s){for(var p in s){if(s.hasOwnProperty(p)){DP$0(t,p,Object.getOwnPropertyDescriptor(s,p));}}return t}; | ||
var moduleGreeter = { | ||
Greeter: ((function(){"use strict"; | ||
constructor$0.test = function(){ return "test" } | ||
Greeter: ((function(){"use strict";var $static$0={},$proto$0={}; | ||
$static$0.test = function(){ return "test" }; | ||
@@ -10,10 +10,10 @@ function constructor$0(message) { | ||
constructor$0.prototype.greet = function() { | ||
$proto$0.greet = function() { | ||
return "Hello 1, " + this.greeting; | ||
} | ||
;return constructor$0;})()) | ||
}; | ||
MIXIN$0(constructor$0,$static$0);MIXIN$0(constructor$0.prototype,$proto$0);$static$0=$proto$0=void 0;return constructor$0;})()) | ||
}; | ||
var moduleGreeter1 = { | ||
Greeter1: ((function(super$0){var MIXIN$0 = function(t,s){for(var p in s){if(s.hasOwnProperty(p)){DP$0(t,p,Object.getOwnPropertyDescriptor(s,p));}}return t};"use strict";MIXIN$0(constructor$1, super$0); | ||
Greeter1: ((function(super$0){"use strict";MIXIN$0(constructor$1, super$0);var $proto$0={}; | ||
function constructor$1(message) { | ||
@@ -23,6 +23,6 @@ super$0.call(this, message); | ||
}constructor$1.prototype = Object.create(super$0.prototype, {"constructor": {"value": constructor$1, "configurable": true, "writable": true} });DP$0(constructor$1, "prototype", {"configurable": false, "enumerable": false, "writable": false}); | ||
constructor$1.prototype.greet = function() { | ||
$proto$0.greet = function() { | ||
return super$0.prototype.greet.call(this) + "Hello 2, " + this.greeting; | ||
} | ||
;return constructor$1;})(moduleGreeter.Greeter)) | ||
}; | ||
MIXIN$0(constructor$1.prototype,$proto$0);$proto$0=void 0;return constructor$1;})(moduleGreeter.Greeter)) | ||
}; | ||
@@ -29,0 +29,0 @@ |
var DP$0 = Object.defineProperty;var MIXIN$0 = function(t,s){for(var p in s){if(s.hasOwnProperty(p)){DP$0(t,p,Object.getOwnPropertyDescriptor(s,p));}}return t}; | ||
var secret = Object.create(null); | ||
var A = (function(){"use strict";function A() {}DP$0(A, "prototype", {"configurable": false, "enumerable": false, "writable": false}); | ||
A.prototype.m1 = function() { | ||
var A = (function(){"use strict";function A() {}DP$0(A, "prototype", {"configurable": false, "enumerable": false, "writable": false});var $proto$0={}; | ||
$proto$0.m1 = function() { | ||
return secret; | ||
} | ||
;return A;})(); | ||
}; | ||
MIXIN$0(A.prototype,$proto$0);$proto$0=void 0;return A;})(); | ||
{// anon class | ||
var v = new ((function(super$0){"use strict";function constructor$0() {super$0.apply(this, arguments)}MIXIN$0(constructor$0, super$0);constructor$0.prototype = Object.create(super$0.prototype, {"constructor": {"value": constructor$0, "configurable": true, "writable": true} });DP$0(constructor$0, "prototype", {"configurable": false, "enumerable": false, "writable": false}); | ||
constructor$0.sMethod = function() { | ||
var v = new ((function(super$0){"use strict";function constructor$0() {super$0.apply(this, arguments)}MIXIN$0(constructor$0, super$0);constructor$0.prototype = Object.create(super$0.prototype, {"constructor": {"value": constructor$0, "configurable": true, "writable": true} });DP$0(constructor$0, "prototype", {"configurable": false, "enumerable": false, "writable": false});var $static$0={}; | ||
$static$0.sMethod = function() { | ||
// can't call this method | ||
} | ||
;return constructor$0;})(A)); | ||
}; | ||
MIXIN$0(constructor$0,$static$0);$static$0=void 0;return constructor$0;})(A)); | ||
@@ -23,7 +23,7 @@ console.log(v.m1() === secret); | ||
var Class = (((function(super$0){"use strict";function constructor$1() {super$0.apply(this, arguments)}MIXIN$0(constructor$1, super$0);constructor$1.prototype = Object.create(super$0.prototype, {"constructor": {"value": constructor$1, "configurable": true, "writable": true} });DP$0(constructor$1, "prototype", {"configurable": false, "enumerable": false, "writable": false}); | ||
constructor$1.sMethod = function() { | ||
var Class = (((function(super$0){"use strict";function constructor$1() {super$0.apply(this, arguments)}MIXIN$0(constructor$1, super$0);constructor$1.prototype = Object.create(super$0.prototype, {"constructor": {"value": constructor$1, "configurable": true, "writable": true} });DP$0(constructor$1, "prototype", {"configurable": false, "enumerable": false, "writable": false});var $static$0={}; | ||
$static$0.sMethod = function() { | ||
return secret2; | ||
} | ||
;return constructor$1;})(A))); | ||
}; | ||
MIXIN$0(constructor$1,$static$0);$static$0=void 0;return constructor$1;})(A))); | ||
var v$0 = new Class; | ||
@@ -37,10 +37,10 @@ | ||
var v$1 = new ((function(super$0){"use strict";function B() {super$0.apply(this, arguments)}MIXIN$0(B, super$0);B.prototype = Object.create(super$0.prototype, {"constructor": {"value": B, "configurable": true, "writable": true} });DP$0(B, "prototype", {"configurable": false, "enumerable": false, "writable": false}); | ||
B.sMethod = function() { | ||
var v$1 = new ((function(super$0){"use strict";function B() {super$0.apply(this, arguments)}MIXIN$0(B, super$0);B.prototype = Object.create(super$0.prototype, {"constructor": {"value": B, "configurable": true, "writable": true} });DP$0(B, "prototype", {"configurable": false, "enumerable": false, "writable": false});var $static$0={},$proto$0={}; | ||
$static$0.sMethod = function() { | ||
return secret2$0; | ||
} | ||
B.prototype.test = function() { | ||
}; | ||
$proto$0.test = function() { | ||
return B.sMethod(); | ||
} | ||
;return B;})(A)); | ||
}; | ||
MIXIN$0(B,$static$0);MIXIN$0(B.prototype,$proto$0);$static$0=$proto$0=void 0;return B;})(A)); | ||
@@ -54,10 +54,10 @@ console.log(v$1.m1() === secret, v$1.test() === secret2$0); | ||
var Class$0 = (((function(super$0){"use strict";function B() {super$0.apply(this, arguments)}MIXIN$0(B, super$0);B.prototype = Object.create(super$0.prototype, {"constructor": {"value": B, "configurable": true, "writable": true} });DP$0(B, "prototype", {"configurable": false, "enumerable": false, "writable": false}); | ||
B.sMethod = function() { | ||
var Class$0 = (((function(super$0){"use strict";function B() {super$0.apply(this, arguments)}MIXIN$0(B, super$0);B.prototype = Object.create(super$0.prototype, {"constructor": {"value": B, "configurable": true, "writable": true} });DP$0(B, "prototype", {"configurable": false, "enumerable": false, "writable": false});var $static$0={},$proto$0={}; | ||
$static$0.sMethod = function() { | ||
return secret2$1; | ||
} | ||
B.prototype.test = function() { | ||
}; | ||
$proto$0.test = function() { | ||
return B.sMethod(); | ||
} | ||
;return B;})(A))); | ||
}; | ||
MIXIN$0(B,$static$0);MIXIN$0(B.prototype,$proto$0);$static$0=$proto$0=void 0;return B;})(A))); | ||
var v$2 = new Class$0; | ||
@@ -64,0 +64,0 @@ |
@@ -12,3 +12,3 @@ var DP$0 = Object.defineProperty;var MIXIN$0 = function(t,s){for(var p in s){if(s.hasOwnProperty(p)){DP$0(t,p,Object.getOwnPropertyDescriptor(s,p));}}return t}; | ||
var B = (function(super$0){"use strict";function B() {super$0.apply(this, arguments)}MIXIN$0(B, super$0);B.prototype = Object.create(super$0.prototype, {"constructor": {"value": B, "configurable": true, "writable": true}, b: {"get": b$get$0, "set": b$set$0, "configurable": true, "enumerable": true}, 'c': {"get": c$get$0, "set": c$set$0, "configurable": true, "enumerable": true} });DP$0(B, "prototype", {"configurable": false, "enumerable": false, "writable": false}); | ||
var B = (function(super$0){"use strict";function B() {super$0.apply(this, arguments)}MIXIN$0(B, super$0);B.prototype = Object.create(super$0.prototype, {"constructor": {"value": B, "configurable": true, "writable": true}, b: {"get": b$get$0, "set": b$set$0, "configurable": true, "enumerable": true}, 'c': {"get": c$get$0, "set": c$set$0, "configurable": true, "enumerable": true} });DP$0(B, "prototype", {"configurable": false, "enumerable": false, "writable": false});var $proto$0={}; | ||
function b$get$0() { | ||
@@ -18,3 +18,3 @@ return this._b; | ||
B.prototype.m = function(){ return "m" } | ||
$proto$0.m = function(){ return "m" }; | ||
@@ -30,5 +30,5 @@ function b$set$0(val) { | ||
function static_d$set$0(val){ this._d = val + 999 } | ||
;return B;})(A);; | ||
MIXIN$0(B.prototype,$proto$0);$proto$0=void 0;return B;})(A);; | ||
var C = (function(super$0){"use strict";function C() {super$0.apply(this, arguments)}MIXIN$0(C, super$0);C.prototype = Object.create(super$0.prototype, {"constructor": {"value": C, "configurable": true, "writable": true}, 'e': {"get": e$get$0, "set": e$set$0, "configurable": true, "enumerable": true}, f: {"get": f$get$0, "configurable": true, "enumerable": true}, g: {"set": g$set$0, "configurable": true, "enumerable": true} });DP$0(C, "prototype", {"configurable": false, "enumerable": false, "writable": false}); | ||
var C = (function(super$0){"use strict";function C() {super$0.apply(this, arguments)}MIXIN$0(C, super$0);C.prototype = Object.create(super$0.prototype, {"constructor": {"value": C, "configurable": true, "writable": true}, 'e': {"get": e$get$0, "set": e$set$0, "configurable": true, "enumerable": true}, f: {"get": f$get$0, "configurable": true, "enumerable": true}, g: {"set": g$set$0, "configurable": true, "enumerable": true} });DP$0(C, "prototype", {"configurable": false, "enumerable": false, "writable": false});var $static$0={}; | ||
function e$set$0(val){ this._e = val * 3 } | ||
@@ -41,4 +41,4 @@ function e$get$0(){ return this._e } | ||
C.m = function(){ return "m" } | ||
;return C;})(B);; | ||
$static$0.m = function(){ return "m" }; | ||
MIXIN$0(C,$static$0);$static$0=void 0;return C;})(B);; | ||
@@ -45,0 +45,0 @@ // TODO:: |
@@ -1,3 +0,3 @@ | ||
var DP$0 = Object.defineProperty;var Greeter = (function(){"use strict"; | ||
Greeter.test = function(){ return "test" } | ||
var DP$0 = Object.defineProperty;var MIXIN$0 = function(t,s){for(var p in s){if(s.hasOwnProperty(p)){DP$0(t,p,Object.getOwnPropertyDescriptor(s,p));}}return t};var Greeter = (function(){"use strict";var $static$0={},$proto$0={}; | ||
$static$0.test = function(){ return "test" }; | ||
@@ -10,8 +10,8 @@ //static A = 123; | ||
Greeter.prototype.greet = function() { | ||
$proto$0.greet = function() { | ||
return "Hello 1, " + this.greeting; | ||
} | ||
;return Greeter;})(); | ||
}; | ||
MIXIN$0(Greeter,$static$0);MIXIN$0(Greeter.prototype,$proto$0);$static$0=$proto$0=void 0;return Greeter;})(); | ||
var Greeter1 = (function(super$0){var MIXIN$0 = function(t,s){for(var p in s){if(s.hasOwnProperty(p)){DP$0(t,p,Object.getOwnPropertyDescriptor(s,p));}}return t};"use strict";MIXIN$0(Greeter1, super$0); | ||
var Greeter1 = (function(super$0){"use strict";MIXIN$0(Greeter1, super$0);var $proto$0={}; | ||
function Greeter1(message) { | ||
@@ -21,6 +21,6 @@ super$0.call(this, message); | ||
}Greeter1.prototype = Object.create(super$0.prototype, {"constructor": {"value": Greeter1, "configurable": true, "writable": true} });DP$0(Greeter1, "prototype", {"configurable": false, "enumerable": false, "writable": false}); | ||
Greeter1.prototype.greet = function() { | ||
$proto$0.greet = function() { | ||
return super$0.prototype.greet.call(this) + "Hello 2, " + this.greeting; | ||
} | ||
;return Greeter1;})(Greeter); | ||
}; | ||
MIXIN$0(Greeter1.prototype,$proto$0);$proto$0=void 0;return Greeter1;})(Greeter); | ||
@@ -27,0 +27,0 @@ var A = (function(){"use strict";function A() {}DP$0(A, "prototype", {"configurable": false, "enumerable": false, "writable": false}); |
@@ -5,17 +5,17 @@ var DP$0 = Object.defineProperty;var MIXIN$0 = function(t,s){for(var p in s){if(s.hasOwnProperty(p)){DP$0(t,p,Object.getOwnPropertyDescriptor(s,p));}}return t}; | ||
var A = (function(){function A() {}DP$0(A, "prototype", {"configurable": false, "enumerable": false, "writable": false});//class body should be in strict mode, but in this case in already in strict mode | ||
var A = (function(){function A() {}DP$0(A, "prototype", {"configurable": false, "enumerable": false, "writable": false});var $proto$0={};//class body should be in strict mode, but in this case in already in strict mode | ||
A.prototype.test = function(a) { | ||
$proto$0.test = function(a) { | ||
arguments[0] = a + 1; | ||
return [a, arguments[0]]; | ||
} | ||
;return A;})(); | ||
}; | ||
MIXIN$0(A.prototype,$proto$0);$proto$0=void 0;return A;})(); | ||
var B = (function(super$0){function B() {super$0.apply(this, arguments)}MIXIN$0(B, super$0);B.prototype = Object.create(super$0.prototype, {"constructor": {"value": B, "configurable": true, "writable": true} });DP$0(B, "prototype", {"configurable": false, "enumerable": false, "writable": false});//class body should be in strict mode, but in this case in already in strict mode | ||
var B = (function(super$0){function B() {super$0.apply(this, arguments)}MIXIN$0(B, super$0);B.prototype = Object.create(super$0.prototype, {"constructor": {"value": B, "configurable": true, "writable": true} });DP$0(B, "prototype", {"configurable": false, "enumerable": false, "writable": false});var $proto$0={};//class body should be in strict mode, but in this case in already in strict mode | ||
B.prototype.test = function(a) { | ||
$proto$0.test = function(a) { | ||
arguments[0] = a + 1; | ||
return [a, arguments[0]]; | ||
} | ||
;return B;})(A); | ||
}; | ||
MIXIN$0(B.prototype,$proto$0);$proto$0=void 0;return B;})(A); | ||
@@ -41,17 +41,17 @@ function simpleFunc(a) {// this function is in strict mode | ||
var A = (function(){"use strict";function A() {}DP$0(A, "prototype", {"configurable": false, "enumerable": false, "writable": false});//class body should be in strict mode | ||
var A = (function(){"use strict";function A() {}DP$0(A, "prototype", {"configurable": false, "enumerable": false, "writable": false});var $proto$0={};//class body should be in strict mode | ||
A.prototype.test = function(a) { | ||
$proto$0.test = function(a) { | ||
arguments[0] = a + 1; | ||
return [a, arguments[0]]; | ||
} | ||
;return A;})(); | ||
}; | ||
MIXIN$0(A.prototype,$proto$0);$proto$0=void 0;return A;})(); | ||
var B = (function(super$0){"use strict";function B() {super$0.apply(this, arguments)}MIXIN$0(B, super$0);B.prototype = Object.create(super$0.prototype, {"constructor": {"value": B, "configurable": true, "writable": true} });DP$0(B, "prototype", {"configurable": false, "enumerable": false, "writable": false});//class body should be in strict mode | ||
var B = (function(super$0){"use strict";function B() {super$0.apply(this, arguments)}MIXIN$0(B, super$0);B.prototype = Object.create(super$0.prototype, {"constructor": {"value": B, "configurable": true, "writable": true} });DP$0(B, "prototype", {"configurable": false, "enumerable": false, "writable": false});var $proto$0={};//class body should be in strict mode | ||
B.prototype.test = function(a) { | ||
$proto$0.test = function(a) { | ||
arguments[0] = a + 1; | ||
return [a, arguments[0]]; | ||
} | ||
;return B;})(A); | ||
}; | ||
MIXIN$0(B.prototype,$proto$0);$proto$0=void 0;return B;})(A); | ||
@@ -58,0 +58,0 @@ function simpleFunc(a) {// this function not! in strict mode |
@@ -1,5 +0,5 @@ | ||
var DP$0 = Object.defineProperty; | ||
var DP$0 = Object.defineProperty;var MIXIN$0 = function(t,s){for(var p in s){if(s.hasOwnProperty(p)){DP$0(t,p,Object.getOwnPropertyDescriptor(s,p));}}return t}; | ||
var testCall = false; | ||
var Foo = (function(){"use strict";function Foo() {}DP$0(Foo, "prototype", {"configurable": false, "enumerable": false, "writable": false}); | ||
Foo.doIt = function(test) { | ||
var Foo = (function(){"use strict";function Foo() {}DP$0(Foo, "prototype", {"configurable": false, "enumerable": false, "writable": false});var $static$0={}; | ||
$static$0.doIt = function(test) { | ||
if ( test ) { | ||
@@ -11,6 +11,6 @@ testCall = true; | ||
} | ||
} | ||
;return Foo;})(); | ||
}; | ||
MIXIN$0(Foo,$static$0);$static$0=void 0;return Foo;})(); | ||
var Base = (function(super$0){var MIXIN$0 = function(t,s){for(var p in s){if(s.hasOwnProperty(p)){DP$0(t,p,Object.getOwnPropertyDescriptor(s,p));}}return t};"use strict";MIXIN$0(Base, super$0); | ||
var Base = (function(super$0){"use strict";MIXIN$0(Base, super$0); | ||
function Base() { | ||
@@ -17,0 +17,0 @@ super$0.call(this); |
@@ -1,14 +0,14 @@ | ||
var DP$0 = Object.defineProperty;var MIXIN$0 = function(t,s){for(var p in s){if(s.hasOwnProperty(p)){DP$0(t,p,Object.getOwnPropertyDescriptor(s,p));}}return t};var class1 = (function(){"use strict"; | ||
var DP$0 = Object.defineProperty;var MIXIN$0 = function(t,s){for(var p in s){if(s.hasOwnProperty(p)){DP$0(t,p,Object.getOwnPropertyDescriptor(s,p));}}return t};var class1 = (function(){"use strict";var $static$0={},$proto$0={}; | ||
function class1(msg) { | ||
this.property1 = msg; | ||
}DP$0(class1, "prototype", {"configurable": false, "enumerable": false, "writable": false}); | ||
class1.sayStatic = function() { return "[static:class1]" } | ||
$static$0.sayStatic = function() { return "[static:class1]" }; | ||
class1.prototype.say = function() { return "class1:" + this.property1 } | ||
;return class1;})(); | ||
$proto$0.say = function() { return "class1:" + this.property1 }; | ||
MIXIN$0(class1,$static$0);MIXIN$0(class1.prototype,$proto$0);$static$0=$proto$0=void 0;return class1;})(); | ||
var super$0; | ||
var class2 = (function(super$1){"use strict";MIXIN$0(class2, super$1); | ||
class2.sayStatic = function(){ return super$1.sayStatic() + "[static:class2]" } | ||
var class2 = (function(super$1){"use strict";MIXIN$0(class2, super$1);var $static$0={},$proto$0={}; | ||
$static$0.sayStatic = function(){ return super$1.sayStatic() + "[static:class2]" }; | ||
@@ -23,10 +23,10 @@ //static A = 123; | ||
class2.prototype.say = function() {var a = arguments[0];if(a === void 0)a = 1;var b = (arguments[1] !== void 0 ? arguments[1] : [2])[0]; | ||
$proto$0.say = function() {var a = arguments[0];if(a === void 0)a = 1;var b = (arguments[1] !== void 0 ? arguments[1] : [2])[0]; | ||
return super$1.prototype.say.call(this) + "|class2" + ":" + this.property2 + "|" + a + "|" + b + ":" + class2.sayStatic(); | ||
} | ||
;return class2;})(class1); | ||
}; | ||
MIXIN$0(class2,$static$0);MIXIN$0(class2.prototype,$proto$0);$static$0=$proto$0=void 0;return class2;})(class1); | ||
var class3 = (function(super$1){"use strict";function class3() {super$1.apply(this, arguments)}MIXIN$0(class3, super$1);class3.prototype = Object.create(super$1.prototype, {"constructor": {"value": class3, "configurable": true, "writable": true} });DP$0(class3, "prototype", {"configurable": false, "enumerable": false, "writable": false}); | ||
class3.prototype.say = function(){return "class3"} | ||
;return class3;})(class1); | ||
var class3 = (function(super$1){"use strict";function class3() {super$1.apply(this, arguments)}MIXIN$0(class3, super$1);class3.prototype = Object.create(super$1.prototype, {"constructor": {"value": class3, "configurable": true, "writable": true} });DP$0(class3, "prototype", {"configurable": false, "enumerable": false, "writable": false});var $proto$0={}; | ||
$proto$0.say = function(){return "class3"}; | ||
MIXIN$0(class3.prototype,$proto$0);$proto$0=void 0;return class3;})(class1); | ||
@@ -33,0 +33,0 @@ //console.log(class2.A === 123); |
@@ -1,10 +0,10 @@ | ||
var DP$0 = Object.defineProperty;var MIXIN$0 = function(t,s){for(var p in s){if(s.hasOwnProperty(p)){DP$0(t,p,Object.getOwnPropertyDescriptor(s,p));}}return t};var class1 = (function(){"use strict";function class1(msg){this.property1 = msg;}DP$0(class1, "prototype", {"configurable": false, "enumerable": false, "writable": false});;class1.sayStatic = function() { return "[static:class1]" };class1.prototype.say = function() { return "class1:" + this.property1 };return class1;})(); | ||
var DP$0 = Object.defineProperty;var MIXIN$0 = function(t,s){for(var p in s){if(s.hasOwnProperty(p)){DP$0(t,p,Object.getOwnPropertyDescriptor(s,p));}}return t};var class1 = (function(){"use strict";var $static$0={},$proto$0={};function class1(msg){this.property1 = msg;}DP$0(class1, "prototype", {"configurable": false, "enumerable": false, "writable": false});;$static$0.sayStatic = function() { return "[static:class1]" };;$proto$0.say = function() { return "class1:" + this.property1 };MIXIN$0(class1,$static$0);MIXIN$0(class1.prototype,$proto$0);$static$0=$proto$0=void 0;return class1;})(); | ||
var super$0; | ||
var class2 = (function(super$1){"use strict";MIXIN$0(class2, super$1);class2.sayStatic = function(){ return super$1.sayStatic() + "[static:class2]" };function class2(message) {var message = message.message;super$0="test_super";super$1.call(this, message);this.property2 = message;}class2.prototype = Object.create(super$1.prototype, {"constructor": {"value": class2, "configurable": true, "writable": true} });DP$0(class2, "prototype", {"configurable": false, "enumerable": false, "writable": false});;class2.prototype.say = function() {var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol.iterator||'@@iterator';function ITER$0(v,f){if(v){if(Array.isArray(v))return f?v.slice():v;var i,r;if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){i=f.call(v);r=[];}else if((v+'')==='[object Generator]'){i=v;r=[];};if(r) {while((f=i['next']()),f['done']!==true)r.push(f['value']);return r;}}throw new Error(v+' is not iterable')};var a = arguments[0];if(a === void 0)a = [1];var b = arguments[1];if(b === void 0)b = [2];var arr = arguments[2];if(arr === void 0)arr = [ ].concat(ITER$0(a), ITER$0(b));return super$1.prototype.say.call(this) + "|arr:" + arr.join();};return class2;})(class1); | ||
var class2 = (function(super$1){"use strict";MIXIN$0(class2, super$1);var $static$0={},$proto$0={};$static$0.sayStatic = function(){ return super$1.sayStatic() + "[static:class2]" };;function class2(message) {var message = message.message;super$0="test_super";super$1.call(this, message);this.property2 = message;}class2.prototype = Object.create(super$1.prototype, {"constructor": {"value": class2, "configurable": true, "writable": true} });DP$0(class2, "prototype", {"configurable": false, "enumerable": false, "writable": false});;$proto$0.say = function() {var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol.iterator||'@@iterator';var S_MARK$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol["__setObjectSetter__"];function ITER$0(v,f){if(v){if(Array.isArray(v))return f?v.slice():v;var i,r;if(S_MARK$0)S_MARK$0(v);if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){i=f.call(v);r=[];}else if((v+'')==='[object Generator]'){i=v;r=[];};if(S_MARK$0)S_MARK$0(void 0);if(r) {while((f=i['next']()),f['done']!==true)r.push(f['value']);return r;}}throw new Error(v+' is not iterable')};var a = arguments[0];if(a === void 0)a = [1];var b = arguments[1];if(b === void 0)b = [2];var arr = arguments[2];if(arr === void 0)arr = [ ].concat(ITER$0(a), ITER$0(b));return super$1.prototype.say.call(this) + "|arr:" + arr.join();};MIXIN$0(class2,$static$0);MIXIN$0(class2.prototype,$proto$0);$static$0=$proto$0=void 0;return class2;})(class1); | ||
var class3 = (function(super$1){"use strict";function class3() {super$1.apply(this, arguments)}MIXIN$0(class3, super$1);class3.prototype = Object.create(super$1.prototype, {"constructor": {"value": class3, "configurable": true, "writable": true} });DP$0(class3, "prototype", {"configurable": false, "enumerable": false, "writable": false}); | ||
class3.prototype.say = function(){return "class3"} | ||
;return class3;})(class1); | ||
var class3 = (function(super$1){"use strict";function class3() {super$1.apply(this, arguments)}MIXIN$0(class3, super$1);class3.prototype = Object.create(super$1.prototype, {"constructor": {"value": class3, "configurable": true, "writable": true} });DP$0(class3, "prototype", {"configurable": false, "enumerable": false, "writable": false});var $proto$0={}; | ||
$proto$0.say = function(){return "class3"}; | ||
MIXIN$0(class3.prototype,$proto$0);$proto$0=void 0;return class3;})(class1); | ||
@@ -11,0 +11,0 @@ |
@@ -1,3 +0,3 @@ | ||
var DP$0 = Object.defineProperty;var class1 = (function(){"use strict";function class1(opts){this.class1=1;this.op1=opts.op1}DP$0(class1, "prototype", {"configurable": false, "enumerable": false, "writable": false});;return class1;})(); | ||
var class2 = (function(super$0){var MIXIN$0 = function(t,s){for(var p in s){if(s.hasOwnProperty(p)){DP$0(t,p,Object.getOwnPropertyDescriptor(s,p));}}return t};"use strict";function class2() {super$0.apply(this, arguments)}MIXIN$0(class2, super$0);class2.prototype = Object.create(super$0.prototype, {"constructor": {"value": class2, "configurable": true, "writable": true} });DP$0(class2, "prototype", {"configurable": false, "enumerable": false, "writable": false});class2.prototype.say = function(){return "class2"};return class2;})(class1); | ||
var DP$0 = Object.defineProperty;var MIXIN$0 = function(t,s){for(var p in s){if(s.hasOwnProperty(p)){DP$0(t,p,Object.getOwnPropertyDescriptor(s,p));}}return t};var class1 = (function(){"use strict";function class1(opts){this.class1=1;this.op1=opts.op1}DP$0(class1, "prototype", {"configurable": false, "enumerable": false, "writable": false});;return class1;})(); | ||
var class2 = (function(super$0){"use strict";function class2() {super$0.apply(this, arguments)}MIXIN$0(class2, super$0);class2.prototype = Object.create(super$0.prototype, {"constructor": {"value": class2, "configurable": true, "writable": true} });DP$0(class2, "prototype", {"configurable": false, "enumerable": false, "writable": false});var $proto$0={};$proto$0.say = function(){return "class2"};MIXIN$0(class2.prototype,$proto$0);$proto$0=void 0;return class2;})(class1); | ||
@@ -4,0 +4,0 @@ var a = new class2({op1: 99}); |
@@ -7,3 +7,3 @@ /* | ||
var arr = [{a: [1, 2, 3]}, {a: [4, 5, 6]}]; | ||
function test(first) {var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol.iterator||'@@iterator';function ITER$0(v,f){if(v){if(Array.isArray(v))return f?v.slice():v;var i,r;if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){i=f.call(v);r=[];}else if((v+'')==='[object Generator]'){i=v;r=[];};if(r) {while((f=i['next']()),f['done']!==true)r.push(f['value']);return r;}}throw new Error(v+' is not iterable')}; | ||
function test(first) {var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol.iterator||'@@iterator';var S_MARK$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol["__setObjectSetter__"];function ITER$0(v,f){if(v){if(Array.isArray(v))return f?v.slice():v;var i,r;if(S_MARK$0)S_MARK$0(v);if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){i=f.call(v);r=[];}else if((v+'')==='[object Generator]'){i=v;r=[];};if(S_MARK$0)S_MARK$0(void 0);if(r) {while((f=i['next']()),f['done']!==true)r.push(f['value']);return r;}}throw new Error(v+' is not iterable')}; | ||
if ( first ) { | ||
@@ -38,2 +38,2 @@ if ( first ) { | ||
console.log(test.call(obj, true) === 'undefined-1|2|3'); | ||
console.log(test.call(obj, false) === 'undefined-1|2|3'); | ||
console.log(test.call(obj, false) === 'undefined-1|2|3'); |
@@ -1,2 +0,2 @@ | ||
var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol.iterator||'@@iterator';function ITER$0(v,f){if(v){if(Array.isArray(v))return f?v.slice():v;var i,r;if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){i=f.call(v);r=[];}else if((v+'')==='[object Generator]'){i=v;r=[];};if(r) {while((f=i['next']()),f['done']!==true)r.push(f['value']);return r;}}throw new Error(v+' is not iterable')};var SLICE$0 = Array.prototype.slice;var $D$0; | ||
var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol.iterator||'@@iterator';var S_MARK$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol["__setObjectSetter__"];function ITER$0(v,f){if(v){if(Array.isArray(v))return f?v.slice():v;var i,r;if(S_MARK$0)S_MARK$0(v);if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){i=f.call(v);r=[];}else if((v+'')==='[object Generator]'){i=v;r=[];};if(S_MARK$0)S_MARK$0(void 0);if(r) {while((f=i['next']()),f['done']!==true)r.push(f['value']);return r;}}throw new Error(v+' is not iterable')};var SLICE$0 = Array.prototype.slice;var $D$0; | ||
{ | ||
@@ -3,0 +3,0 @@ var test11 = [1, 2, 3]; |
@@ -1,2 +0,2 @@ | ||
var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol.iterator||'@@iterator';function ITER$0(v,f){if(v){if(Array.isArray(v))return f?v.slice():v;var i,r;if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){i=f.call(v);r=[];}else if((v+'')==='[object Generator]'){i=v;r=[];};if(r) {while((f=i['next']()),f['done']!==true)r.push(f['value']);return r;}}throw new Error(v+' is not iterable')};function GET_ITER$0(v){if(v){if(Array.isArray(v))return 0;var f;if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function')return f.call(v);if((v+'')==='[object Generator]')return v;}throw new Error(v+' is not iterable')};var $D$0;var $D$1;var $D$2;var $D$3; | ||
var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol.iterator||'@@iterator';var S_MARK$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol["__setObjectSetter__"];function ITER$0(v,f){if(v){if(Array.isArray(v))return f?v.slice():v;var i,r;if(S_MARK$0)S_MARK$0(v);if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){i=f.call(v);r=[];}else if((v+'')==='[object Generator]'){i=v;r=[];};if(S_MARK$0)S_MARK$0(void 0);if(r) {while((f=i['next']()),f['done']!==true)r.push(f['value']);return r;}}throw new Error(v+' is not iterable')};function GET_ITER$0(v){if(v){if(Array.isArray(v))return 0;var f;if(S_MARK$0)S_MARK$0(v);if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){if(S_MARK$0)S_MARK$0(void 0);return f.call(v);}if(S_MARK$0)S_MARK$0(void 0);if((v+'')==='[object Generator]')return v;}throw new Error(v+' is not iterable')};var $D$0;var $D$1;var $D$2;var $D$3; | ||
{ | ||
@@ -8,5 +8,5 @@ var test; | ||
var output = []; | ||
var test$0;$D$3 = (( function(x) {return [{test: x + 1}, {test: x + 2}, {test: x + 3}]})(2));$D$0 = GET_ITER$0($D$3);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? $D$3.length : void 0);for( ; $D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"]; ){;test$0 = ($D$2 ? $D$3[$D$0++] : $D$1["value"]).test; | ||
var test$0=void 0;$D$3 = (( function(x) {return [{test: x + 1}, {test: x + 2}, {test: x + 3}]})(2));$D$0 = GET_ITER$0($D$3);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? $D$3.length : void 0);for( ;$D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"];){test$0 = ($D$2 ? $D$3[$D$0++] : $D$1["value"]).test; | ||
output.push(test$0) | ||
};$D$0 = $D$1 = $D$2 = $D$3 = void 0; | ||
};$D$0 = $D$1 = $D$2 = $D$3 = void 0;test$0=void 0; | ||
console.log(output.join("|") === [3, 4, 5].join("|")) | ||
@@ -27,5 +27,5 @@ } | ||
var arr = [2, 1, 0] | ||
var test$1, a$0, b$0, c$0;$D$3 = (retArr.apply(null, ITER$0(arr)));$D$0 = GET_ITER$0($D$3);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? $D$3.length : void 0);for( ; $D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"]; ){;test$1 = (c$0 = ($D$2 ? $D$3[$D$0++] : $D$1["value"])).test, a$0 = ((a$0 = c$0.a) === void 0 ? 1 : a$0), b$0 = ((b$0 = c$0.b) === void 0 ? 2 : b$0), c$0 = ((c$0 = c$0.c) === void 0 ? 3 : c$0); | ||
var test$1=void 0, a$0=void 0, b$0=void 0, c$0=void 0;$D$3 = (retArr.apply(null, ITER$0(arr)));$D$0 = GET_ITER$0($D$3);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? $D$3.length : void 0);for( ;$D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"];){test$1 = (c$0 = ($D$2 ? $D$3[$D$0++] : $D$1["value"])).test, a$0 = ((a$0 = c$0.a) === void 0 ? 1 : a$0), b$0 = ((b$0 = c$0.b) === void 0 ? 2 : b$0), c$0 = ((c$0 = c$0.c) === void 0 ? 3 : c$0); | ||
output$0.push(test$1 + (a$0 + b$0 + c$0)) | ||
};$D$0 = $D$1 = $D$2 = $D$3 = void 0; | ||
};$D$0 = $D$1 = $D$2 = $D$3 = void 0;test$1=void 0;a$0=void 0;b$0=void 0;c$0=void 0; | ||
console.log(output$0.join("|") === [10, 8, 6].join("|")) | ||
@@ -36,9 +36,9 @@ | ||
var arr$0 = [2, 1, 0]; | ||
var test$2, a$1, b$1, c$1;$D$3 = (( function(a, b, c) {return [ | ||
var test$2=void 0, a$1=void 0, b$1=void 0, c$1=void 0;$D$3 = (( function(a, b, c) {return [ | ||
{test: a + 1, a: a} //{test: 3, a: 2} | ||
, {test: b + 2, b: b} //{test: 3, b: 1} | ||
, {test: c + 3, c: c} //{test: 3, c: 0} | ||
]}).apply(null, ITER$0(arr$0)));$D$0 = GET_ITER$0($D$3);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? $D$3.length : void 0);for( ; $D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"]; ){;test$2 = (c$1 = ($D$2 ? $D$3[$D$0++] : $D$1["value"])).test, a$1 = ((a$1 = c$1.a) === void 0 ? 1 : a$1), b$1 = ((b$1 = c$1.b) === void 0 ? 2 : b$1), c$1 = ((c$1 = c$1.c) === void 0 ? 3 : c$1); | ||
]}).apply(null, ITER$0(arr$0)));$D$0 = GET_ITER$0($D$3);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? $D$3.length : void 0);for( ;$D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"];){test$2 = (c$1 = ($D$2 ? $D$3[$D$0++] : $D$1["value"])).test, a$1 = ((a$1 = c$1.a) === void 0 ? 1 : a$1), b$1 = ((b$1 = c$1.b) === void 0 ? 2 : b$1), c$1 = ((c$1 = c$1.c) === void 0 ? 3 : c$1); | ||
output$1.push(test$2 + (a$1 + b$1 + c$1)) | ||
};$D$0 = $D$1 = $D$2 = $D$3 = void 0; | ||
};$D$0 = $D$1 = $D$2 = $D$3 = void 0;test$2=void 0;a$1=void 0;b$1=void 0;c$1=void 0; | ||
console.log(output$1.join("|") === [10, 8, 6].join("|")) | ||
@@ -54,5 +54,5 @@ } | ||
var output$2 = [];var arr$1 = [8, 9]; | ||
var value, index;$D$3 = (arr$1.push(10), arr$1.map(function(value, index){return [value, index]}));$D$0 = GET_ITER$0($D$3);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? $D$3.length : void 0);for( ; $D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"]; ){;value = (index = ($D$2 ? $D$3[$D$0++] : $D$1["value"]))[0], index = index[1]; | ||
var value=void 0, index=void 0;$D$3 = (arr$1.push(10), arr$1.map(function(value, index){return [value, index]}));$D$0 = GET_ITER$0($D$3);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? $D$3.length : void 0);for( ;$D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"];){value = (index = ($D$2 ? $D$3[$D$0++] : $D$1["value"]))[0], index = index[1]; | ||
output$2.push(value) | ||
};$D$0 = $D$1 = $D$2 = $D$3 = void 0; | ||
};$D$0 = $D$1 = $D$2 = $D$3 = void 0;value=void 0;index=void 0; | ||
console.log(output$2.join("|") === [8, 9, 10].join("|")) | ||
@@ -63,6 +63,6 @@ } | ||
var output$3 = [];var arr$2 = [8, 9]; | ||
var value$0, index$0;$D$3 = (arr$2.push(10), arr$2.map(function(){var SLICE$0 = Array.prototype.slice;var r = SLICE$0.call(arguments, 0);return r}));$D$0 = GET_ITER$0($D$3);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? $D$3.length : void 0);for( ; $D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"]; ){;value$0 = (index$0 = ($D$2 ? $D$3[$D$0++] : $D$1["value"]))[0], index$0 = index$0[1]; | ||
var value$0=void 0, index$0=void 0;$D$3 = (arr$2.push(10), arr$2.map(function(){var SLICE$0 = Array.prototype.slice;var r = SLICE$0.call(arguments, 0);return r}));$D$0 = GET_ITER$0($D$3);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? $D$3.length : void 0);for( ;$D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"];){value$0 = (index$0 = ($D$2 ? $D$3[$D$0++] : $D$1["value"]))[0], index$0 = index$0[1]; | ||
output$3.push(value$0) | ||
};$D$0 = $D$1 = $D$2 = $D$3 = void 0; | ||
};$D$0 = $D$1 = $D$2 = $D$3 = void 0;value$0=void 0;index$0=void 0; | ||
console.log(output$3.join("|") === [8, 9, 10].join("|")) | ||
} |
@@ -5,3 +5,3 @@ "use strict"; | ||
var result = []; | ||
$D$2 = 0;$D$3 = someArrayLike.length;for( var item ; $D$2 < $D$3; ){item = (someArrayLike[$D$2++]); | ||
$D$2 = 0;$D$3 = someArrayLike.length;for( var item ;$D$2 < $D$3;){item = (someArrayLike[$D$2++]); | ||
result.push(item); | ||
@@ -17,3 +17,3 @@ };$D$2 = $D$3 = void 0; | ||
function test_ArrayComprehensions(someArrayLike) { | ||
return (function(){var $D$0;var $D$1;var $result$0 = [], x;$D$0 = 0;$D$1 = someArrayLike.length;for(; $D$0 < $D$1; ){x = (someArrayLike[$D$0++]);{$result$0.push(x)}};;return $result$0})() | ||
return (function(){var $D$0;var $D$1;var $result$0 = [], x;$D$0 = 0;$D$1 = someArrayLike.length;for(;$D$0 < $D$1;){x = (someArrayLike[$D$0++]);{$result$0.push(x)}};return $result$0})() | ||
} | ||
@@ -23,2 +23,2 @@ { | ||
console.log(test_ArrayComprehensions(arr$0).join("|") === arr$0.join("|")); | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol.iterator||'@@iterator';function GET_ITER$0(v){if(v){if(Array.isArray(v))return 0;var f;if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function')return f.call(v);if((v+'')==='[object Generator]')return v;}throw new Error(v+' is not iterable')};var $D$0;var $D$1;var $D$2;var $D$3;var $D$4;var $D$5;var $D$6;var $D$7;var $D$8;var $D$9;var $D$10;var $D$11; | ||
var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol.iterator||'@@iterator';var S_MARK$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol["__setObjectSetter__"];function GET_ITER$0(v){if(v){if(Array.isArray(v))return 0;var f;if(S_MARK$0)S_MARK$0(v);if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){if(S_MARK$0)S_MARK$0(void 0);return f.call(v);}if(S_MARK$0)S_MARK$0(void 0);if((v+'')==='[object Generator]')return v;}throw new Error(v+' is not iterable')};var $D$0;var $D$1;var $D$2;var $D$3;var $D$4;var $D$5;var $D$6;var $D$7;var $D$8;var $D$9;var $D$10;var $D$11; | ||
var output; | ||
@@ -6,3 +6,3 @@ | ||
var a1 = [1], b2 = []; | ||
$D$0 = GET_ITER$0(a1);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? a1.length : void 0);for( var x ; $D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"]; ){x = ($D$2 ? a1[$D$0++] : $D$1["value"]);(function(x){ | ||
$D$0 = GET_ITER$0(a1);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? a1.length : void 0);for( var x ;$D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"];){x = ($D$2 ? a1[$D$0++] : $D$1["value"]);(function(x){ | ||
b2.push(function(){ return x }) | ||
@@ -16,3 +16,3 @@ })(x);};$D$0 = $D$1 = $D$2 = void 0; | ||
var arr = [1, 2, 3] | ||
$D$0 = GET_ITER$0(arr);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? arr.length : void 0);for(var f ; $D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"]; ){f = ($D$2 ? arr[$D$0++] : $D$1["value"]); | ||
$D$0 = GET_ITER$0(arr);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? arr.length : void 0);for(var f ;$D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"];){f = ($D$2 ? arr[$D$0++] : $D$1["value"]); | ||
output.push(f) | ||
@@ -24,3 +24,3 @@ };$D$0 = $D$1 = $D$2 = void 0; | ||
{output = []; | ||
$D$3 = ([1, 2, 3]);$D$0 = GET_ITER$0($D$3);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? $D$3.length : void 0);for(var f$0 ; $D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"]; ){f$0 = ($D$2 ? $D$3[$D$0++] : $D$1["value"]); | ||
$D$3 = ([1, 2, 3]);$D$0 = GET_ITER$0($D$3);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? $D$3.length : void 0);for(var f$0 ;$D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"];){f$0 = ($D$2 ? $D$3[$D$0++] : $D$1["value"]); | ||
output.push(f$0) | ||
@@ -31,3 +31,3 @@ };$D$0 = $D$1 = $D$2 = $D$3 = void 0; | ||
{ | ||
output = [];$D$3 = (( function(x) {return [x + 1, x + 2, x + 3]})(1));$D$0 = GET_ITER$0($D$3);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? $D$3.length : void 0);for(var test ; $D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"]; ){test = ($D$2 ? $D$3[$D$0++] : $D$1["value"]); | ||
output = [];$D$3 = (( function(x) {return [x + 1, x + 2, x + 3]})(1));$D$0 = GET_ITER$0($D$3);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? $D$3.length : void 0);for(var test ;$D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"];){test = ($D$2 ? $D$3[$D$0++] : $D$1["value"]); | ||
output.push(test) | ||
@@ -40,3 +40,3 @@ };$D$0 = $D$1 = $D$2 = $D$3 = void 0;;console.log(output.join("|") === [2, 3, 4].join("|")) | ||
var arr$0 = [], i = 100; | ||
$D$3 = (arr$0.push(i++), arr$0.push(i++), arr$0.push(i++), arr$0);$D$0 = GET_ITER$0($D$3);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? $D$3.length : void 0);for(var f$1 ; $D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"]; ){f$1 = ($D$2 ? $D$3[$D$0++] : $D$1["value"]);(function(f){ | ||
$D$3 = (arr$0.push(i++), arr$0.push(i++), arr$0.push(i++), arr$0);$D$0 = GET_ITER$0($D$3);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? $D$3.length : void 0);for(var f$1 ;$D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"];){f$1 = ($D$2 ? $D$3[$D$0++] : $D$1["value"]);(function(f){ | ||
output$0.push(function() { | ||
@@ -52,3 +52,3 @@ return f; | ||
var arr$1 = [], i$0 = 100; | ||
$D$3 = (arr$1.push(i$0++), arr$1.push(i$0++), arr$1.push(i$0++), arr$1);$D$0 = GET_ITER$0($D$3);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? $D$3.length : void 0);for(var f$2 ; $D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"]; ){f$2 = ($D$2 ? $D$3[$D$0++] : $D$1["value"]);(function(f){ | ||
$D$3 = (arr$1.push(i$0++), arr$1.push(i$0++), arr$1.push(i$0++), arr$1);$D$0 = GET_ITER$0($D$3);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? $D$3.length : void 0);for(var f$2 ;$D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"];){f$2 = ($D$2 ? $D$3[$D$0++] : $D$1["value"]);(function(f){ | ||
output.push(function() { | ||
@@ -63,5 +63,5 @@ return f; | ||
output = []; | ||
$D$3 = (["a", "b", "c"]);$D$0 = GET_ITER$0($D$3);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? $D$3.length : void 0);for(var a ; $D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"]; ){a = ($D$2 ? $D$3[$D$0++] : $D$1["value"]); | ||
$D$7 = ([1, 2, 3]);$D$4 = GET_ITER$0($D$7);$D$6 = $D$4 === 0;$D$5 = ($D$6 ? $D$7.length : void 0);for(var b = void 0 ; $D$6 ? ($D$4 < $D$5) : !($D$5 = $D$4["next"]())["done"]; ){b = ($D$6 ? $D$7[$D$4++] : $D$5["value"]); | ||
$D$11 = (["-", "=", "/"]);$D$8 = GET_ITER$0($D$11);$D$10 = $D$8 === 0;$D$9 = ($D$10 ? $D$11.length : void 0);for(var c = void 0 ; $D$10 ? ($D$8 < $D$9) : !($D$9 = $D$8["next"]())["done"]; ){c = ($D$10 ? $D$11[$D$8++] : $D$9["value"]); | ||
$D$3 = (["a", "b", "c"]);$D$0 = GET_ITER$0($D$3);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? $D$3.length : void 0);for(var a ;$D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"];){a = ($D$2 ? $D$3[$D$0++] : $D$1["value"]); | ||
$D$7 = ([1, 2, 3]);$D$4 = GET_ITER$0($D$7);$D$6 = $D$4 === 0;$D$5 = ($D$6 ? $D$7.length : void 0);for(var b = void 0 ;$D$6 ? ($D$4 < $D$5) : !($D$5 = $D$4["next"]())["done"];){b = ($D$6 ? $D$7[$D$4++] : $D$5["value"]); | ||
$D$11 = (["-", "=", "/"]);$D$8 = GET_ITER$0($D$11);$D$10 = $D$8 === 0;$D$9 = ($D$10 ? $D$11.length : void 0);for(var c = void 0 ;$D$10 ? ($D$8 < $D$9) : !($D$9 = $D$8["next"]())["done"];){c = ($D$10 ? $D$11[$D$8++] : $D$9["value"]); | ||
output.push(a + b + c); | ||
@@ -68,0 +68,0 @@ };$D$8 = $D$9 = $D$10 = $D$11 = void 0;; |
@@ -1,2 +0,2 @@ | ||
var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol.iterator||'@@iterator';function GET_ITER$0(v){if(v){if(Array.isArray(v))return 0;var f;if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function')return f.call(v);if((v+'')==='[object Generator]')return v;}throw new Error(v+' is not iterable')};var $D$0;var $D$1;var $D$2;var $D$3; | ||
var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol.iterator||'@@iterator';var S_MARK$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol["__setObjectSetter__"];function GET_ITER$0(v){if(v){if(Array.isArray(v))return 0;var f;if(S_MARK$0)S_MARK$0(v);if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){if(S_MARK$0)S_MARK$0(void 0);return f.call(v);}if(S_MARK$0)S_MARK$0(void 0);if((v+'')==='[object Generator]')return v;}throw new Error(v+' is not iterable')};var $D$0;var $D$1;var $D$2;var $D$3;var $D$4;var $D$5; | ||
var output = []; | ||
@@ -8,6 +8,6 @@ var i = 0; | ||
var f;$D$0 = GET_ITER$0(arr);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? arr.length : void 0);for( ; $D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"]; ) | ||
{;f = ((f = ($D$2 ? arr[$D$0++] : $D$1["value"]).a) === void 0 ? 9 : f);1,output$0.push(f),2 | ||
var f=void 0;$D$0 = GET_ITER$0(arr);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? arr.length : void 0);for( ;$D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"];) | ||
{f = ((f = ($D$2 ? arr[$D$0++] : $D$1["value"]).a) === void 0 ? 9 : f);1,output$0.push(f),2 | ||
};$D$0 = $D$1 = $D$2 = void 0;console.log(output$0.join("|") === [1, 2, 3, 4, 9].join("|")) | ||
};$D$0 = $D$1 = $D$2 = void 0;f=void 0;console.log(output$0.join("|") === [1, 2, 3, 4, 9].join("|")) | ||
} | ||
@@ -20,4 +20,5 @@ | ||
{ | ||
output = []; | ||
var arr$1 = [1, 2, 3]; | ||
$D$0 = GET_ITER$0(arr$1);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? arr$1.length : void 0);for(var f$1 ; $D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"]; ){f$1 = ($D$2 ? arr$1[$D$0++] : $D$1["value"]); | ||
$D$0 = GET_ITER$0(arr$1);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? arr$1.length : void 0);for(var f$1 ;$D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"];){f$1 = ($D$2 ? arr$1[$D$0++] : $D$1["value"]); | ||
output.push(f$1); | ||
@@ -30,11 +31,43 @@ };$D$0 = $D$1 = $D$2 = void 0;; | ||
{ | ||
i = 0; | ||
output = []; | ||
var arr$2 = [1, 2, 3]; | ||
$D$3 = (arr$2.push(i++), arr$2.push(i++), arr$2.push(i++), arr$2);$D$0 = GET_ITER$0($D$3);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? $D$3.length : void 0);for(var f$2 ; $D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"]; ){f$2 = ($D$2 ? $D$3[$D$0++] : $D$1["value"]); | ||
$D$3 = (arr$2.push(i++), arr$2.push(i++), arr$2.push(i++), arr$2);$D$0 = GET_ITER$0($D$3);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? $D$3.length : void 0);for(var f$2 ;$D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"];){f$2 = ($D$2 ? $D$3[$D$0++] : $D$1["value"]); | ||
output.push(f$2); | ||
};$D$0 = $D$1 = $D$2 = $D$3 = void 0;; | ||
console.log(output.join("|") === "1|2|3|1|2|3|0|1|2") | ||
console.log(output.join("|") === [1, 2, 3, 0, 1, 2].join("|"), arr$2.join("|") === [1, 2, 3, 0, 1, 2].join("|")) | ||
} | ||
{ | ||
var arr$3,f$3; | ||
} | ||
output = []; | ||
var arr$3 = [{a: 1}, {a: 2}, {a: 3}]; | ||
var b=void 0;$D$0 = GET_ITER$0(arr$3);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? arr$3.length : void 0);for( ;$D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"];){b = ($D$2 ? arr$3[$D$0++] : $D$1["value"]).a;var a$0=void 0;$D$3 = GET_ITER$0(arr$3);$D$5 = $D$3 === 0;$D$4 = ($D$5 ? arr$3.length : void 0);for( ;$D$5 ? ($D$3 < $D$4) : !($D$4 = $D$3["next"]())["done"];){a$0 = ($D$5 ? arr$3[$D$3++] : $D$4["value"]).a; | ||
output.push(a$0 + "|" + b); | ||
}};$D$0 = $D$1 = $D$2 = void 0;b=void 0;;$D$3 = $D$4 = $D$5 = void 0;a$0=void 0;; | ||
var result = [].concat.apply([], arr$3.map(function(b) {b = b.a; | ||
return arr$3.map(function(a) {a = a.a; | ||
return a + "|" + b; | ||
}); | ||
})); | ||
console.log(output.join("|") === result.join("|")) | ||
} | ||
{ | ||
output = []; | ||
var arr1 = [{a: 1}, {a: 2}, {a: 3}]; | ||
var arr2 = [{y: 1, b: 'a'}, {y: 2, b: 'b'}, {y: 3, b: 'c'}]; | ||
var a;$D$0 = GET_ITER$0(arr1);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? arr1.length : void 0);for( ;$D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"];){a = ($D$2 ? arr1[$D$0++] : $D$1["value"]).a;var y=void 0, a1=void 0;$D$3 = GET_ITER$0(arr2);$D$5 = $D$3 === 0;$D$4 = ($D$5 ? arr2.length : void 0);for ( ;$D$5 ? ($D$3 < $D$4) : !($D$4 = $D$3["next"]())["done"];){y = (a1 = ($D$5 ? arr2[$D$3++] : $D$4["value"])).y, a1 = a1.b; | ||
output.push(a + a1 + y); | ||
}};$D$0 = $D$1 = $D$2 = void 0;;$D$3 = $D$4 = $D$5 = void 0;y=void 0;a1=void 0; | ||
var result$0 = [].concat.apply([], arr1.map(function(a) {a = a.a; | ||
return arr2.map(function(b) {var y = b.y, a1 = b.b; | ||
return a + a1 + y; | ||
}); | ||
})); | ||
console.log(output.join("|") === result$0.join("|")) | ||
} | ||
{ | ||
var arr$4,f$3; | ||
} |
@@ -19,2 +19,3 @@ | ||
{ | ||
output = []; | ||
let arr = [1, 2, 3]; | ||
@@ -29,2 +30,4 @@ for(let f of arr ) { | ||
{ | ||
i = 0; | ||
output = []; | ||
let arr = [1, 2, 3]; | ||
@@ -34,7 +37,37 @@ for(let f of ( arr.push(i++), arr.push(i++), arr.push(i++), arr ) ) { | ||
}; | ||
console.log(output.join("|") === "1|2|3|1|2|3|0|1|2") | ||
console.log(output.join("|") === [1, 2, 3, 0, 1, 2].join("|"), arr.join("|") === [1, 2, 3, 0, 1, 2].join("|")) | ||
} | ||
{ | ||
output = []; | ||
let arr = [{a: 1}, {a: 2}, {a: 3}]; | ||
for(let {a: b} of arr ) for(let {a} of arr ) { | ||
output.push(a + "|" + b); | ||
}; | ||
let result = [].concat.apply([], arr.map(function(b) {b = b.a; | ||
return arr.map(function(a) {a = a.a; | ||
return a + "|" + b; | ||
}); | ||
})); | ||
console.log(output.join("|") === result.join("|")) | ||
} | ||
{ | ||
output = []; | ||
let arr1 = [{a: 1}, {a: 2}, {a: 3}]; | ||
let arr2 = [{y: 1, b: 'a'}, {y: 2, b: 'b'}, {y: 3, b: 'c'}]; | ||
for( var {a} of arr1 ) for ( let {y, b: a1} of arr2){ | ||
output.push(a + a1 + y); | ||
} | ||
let result = [].concat.apply([], arr1.map(function(a) {a = a.a; | ||
return arr2.map(function(b) {var y = b.y, a1 = b.b; | ||
return a + a1 + y; | ||
}); | ||
})); | ||
console.log(output.join("|") === result.join("|")) | ||
} | ||
{ | ||
let arr,f; | ||
} | ||
} |
var a = 1; | ||
function matchAttributes(attributes) {var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol.iterator||'@@iterator';function GET_ITER$0(v){if(v){if(Array.isArray(v))return 0;var f;if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function')return f.call(v);if((v+'')==='[object Generator]')return v;}throw new Error(v+' is not iterable')};var $D$0;var $D$1;var $D$2; | ||
$D$0 = GET_ITER$0(attributes);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? attributes.length : void 0);for( var attrRule ; $D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"]; ){attrRule = ($D$2 ? attributes[$D$0++] : $D$1["value"]); | ||
function matchAttributes(attributes) {var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol.iterator||'@@iterator';var S_MARK$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol["__setObjectSetter__"];function GET_ITER$0(v){if(v){if(Array.isArray(v))return 0;var f;if(S_MARK$0)S_MARK$0(v);if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){if(S_MARK$0)S_MARK$0(void 0);return f.call(v);}if(S_MARK$0)S_MARK$0(void 0);if((v+'')==='[object Generator]')return v;}throw new Error(v+' is not iterable')};var $D$0;var $D$1;var $D$2; | ||
$D$0 = GET_ITER$0(attributes);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? attributes.length : void 0);for( var attrRule ;$D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"];){attrRule = ($D$2 ? attributes[$D$0++] : $D$1["value"]); | ||
@@ -6,0 +6,0 @@ };$D$0 = $D$1 = $D$2 = void 0; |
@@ -7,4 +7,4 @@ /** | ||
*/ | ||
function /*comment 1*/ test1 /*comment2*/ (/** @type {number} */) {var a = arguments[0];if(a === void 0)a = 1;var b = arguments[1];if(b === void 0)b = 2;var c = arguments[2];if(c === void 0)c = {}; //some comment | ||
"use strict"; | ||
function /*comment 1*/ test1 /*comment2*/ (/** @type {number} */) { //some comment | ||
"use strict";var a = arguments[0];if(a === void 0)a = 1;var b = arguments[1];if(b === void 0)b = 2;var c = arguments[2];if(c === void 0)c = {}; | ||
@@ -26,4 +26,4 @@ console.log(a === 32, b === 2, typeof c === "object"); | ||
)// function declaration comment | ||
{var a = arguments[0];if(a === void 0)a = 123;var b = arguments[1];if(b === void 0)b = 234;var c = arguments[2];if(c === void 0)c = 345;var d = arguments[3];if(d === void 0)d = 456;// function body comment | ||
"use strict"; | ||
{// function body comment | ||
"use strict";var a = arguments[0];if(a === void 0)a = 123;var b = arguments[1];if(b === void 0)b = 234;var c = arguments[2];if(c === void 0)c = 345;var d = arguments[3];if(d === void 0)d = 456; | ||
@@ -30,0 +30,0 @@ console.log(a === 123, b === 234, c === 345, d === 456); |
@@ -1,2 +0,2 @@ | ||
var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol.iterator||'@@iterator';function ITER$0(v,f){if(v){if(Array.isArray(v))return f?v.slice():v;var i,r;if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){i=f.call(v);r=[];}else if((v+'')==='[object Generator]'){i=v;r=[];};if(r) {while((f=i['next']()),f['done']!==true)r.push(f['value']);return r;}}throw new Error(v+' is not iterable')};"use strict"; | ||
"use strict";var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol.iterator||'@@iterator';var S_MARK$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol["__setObjectSetter__"];function ITER$0(v,f){if(v){if(Array.isArray(v))return f?v.slice():v;var i,r;if(S_MARK$0)S_MARK$0(v);if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){i=f.call(v);r=[];}else if((v+'')==='[object Generator]'){i=v;r=[];};if(S_MARK$0)S_MARK$0(void 0);if(r) {while((f=i['next']()),f['done']!==true)r.push(f['value']);return r;}}throw new Error(v+' is not iterable')}; | ||
@@ -3,0 +3,0 @@ function test1(a) {var b = arguments[1];if(b === void 0)b = {c: 1};var c = (arguments[2] !== void 0 ? arguments[2] : b).c; |
@@ -1,2 +0,2 @@ | ||
var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol.iterator||'@@iterator';function GET_ITER$0(v){if(v){if(Array.isArray(v))return 0;var f;if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function')return f.call(v);if((v+'')==='[object Generator]')return v;}throw new Error(v+' is not iterable')};var $D$0;var $D$1;var $D$2;var $D$3;var e; | ||
var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol.iterator||'@@iterator';var S_MARK$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol["__setObjectSetter__"];function GET_ITER$0(v){if(v){if(Array.isArray(v))return 0;var f;if(S_MARK$0)S_MARK$0(v);if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){if(S_MARK$0)S_MARK$0(void 0);return f.call(v);}if(S_MARK$0)S_MARK$0(void 0);if((v+'')==='[object Generator]')return v;}throw new Error(v+' is not iterable')};var $D$0;var $D$1;var $D$2;var $D$3;var e; | ||
var a = 1, b = 2, c = 3; | ||
@@ -6,5 +6,5 @@ | ||
e = []; | ||
var a$0, b$0;$D$3 = ([{a: 1, b: 2}, {a: 11, b: 22}, {a: 111, b: 222}]);$D$0 = GET_ITER$0($D$3);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? $D$3.length : void 0);for( ; $D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"]; ){;a$0 = (b$0 = ($D$2 ? $D$3[$D$0++] : $D$1["value"])).a, b$0 = b$0.b;(function(a, b){ | ||
var a$0=void 0, b$0=void 0;$D$3 = ([{a: 1, b: 2}, {a: 11, b: 22}, {a: 111, b: 222}]);$D$0 = GET_ITER$0($D$3);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? $D$3.length : void 0);for( ;$D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"];){a$0 = (b$0 = ($D$2 ? $D$3[$D$0++] : $D$1["value"])).a, b$0 = b$0.b;(function(a, b){ | ||
e.push( function() {return a + b} ) | ||
})(a$0, b$0);};$D$0 = $D$1 = $D$2 = $D$3 = void 0; | ||
})(a$0, b$0);};$D$0 = $D$1 = $D$2 = $D$3 = void 0;a$0=void 0;b$0=void 0; | ||
@@ -16,9 +16,9 @@ console.log(e.map( function(x) {return x()} ).join("|") === "3|33|333") | ||
e = []; | ||
var firstChild;$D$3 = ([ | ||
var firstChild=void 0;$D$3 = ([ | ||
{ childrens: [ 1 , 2] } | ||
, { childrens: [ 2 , 3] } | ||
, { childrens: [ 3 , 4] } | ||
]);$D$0 = GET_ITER$0($D$3);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? $D$3.length : void 0);for( ; $D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"]; ){;firstChild = ($D$2 ? $D$3[$D$0++] : $D$1["value"]).childrens[0];(function(firstChild){ | ||
]);$D$0 = GET_ITER$0($D$3);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? $D$3.length : void 0);for( ;$D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"];){firstChild = ($D$2 ? $D$3[$D$0++] : $D$1["value"]).childrens[0];(function(firstChild){ | ||
e.push( function() {return firstChild} ) | ||
})(firstChild);};$D$0 = $D$1 = $D$2 = $D$3 = void 0; | ||
})(firstChild);};$D$0 = $D$1 = $D$2 = $D$3 = void 0;firstChild=void 0; | ||
@@ -41,3 +41,3 @@ console.log(e.map( function(x) {return x()} ).join("|") === "1|2|3") | ||
var str1 = ""; | ||
$D$0 = GET_ITER$0(someArray);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? someArray.length : void 0);for( var a$2 ; $D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"]; ){a$2 = ($D$2 ? someArray[$D$0++] : $D$1["value"]);(function(){ | ||
$D$0 = GET_ITER$0(someArray);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? someArray.length : void 0);for( var a$2 ;$D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"];){a$2 = ($D$2 ? someArray[$D$0++] : $D$1["value"]);(function(){ | ||
var b = a$2.b, c = a$2.c; | ||
@@ -44,0 +44,0 @@ |
@@ -1,8 +0,9 @@ | ||
var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol.iterator||'@@iterator';function ITER$0(v,f){if(v){if(Array.isArray(v))return f?v.slice():v;var i,r;if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){i=f.call(v);r=[];}else if((v+'')==='[object Generator]'){i=v;r=[];};if(r) {while((f=i['next']()),f['done']!==true)r.push(f['value']);return r;}}throw new Error(v+' is not iterable')};"use strict"; | ||
"use strict";var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol.iterator||'@@iterator';var S_MARK$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol["__setObjectSetter__"];function ITER$0(v,f){if(v){if(Array.isArray(v))return f?v.slice():v;var i,r;if(S_MARK$0)S_MARK$0(v);if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){i=f.call(v);r=[];}else if((v+'')==='[object Generator]'){i=v;r=[];};if(S_MARK$0)S_MARK$0(void 0);if(r) {while((f=i['next']()),f['done']!==true)r.push(f['value']);return r;}}throw new Error(v+' is not iterable')}; | ||
var arr, res, loop, call = function(callback){ return callback()}; | ||
/*es6-transpiler generators:false*/ | ||
// yield support | ||
arr = []; | ||
function *gen() {;var $args$0=arguments; | ||
for (var x = 0; x < 9; x++) {;var $yieldVal$0, $value$0 = (function(){ | ||
for (var x = 0; x < 9; x++) {;var $yieldVal$0;var $value$0 = (function(){ | ||
var y = x, z = $args$0[x]; | ||
@@ -19,3 +20,3 @@ arr.push(function() { return y; }); | ||
function *gen_primitive() {;var $args$0=arguments; | ||
for (var x = 0; x < 9; x++) {;var $yieldPrim$0, $value$0 = (function(){ | ||
for (var x = 0; x < 9; x++) {;var $yieldPrim$0;var $value$0 = (function(){ | ||
var y = x, z = $args$0[x]; | ||
@@ -22,0 +23,0 @@ arr.push(function() { return y; }); |
"use strict"; | ||
var arr, res, loop, call = function(callback){ return callback()}; | ||
/*es6-transpiler generators:false*/ | ||
// yield support | ||
@@ -5,0 +6,0 @@ arr = []; |
@@ -1,2 +0,2 @@ | ||
var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol.iterator||'@@iterator';function GET_ITER$0(v){if(v){if(Array.isArray(v))return 0;var f;if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function')return f.call(v);if((v+'')==='[object Generator]')return v;}throw new Error(v+' is not iterable')};var $D$4;var $D$5;var $D$6;var $D$10;"use strict"; | ||
"use strict";var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol.iterator||'@@iterator';var S_MARK$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol["__setObjectSetter__"];function GET_ITER$0(v){if(v){if(Array.isArray(v))return 0;var f;if(S_MARK$0)S_MARK$0(v);if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){if(S_MARK$0)S_MARK$0(void 0);return f.call(v);}if(S_MARK$0)S_MARK$0(void 0);if((v+'')==='[object Generator]')return v;}throw new Error(v+' is not iterable')};var $D$4;var $D$5;var $D$6;var $D$10; | ||
var arr, res, loop, call = function(callback){ return callback()}; | ||
@@ -9,3 +9,3 @@ | ||
res = (function() {;var $that$0=this; | ||
label: for (var x = 0; x < 3; x++) {;var $retVoid$0;var $break$0;var $breaklabel$0;;var $retPrim$0, $value$0 = (function(){ | ||
label: for (var x = 0; x < 3; x++) {;var $retVal$0;var $retPrim$0;var $retVoid$0;var $break$0;var $breaklabel$0;var $value$0 = (function(){ | ||
var y = x; | ||
@@ -31,3 +31,3 @@ arr.push(function() { return y; }); | ||
function returnPrimitive() {var $D$0;var $D$1;var $D$2;var $D$3; | ||
$D$3 = ([1, 2, 3, 4, 5]);$D$0 = GET_ITER$0($D$3);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? $D$3.length : void 0);for ( var val ; $D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"]; ){val = ($D$2 ? $D$3[$D$0++] : $D$1["value"]);;var $retPrim$0, $value$0 = (function(){ | ||
$D$3 = ([1, 2, 3, 4, 5]);$D$0 = GET_ITER$0($D$3);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? $D$3.length : void 0);for ( var val ;$D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"];){val = ($D$2 ? $D$3[$D$0++] : $D$1["value"]);;var $retPrim$0;var $value$0 = (function(){ | ||
var innerVal = val; | ||
@@ -47,3 +47,3 @@ | ||
res = (function() {;var $args$0=arguments; | ||
for (var x = 0; x < 3; x++) {;var $retVal$0, $value$0 = (function(){ | ||
for (var x = 0; x < 3; x++) {;var $retVal$0;var $value$0 = (function(){ | ||
var y = x; | ||
@@ -82,3 +82,3 @@ var z = $args$0[0]; | ||
var a = [1, 2, 3, 4, 5]; | ||
$D$4 = GET_ITER$0(a);$D$6 = $D$4 === 0;$D$5 = ($D$6 ? a.length : void 0);for( var x$0 ; $D$6 ? ($D$4 < $D$5) : !($D$5 = $D$4["next"]())["done"]; ){x$0 = ($D$6 ? a[$D$4++] : $D$5["value"]);;var j, k, c, d, e, GG;var $break$0;(function(x){ | ||
$D$4 = GET_ITER$0(a);$D$6 = $D$4 === 0;$D$5 = ($D$6 ? a.length : void 0);for( var x$0 ;$D$6 ? ($D$4 < $D$5) : !($D$5 = $D$4["next"]())["done"];){x$0 = ($D$6 ? a[$D$4++] : $D$5["value"]);;var j, k, c, d, e, GG;var $break$0;(function(x){ | ||
;j = (e = {j: 1, k: 2, c: 3, d: {d: 4, e: 5}}).j, k = e.k, c = e.c, d = (e = e.d).d, e = e.e, GG = x; | ||
@@ -116,3 +116,3 @@ | ||
// this test | ||
arr = (function() {var this$0 = this;;var $that$0=this;;var $that$0=this;;var $args$0=arguments;'use strict';var arr = [];var temp; | ||
arr = (function() {'use strict';;var $that$0=this;;var $args$0=arguments;var this$0 = this;var arr = [];var temp; | ||
@@ -135,7 +135,7 @@ // Block-less For-In | ||
var a = [1, 2, 3, 4, 5]; | ||
$D$7 = GET_ITER$0(a);$D$9 = $D$7 === 0;$D$8 = ($D$9 ? a.length : void 0);for( var x ; $D$9 ? ($D$7 < $D$8) : !($D$8 = $D$7["next"]())["done"]; ){x = ($D$9 ? a[$D$7++] : $D$8["value"]);;var $break$0;;var $retVal$0, $value$0 = (function(x){ | ||
$D$7 = GET_ITER$0(a);$D$9 = $D$7 === 0;$D$8 = ($D$9 ? a.length : void 0);for( var x ;$D$9 ? ($D$7 < $D$8) : !($D$8 = $D$7["next"]())["done"];){x = ($D$9 ? a[$D$7++] : $D$8["value"]);;var $break$0;var $retVal$0;var $value$0 = (function(x){ | ||
arr.push(function(){ return x }); | ||
if(x==1)return; | ||
if(x==2&&false){$break$0 = true;return} | ||
if(x==3){$retVal$0 = true;return $args$0[2];} | ||
if(x==3){{$retVal$0 = true;return $args$0[2];}} | ||
})(x);if($break$0===true){$break$0=void 0;break }if($retVal$0===true){try{throw $value$0 }catch($rp$0){$value$0=$retVal$0=void 0;return $rp$0}}};$D$7 = $D$8 = $D$9 = void 0; | ||
@@ -147,3 +147,3 @@ })(9, 8, 7); | ||
arr = []; | ||
$D$10 = ([1, 2, 3, 4, 5]);$D$4 = GET_ITER$0($D$10);$D$6 = $D$4 === 0;$D$5 = ($D$6 ? $D$10.length : void 0);for( var x22 ; $D$6 ? ($D$4 < $D$5) : !($D$5 = $D$4["next"]())["done"]; ){x22 = ($D$6 ? $D$10[$D$4++] : $D$5["value"]);(function(){ | ||
$D$10 = ([1, 2, 3, 4, 5]);$D$4 = GET_ITER$0($D$10);$D$6 = $D$4 === 0;$D$5 = ($D$6 ? $D$10.length : void 0);for( var x22 ;$D$6 ? ($D$4 < $D$5) : !($D$5 = $D$4["next"]())["done"];){x22 = ($D$6 ? $D$10[$D$4++] : $D$5["value"]);(function(){ | ||
var y = x22, z = 55; | ||
@@ -157,3 +157,3 @@ arr.push(function(){ return y }); | ||
arr = [];var random__ = Math.random(); | ||
$D$10 = ([{a: {x: 1, y: 2, z: 3}}]);$D$4 = GET_ITER$0($D$10);$D$6 = $D$4 === 0;$D$5 = ($D$6 ? $D$10.length : void 0);for( var x11 ; $D$6 ? ($D$4 < $D$5) : !($D$5 = $D$4["next"]())["done"]; ){x11 = ($D$6 ? $D$10[$D$4++] : $D$5["value"]);(function(){ | ||
$D$10 = ([{a: {x: 1, y: 2, z: 3}}]);$D$4 = GET_ITER$0($D$10);$D$6 = $D$4 === 0;$D$5 = ($D$6 ? $D$10.length : void 0);for( var x11 ;$D$6 ? ($D$4 < $D$5) : !($D$5 = $D$4["next"]())["done"];){x11 = ($D$6 ? $D$10[$D$4++] : $D$5["value"]);(function(){ | ||
var x = (z = x11.a).x, y = z.y, z = z.z, h = 55; | ||
@@ -172,13 +172,13 @@ | ||
arr = []; | ||
var x$2, y, z;$D$10 = ([{x:1,y:0}, {x:1,y:1}, {x:1,y:2}]);$D$4 = GET_ITER$0($D$10);$D$6 = $D$4 === 0;$D$5 = ($D$6 ? $D$10.length : void 0);for( ; $D$6 ? ($D$4 < $D$5) : !($D$5 = $D$4["next"]())["done"]; ){;x$2 = (z = ($D$6 ? $D$10[$D$4++] : $D$5["value"])).x, y = z.y, z = z.z;;var $break$0;(function(x, y, z){ | ||
var x$2=void 0, y=void 0, z=void 0;$D$10 = ([{x:1,y:0}, {x:1,y:1}, {x:1,y:2}]);$D$4 = GET_ITER$0($D$10);$D$6 = $D$4 === 0;$D$5 = ($D$6 ? $D$10.length : void 0);for( ;$D$6 ? ($D$4 < $D$5) : !($D$5 = $D$4["next"]())["done"];){x$2 = (z = ($D$6 ? $D$10[$D$4++] : $D$5["value"])).x, y = z.y, z = z.z;;var $break$0;(function(x, y, z){ | ||
arr.push(function(){ return x + y }); | ||
{$break$0 = true;return} | ||
})(x$2, y, z);if($break$0===true){$break$0=void 0;break }};$D$4 = $D$5 = $D$6 = $D$10 = void 0; | ||
})(x$2, y, z);if($break$0===true){$break$0=void 0;break }};$D$4 = $D$5 = $D$6 = $D$10 = void 0;x$2=void 0;y=void 0;z=void 0; | ||
var x$3, y$0, z$0;$D$10 = ([{x:1,y:0}, {x:1,y:1}, {x:1,y:2}]);$D$4 = GET_ITER$0($D$10);$D$6 = $D$4 === 0;$D$5 = ($D$6 ? $D$10.length : void 0);for( ; $D$6 ? ($D$4 < $D$5) : !($D$5 = $D$4["next"]())["done"]; ){;x$3 = (z$0 = ($D$6 ? $D$10[$D$4++] : $D$5["value"])).x, y$0 = z$0.y, z$0 = z$0.z;;var $break$0;(function(x, y, z){ | ||
var x$3=void 0, y$0=void 0, z$0=void 0;$D$10 = ([{x:1,y:0}, {x:1,y:1}, {x:1,y:2}]);$D$4 = GET_ITER$0($D$10);$D$6 = $D$4 === 0;$D$5 = ($D$6 ? $D$10.length : void 0);for( ;$D$6 ? ($D$4 < $D$5) : !($D$5 = $D$4["next"]())["done"];){x$3 = (z$0 = ($D$6 ? $D$10[$D$4++] : $D$5["value"])).x, y$0 = z$0.y, z$0 = z$0.z;;var $break$0;(function(x, y, z){ | ||
arr.push(function(){ return x + y + (z | 0) }); | ||
if(y == 2){$break$0 = true;return} | ||
})(x$3, y$0, z$0);if($break$0===true){$break$0=void 0;break }};$D$4 = $D$5 = $D$6 = $D$10 = void 0; | ||
})(x$3, y$0, z$0);if($break$0===true){$break$0=void 0;break }};$D$4 = $D$5 = $D$6 = $D$10 = void 0;x$3=void 0;y$0=void 0;z$0=void 0; | ||
console.log(arr.map(call).join("|") == [1, 1, 2, 3].join("|")); | ||
} |
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
"use strict" | ||
var arr, res, loop, call = function(callback){ return callback()}; | ||
@@ -3,0 +3,0 @@ |
@@ -1,10 +0,10 @@ | ||
var SLICE$0 = Array.prototype.slice;var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol.iterator||'@@iterator';function ITER$0(v,f){if(v){if(Array.isArray(v))return f?v.slice():v;var i,r;if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){i=f.call(v);r=[];}else if((v+'')==='[object Generator]'){i=v;r=[];};if(r) {while((f=i['next']()),f['done']!==true)r.push(f['value']);return r;}}throw new Error(v+' is not iterable')};var $D$0;var $freeze$0 = Object.freeze;var $defProps$0 = Object.defineProperties;var $TS$0 = $freeze$0($defProps$0(["\nstring", "string", "string\n"], {"raw": {"value": $freeze$0(["\nstring", "string", "string\\n"])}}));function GET_ITER$0(v){if(v){if(Array.isArray(v))return 0;var f;if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function')return f.call(v);if((v+'')==='[object Generator]')return v;}throw new Error(v+' is not iterable')}; | ||
var SLICE$0 = Array.prototype.slice;var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol.iterator||'@@iterator';var S_MARK$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol["__setObjectSetter__"];function ITER$0(v,f){if(v){if(Array.isArray(v))return f?v.slice():v;var i,r;if(S_MARK$0)S_MARK$0(v);if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){i=f.call(v);r=[];}else if((v+'')==='[object Generator]'){i=v;r=[];};if(S_MARK$0)S_MARK$0(void 0);if(r) {while((f=i['next']()),f['done']!==true)r.push(f['value']);return r;}}throw new Error(v+' is not iterable')};var $D$0;var $freeze$0 = Object.freeze;var $defProps$0 = Object.defineProperties;var $TS$0 = $freeze$0($defProps$0(["\nstring", "string", "string\n"], {"raw": {"value": $freeze$0(["\nstring", "string", "string\\n"])}}));function GET_ITER$0(v){if(v){if(Array.isArray(v))return 0;var f;if(S_MARK$0)S_MARK$0(v);if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){if(S_MARK$0)S_MARK$0(void 0);return f.call(v);}if(S_MARK$0)S_MARK$0(void 0);if((v+'')==='[object Generator]')return v;}throw new Error(v+' is not iterable')}; | ||
var arr = [1, 2, 3, 4, 5, 6], obj = { arr: arr, method: function(){ return ("value") } }; | ||
{// array comprehentions | ||
var str = ("" + ((function(){var $D$1;var $D$2;var $D$3;var $result$0 = [], i;$D$1 = GET_ITER$0(arr);$D$3 = $D$1 === 0;$D$2 = ($D$3 ? arr.length : void 0);for(; $D$3 ? ($D$1 < $D$2) : !($D$2 = $D$1["next"]())["done"]; ){i = ($D$3 ? arr[$D$1++] : $D$2["value"]);{$result$0.push(i + 1)}};;return $result$0})().join(("|")))); | ||
var str = ("" + ((function(){var $D$1;var $D$2;var $D$3;var $result$0 = [], i;$D$1 = GET_ITER$0(arr);$D$3 = $D$1 === 0;$D$2 = ($D$3 ? arr.length : void 0);for(;$D$3 ? ($D$1 < $D$2) : !($D$2 = $D$1["next"]())["done"];){i = ($D$3 ? arr[$D$1++] : $D$2["value"]);{$result$0.push(i + 1)}};return $result$0})().join(("|")))); | ||
console.log(str === [2, 3, 4, 5, 6, 7].join("|")); | ||
{ | ||
var str$0 = (("<<{" + ((function(){var $D$4;var $D$5;var $D$6;var $result$1 = [], i;$D$4 = GET_ITER$0(arr);$D$6 = $D$4 === 0;$D$5 = ($D$6 ? arr.length : void 0);for(; $D$6 ? ($D$4 < $D$5) : !($D$5 = $D$4["next"]())["done"]; ){i = ($D$6 ? arr[$D$4++] : $D$5["value"]);{$result$1.push(i + 1)}};;return $result$1})().join(("|")))) + "}>>"); | ||
var str$0 = (("<<{" + ((function(){var $D$4;var $D$5;var $D$6;var $result$1 = [], i;$D$4 = GET_ITER$0(arr);$D$6 = $D$4 === 0;$D$5 = ($D$6 ? arr.length : void 0);for(;$D$6 ? ($D$4 < $D$5) : !($D$5 = $D$4["next"]())["done"];){i = ($D$6 ? arr[$D$4++] : $D$5["value"]);{$result$1.push(i + 1)}};return $result$1})().join(("|")))) + "}>>"); | ||
console.log(str$0 === "<<{" + [2, 3, 4, 5, 6, 7].join("|") + "}>>"); | ||
@@ -64,6 +64,6 @@ } | ||
} | ||
{// rest & spread | ||
var str$7 = ("" + (((function(){var rest = SLICE$0.call(arguments, 0); return rest.join(("2")) })).apply(null, ITER$0(arr)))); | ||
console.log(str$7 === arr.join(("2"))); | ||
console.log(str$7 === arr.join(("2"))); | ||
} | ||
@@ -102,2 +102,2 @@ } | ||
} | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol.iterator||'@@iterator';function ITER$0(v,f){if(v){if(Array.isArray(v))return f?v.slice():v;var i,r;if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){i=f.call(v);r=[];}else if((v+'')==='[object Generator]'){i=v;r=[];};if(r) {while((f=i['next']()),f['done']!==true)r.push(f['value']);return r;}}throw new Error(v+' is not iterable')};{ | ||
var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol.iterator||'@@iterator';var S_MARK$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol["__setObjectSetter__"];function ITER$0(v,f){if(v){if(Array.isArray(v))return f?v.slice():v;var i,r;if(S_MARK$0)S_MARK$0(v);if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){i=f.call(v);r=[];}else if((v+'')==='[object Generator]'){i=v;r=[];};if(S_MARK$0)S_MARK$0(void 0);if(r) {while((f=i['next']()),f['done']!==true)r.push(f['value']);return r;}}throw new Error(v+' is not iterable')};{ | ||
var a = [1, 2, 3, 4, , , [5, 6],7]; | ||
@@ -65,3 +65,3 @@ console.log(a.join("|") == "1|2|3|4|||5,6|7"); | ||
function fun2(){ arr1.push(3); return arr1[arr1.length - 1]; } | ||
var a$10 = [ ].concat(ITER$0(arr1, true), [fun1(), fun2(), fun1["call"](null, 2)], ITER$0(arr2), [{arr2: arr2, toString: function(){return this.arr2[0]+1}}, arr2] ); | ||
@@ -96,2 +96,2 @@ a$10[5] = a$10[5].arr2[0] + 1; | ||
console.log(arr$2.join("|") == [1,2,3,1,2,3].join("|")); | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
function test() {var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol.iterator||'@@iterator';function ITER$0(v,f){if(v){if(Array.isArray(v))return f?v.slice():v;var i,r;if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){i=f.call(v);r=[];}else if((v+'')==='[object Generator]'){i=v;r=[];};if(r) {while((f=i['next']()),f['done']!==true)r.push(f['value']);return r;}}throw new Error(v+' is not iterable')};var $D$0; | ||
function test() {var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol.iterator||'@@iterator';var S_MARK$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol["__setObjectSetter__"];function ITER$0(v,f){if(v){if(Array.isArray(v))return f?v.slice():v;var i,r;if(S_MARK$0)S_MARK$0(v);if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){i=f.call(v);r=[];}else if((v+'')==='[object Generator]'){i=v;r=[];};if(S_MARK$0)S_MARK$0(void 0);if(r) {while((f=i['next']()),f['done']!==true)r.push(f['value']);return r;}}throw new Error(v+' is not iterable')};var $D$0; | ||
@@ -3,0 +3,0 @@ |
@@ -14,3 +14,3 @@ function test() {var BIND$0 = Function.prototype.bind; | ||
function test1(_arr) {var SLICE$0 = Array.prototype.slice;var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol.iterator||'@@iterator';function ITER$0(v,f){if(v){if(Array.isArray(v))return f?v.slice():v;var i,r;if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){i=f.call(v);r=[];}else if((v+'')==='[object Generator]'){i=v;r=[];};if(r) {while((f=i['next']()),f['done']!==true)r.push(f['value']);return r;}}throw new Error(v+' is not iterable')};var rest = SLICE$0.call(arguments, 1); | ||
function test1(_arr) {var SLICE$0 = Array.prototype.slice;var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol.iterator||'@@iterator';var S_MARK$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol["__setObjectSetter__"];function ITER$0(v,f){if(v){if(Array.isArray(v))return f?v.slice():v;var i,r;if(S_MARK$0)S_MARK$0(v);if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){i=f.call(v);r=[];}else if((v+'')==='[object Generator]'){i=v;r=[];};if(S_MARK$0)S_MARK$0(void 0);if(r) {while((f=i['next']()),f['done']!==true)r.push(f['value']);return r;}}throw new Error(v+' is not iterable')};var rest = SLICE$0.call(arguments, 1); | ||
@@ -17,0 +17,0 @@ var arr = [6].concat(ITER$0(_arr), ITER$0(rest)); |
@@ -1,2 +0,2 @@ | ||
var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol.iterator||'@@iterator';function ITER$0(v,f){if(v){if(Array.isArray(v))return f?v.slice():v;var i,r;if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){i=f.call(v);r=[];}else if((v+'')==='[object Generator]'){i=v;r=[];};if(r) {while((f=i['next']()),f['done']!==true)r.push(f['value']);return r;}}throw new Error(v+' is not iterable')}; | ||
var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol.iterator||'@@iterator';var S_MARK$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol["__setObjectSetter__"];function ITER$0(v,f){if(v){if(Array.isArray(v))return f?v.slice():v;var i,r;if(S_MARK$0)S_MARK$0(v);if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){i=f.call(v);r=[];}else if((v+'')==='[object Generator]'){i=v;r=[];};if(S_MARK$0)S_MARK$0(void 0);if(r) {while((f=i['next']()),f['done']!==true)r.push(f['value']);return r;}}throw new Error(v+' is not iterable')}; | ||
{ | ||
@@ -3,0 +3,0 @@ var i = 0; |
@@ -1,2 +0,2 @@ | ||
var $D$0;var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol.iterator||'@@iterator';function ITER$0(v,f){if(v){if(Array.isArray(v))return f?v.slice():v;var i,r;if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){i=f.call(v);r=[];}else if((v+'')==='[object Generator]'){i=v;r=[];};if(r) {while((f=i['next']()),f['done']!==true)r.push(f['value']);return r;}}throw new Error(v+' is not iterable')};var BIND$0 = Function.prototype.bind; | ||
var $D$0;var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol.iterator||'@@iterator';var S_MARK$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol["__setObjectSetter__"];function ITER$0(v,f){if(v){if(Array.isArray(v))return f?v.slice():v;var i,r;if(S_MARK$0)S_MARK$0(v);if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){i=f.call(v);r=[];}else if((v+'')==='[object Generator]'){i=v;r=[];};if(S_MARK$0)S_MARK$0(void 0);if(r) {while((f=i['next']()),f['done']!==true)r.push(f['value']);return r;}}throw new Error(v+' is not iterable')};var BIND$0 = Function.prototype.bind; | ||
var result = 0; | ||
@@ -7,2 +7,2 @@ var a = {b: {c: function(a, b){ result += (a + b) }}}, args = [1, 2] | ||
console.log(result === 6);$D$0 = void 0; | ||
console.log(result === 6);$D$0 = void 0; |
@@ -1,2 +0,2 @@ | ||
var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol.iterator||'@@iterator';function ITER$0(v,f){if(v){if(Array.isArray(v))return f?v.slice():v;var i,r;if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){i=f.call(v);r=[];}else if((v+'')==='[object Generator]'){i=v;r=[];};if(r) {while((f=i['next']()),f['done']!==true)r.push(f['value']);return r;}}throw new Error(v+' is not iterable')};{ | ||
var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol.iterator||'@@iterator';var S_MARK$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol["__setObjectSetter__"];function ITER$0(v,f){if(v){if(Array.isArray(v))return f?v.slice():v;var i,r;if(S_MARK$0)S_MARK$0(v);if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){i=f.call(v);r=[];}else if((v+'')==='[object Generator]'){i=v;r=[];};if(S_MARK$0)S_MARK$0(void 0);if(r) {while((f=i['next']()),f['done']!==true)r.push(f['value']);return r;}}throw new Error(v+' is not iterable')};{ | ||
var b = [1,2,3]; | ||
@@ -3,0 +3,0 @@ var a = (new Array(2)).concat([].concat(ITER$0(b))) |
@@ -1,2 +0,2 @@ | ||
var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol.iterator||'@@iterator';function ITER$0(v,f){if(v){if(Array.isArray(v))return f?v.slice():v;var i,r;if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){i=f.call(v);r=[];}else if((v+'')==='[object Generator]'){i=v;r=[];};if(r) {while((f=i['next']()),f['done']!==true)r.push(f['value']);return r;}}throw new Error(v+' is not iterable')};function testSequenceExpression1(a, b, c, d) { | ||
var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol.iterator||'@@iterator';var S_MARK$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol["__setObjectSetter__"];function ITER$0(v,f){if(v){if(Array.isArray(v))return f?v.slice():v;var i,r;if(S_MARK$0)S_MARK$0(v);if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){i=f.call(v);r=[];}else if((v+'')==='[object Generator]'){i=v;r=[];};if(S_MARK$0)S_MARK$0(void 0);if(r) {while((f=i['next']()),f['done']!==true)r.push(f['value']);return r;}}throw new Error(v+' is not iterable')};function testSequenceExpression1(a, b, c, d) { | ||
console.log(a[0] === void 0, a.length === 1, b === void 0, c[0] === void 0, c.length === 1, d === void 0) | ||
@@ -32,2 +32,2 @@ } | ||
console.log(T.join("|") == [1, 1, 1].join("|")) | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
var result = ((function(){var SLICE$0 = Array.prototype.slice;var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol.iterator||'@@iterator';function ITER$0(v,f){if(v){if(Array.isArray(v))return f?v.slice():v;var i,r;if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){i=f.call(v);r=[];}else if((v+'')==='[object Generator]'){i=v;r=[];};if(r) {while((f=i['next']()),f['done']!==true)r.push(f['value']);return r;}}throw new Error(v+' is not iterable')};var r = SLICE$0.call(arguments, 0);var b = (( function() {var args = SLICE$0.call(arguments, 0);return {b: args[1]}} ).apply(null, ITER$0(r)).b);//destructuring / rest / spread | ||
var result = ((function(){var SLICE$0 = Array.prototype.slice;var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol.iterator||'@@iterator';var S_MARK$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol["__setObjectSetter__"];function ITER$0(v,f){if(v){if(Array.isArray(v))return f?v.slice():v;var i,r;if(S_MARK$0)S_MARK$0(v);if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){i=f.call(v);r=[];}else if((v+'')==='[object Generator]'){i=v;r=[];};if(S_MARK$0)S_MARK$0(void 0);if(r) {while((f=i['next']()),f['done']!==true)r.push(f['value']);return r;}}throw new Error(v+' is not iterable')};var r = SLICE$0.call(arguments, 0);var b = (( function() {var args = SLICE$0.call(arguments, 0);return {b: args[1]}} ).apply(null, ITER$0(r)).b);//destructuring / rest / spread | ||
return b; | ||
@@ -3,0 +3,0 @@ })).apply(null, [1, 2, 3]); |
@@ -1,2 +0,2 @@ | ||
var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol.iterator||'@@iterator';function GET_ITER$0(v){if(v){if(Array.isArray(v))return 0;var f;if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function')return f.call(v);if((v+'')==='[object Generator]')return v;}throw new Error(v+' is not iterable')};var $D$0;var $D$4;var $D$5; | ||
var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol.iterator||'@@iterator';var S_MARK$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol["__setObjectSetter__"];function GET_ITER$0(v){if(v){if(Array.isArray(v))return 0;var f;if(S_MARK$0)S_MARK$0(v);if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){if(S_MARK$0)S_MARK$0(void 0);return f.call(v);}if(S_MARK$0)S_MARK$0(void 0);if((v+'')==='[object Generator]')return v;}throw new Error(v+' is not iterable')};var $D$0;var $D$4;var $D$5; | ||
/*es6-transpiler resetUnCaptured:true*/ | ||
@@ -34,3 +34,3 @@ function test0(){} | ||
var str1 = ""; | ||
$D$0 = GET_ITER$0(someArray);$D$5 = $D$0 === 0;$D$4 = ($D$5 ? someArray.length : void 0);for( var a$3 ; $D$5 ? ($D$0 < $D$4) : !($D$4 = $D$0["next"]())["done"]; ){a$3 = ($D$5 ? someArray[$D$0++] : $D$4["value"]);(function(){ | ||
$D$0 = GET_ITER$0(someArray);$D$5 = $D$0 === 0;$D$4 = ($D$5 ? someArray.length : void 0);for( var a$3 ;$D$5 ? ($D$0 < $D$4) : !($D$4 = $D$0["next"]())["done"];){a$3 = ($D$5 ? someArray[$D$0++] : $D$4["value"]);(function(){ | ||
var b = a$3.b, c = a$3.c; | ||
@@ -37,0 +37,0 @@ |
@@ -33,2 +33,6 @@ "use strict"; | ||
, '::ComprehensionExpression': function(node) { | ||
if ( node.xGenerator === true ) { | ||
return; | ||
} | ||
const blocks = node.blocks | ||
@@ -63,3 +67,3 @@ , body = node.body | ||
replacementObj.before | ||
+ "for(" + replacementObj.loop + ")" | ||
+ "for(;" + replacementObj.check + ";)" | ||
+ "{" + replacementObj.inner | ||
@@ -66,0 +70,0 @@ ); |
@@ -28,8 +28,30 @@ "use strict"; | ||
this.__currentClassName = null; | ||
this.__currentSuperRefName = null; | ||
this.__superRefName = null; | ||
this.__protoRefName = null; | ||
this.__staticRefName = null; | ||
this.__currentAccessors = null; | ||
this.__currentStaticAccessors = null; | ||
this.__currentFirstStaticAccessor = null; | ||
this.__staticPropertiesCount = 0; | ||
this.__protoPropertiesCount = 0; | ||
} | ||
, createNames: function(node) { | ||
// We need only one unique name for the entire file | ||
if( !this.__superRefName ) { | ||
this.__superRefName = core.unique("super", true); | ||
} | ||
if( !this.__protoRefName ) { | ||
this.__protoRefName = core.unique("$proto", true); | ||
} | ||
if( !this.__staticRefName ) { | ||
this.__staticRefName = core.unique("$static", true); | ||
} | ||
this.__DP = core.bubbledVariableDeclaration(node.$scope, "DP", $defineProperty); | ||
this.__MIXIN = core.bubbledVariableDeclaration(node.$scope, "MIXIN", objectMixinBody.replace("${Object_defineProperty}", this.__DP)); | ||
} | ||
, setup: function(alter, ast, options) { | ||
@@ -94,6 +116,3 @@ if( !this.__isInit ) { | ||
{ | ||
if( !this.__currentSuperRefName ) { | ||
// We need only one unique 'super' name for the entire file | ||
this.__currentSuperRefName = core.unique("super", true); | ||
} | ||
this.createNames(node); | ||
@@ -108,3 +127,3 @@ const isClassExpression = node.type === 'ClassExpression' | ||
, currentClassName = nodeId ? nodeId.name : core.unique("constructor", true) | ||
, SUPER_NAME = this.__currentSuperRefName | ||
, SUPER_NAME = this.__superRefName | ||
, useStrictString = node.strictMode ? "" : "\"use strict\";" | ||
@@ -118,5 +137,6 @@ ; | ||
, extendedClassConstructorPostfix | ||
, objectMixinFunctionName | ||
; | ||
let objectMixinFunctionName = this.__MIXIN; | ||
node["$ClassName"] = currentClassName; | ||
@@ -130,5 +150,2 @@ this.__currentClassName = currentClassName; | ||
if( superClass ) { | ||
let Object_defineProperty_name = core.bubbledVariableDeclaration(node.$scope, "DP", $defineProperty); | ||
objectMixinFunctionName = core.bubbledVariableDeclaration(node.$scope, "MIXIN", objectMixinBody.replace("${Object_defineProperty}", Object_defineProperty_name)); | ||
classStr += SUPER_NAME; | ||
@@ -152,2 +169,6 @@ superClass = isIdentifier(superClass) ? superClass.name : this.alter.get(superClass.range[0], superClass.range[1]); | ||
if ( useStrictString ) { | ||
this.alter.replace(node.body.range[0], node.body.range[0] + 1, '{' + useStrictString); | ||
} | ||
this.__currentAccessors = {}; | ||
@@ -172,19 +193,26 @@ this.__currentStaticAccessors = {}; | ||
astQuery.traverse(classConstructor, this.replaceClassMethodSuperInConstructor); | ||
insertAfterBodyBegin_string = useStrictString + insertAfterBodyBegin_string; | ||
if ( insertAfterBodyBegin_string ) { | ||
this.alter.insert(node.body.range[0] + 1, insertAfterBodyBegin_string); | ||
} | ||
} | ||
else { | ||
this.alter.insert( | ||
node.body.range[0] + 1 | ||
, useStrictString + "function " + currentClassName + "() {" | ||
+ (superClass ? SUPER_NAME + ".apply(this, arguments)" : "") | ||
+ "}" + (insertAfterBodyBegin_string || "") + (extendedClassConstructorPostfix || "") | ||
, {before: true} | ||
); | ||
insertAfterBodyBegin_string = "function " + currentClassName + "() {" | ||
+ (superClass ? SUPER_NAME + ".apply(this, arguments)" : "") | ||
+ "}" + (insertAfterBodyBegin_string || "") + (extendedClassConstructorPostfix || ""); | ||
} | ||
let theEndString = '', tmpVars = []; | ||
if ( this.__staticPropertiesCount ) { | ||
theEndString += (objectMixinFunctionName + '(' + currentClassName + ',' + this.__staticRefName + ');') | ||
tmpVars.push(this.__staticRefName); | ||
} | ||
if ( this.__protoPropertiesCount ) { | ||
theEndString += (objectMixinFunctionName + '(' + currentClassName + '.prototype,' + this.__protoRefName + ');') | ||
tmpVars.push(this.__protoRefName); | ||
} | ||
if ( tmpVars.length ) { | ||
insertAfterBodyBegin_string += ('var ' + tmpVars.join('={},') + '={};'); | ||
tmpVars.push('void 0'); | ||
} | ||
theEndString += tmpVars.join('='); | ||
this.alter.insertBefore(node.body.range[0] + 1, insertAfterBodyBegin_string); | ||
if ( staticAccessorsDefinitionString ) { | ||
@@ -198,3 +226,3 @@ this.alter.insertAfter(this.__currentFirstStaticAccessor.range[1], staticAccessorsDefinitionString); | ||
this.alter.insert(node.range[1] - 1, ";return " + currentClassName + ";"); | ||
this.alter.insert(node.range[1] - 1, theEndString + ";return " + currentClassName + ";"); | ||
@@ -207,2 +235,4 @@ this.alter.insert(node.range[1], | ||
this.__currentClassName = null; | ||
this.__staticPropertiesCount = 0; | ||
this.__protoPropertiesCount = 0; | ||
} | ||
@@ -212,3 +242,3 @@ } | ||
, unwrapSuperCall: function unwrapSuperCall(node, calleeNode, isStatic, property, isConstructor) { | ||
let superRefName = this.__currentSuperRefName; | ||
let superRefName = this.__superRefName; | ||
assert(superRefName); | ||
@@ -257,45 +287,73 @@ | ||
let isStatic = this.__currentClassMethodsStatic = node.static; | ||
let isComputed = node.computed; | ||
let nodeKey = node.key; | ||
let keyRange = isComputed ? nodeKey.bracesRange : nodeKey.range; | ||
if( node.kind === "set" || node.kind === "get" ) { | ||
if ( isStatic && !this.__currentFirstStaticAccessor ) { | ||
this.__currentFirstStaticAccessor = node; | ||
} | ||
if ( isComputed ) { | ||
let targetName = isStatic === true ? this.__currentClassName : this.__currentClassName + '.prototype'; | ||
let isLiteral = nodeKey.type == 'Literal'; | ||
assert(isIdentifier(nodeKey) || isLiteral); | ||
// get [<name>]() -> DP$0(<className>.prototype,<name>, | ||
this.alter.replace(node.range[0], nodeKey.bracesRange[0] + 1, this.__DP + '(' + targetName + ','); | ||
this.alter.replace(nodeKey.range[1], nodeKey.bracesRange[1], ',{"' + node.kind + '":function'); | ||
let name; | ||
if ( isLiteral ) { | ||
name = nodeKey.value; | ||
let nodeValue = node.value; | ||
this.alter.insertAfter(nodeValue.range[1], ',"configurable":true,"enumerable":true});'); | ||
} | ||
else { | ||
name = nodeKey.name; | ||
} | ||
else {// TODO:: make is easiest | ||
if ( isStatic && !this.__currentFirstStaticAccessor ) { | ||
this.__currentFirstStaticAccessor = node; | ||
} | ||
let accessor = isStatic === true | ||
? this.__currentStaticAccessors[name] || (this.__currentStaticAccessors[name] = {}) | ||
: this.__currentAccessors[name] || (this.__currentAccessors[name] = {}) | ||
; | ||
let replacement = accessor[node.kind] = core.unique((isStatic ? "static_" : "") + name + "$" + node.kind, true); | ||
let isLiteral = nodeKey.type == 'Literal'; | ||
assert(isIdentifier(nodeKey) || isLiteral); | ||
if ( isLiteral ) { | ||
accessor.raw = nodeKey.raw; | ||
let name; | ||
if ( isLiteral ) { | ||
name = nodeKey.value; | ||
} | ||
else { | ||
name = nodeKey.name; | ||
} | ||
let accessor = isStatic === true | ||
? this.__currentStaticAccessors[name] || (this.__currentStaticAccessors[name] = {}) | ||
: this.__currentAccessors[name] || (this.__currentAccessors[name] = {}) | ||
; | ||
let replacement = accessor[node.kind] = core.unique((isStatic ? "static_" : "") + name + "$" + node.kind, true); | ||
if ( isLiteral ) { | ||
accessor.raw = nodeKey.raw; | ||
} | ||
this.alter.replace(node.range[0], nodeKey.range[1], "function " + replacement); | ||
} | ||
this.alter.replace(node.range[0], nodeKey.range[1], "function " + replacement); | ||
} | ||
else { | ||
if( isStatic === true ) { | ||
// text change 'method(<something>)' => 'ClassName.method(<something>)' | ||
this.alter.replace(node.range[0], nodeKey.range[0], this.__currentClassName + "."); | ||
if ( isStatic ) { | ||
this.__staticPropertiesCount++; | ||
} | ||
else { | ||
// text change 'method(<something>)' => 'ClassName.prototype.method(<something>)' | ||
this.alter.replace(node.range[0], nodeKey.range[0], this.__currentClassName + ".prototype."); | ||
this.__protoPropertiesCount++; | ||
} | ||
// text change 'method(<something>)' => 'method = function(<something>)' | ||
this.alter.insert(nodeKey.range[1], " = function"); | ||
let targetName = isStatic === true ? this.__staticRefName : this.__protoRefName; | ||
if ( isStatic ) { | ||
// text change 'static method(<something>)' => '$static$0.method(<something>)' | ||
// text change 'static [method](<something>)' => '$static$0[method](<something>)' | ||
this.alter.replace(node.range[0], keyRange[0], targetName + (isComputed ? '' : '.')); | ||
} | ||
else { | ||
// text change 'method(<something>)' => '$proto$0.method(<something>)' | ||
// text change '[method](<something>)' => '$proto$0[method](<something>)' | ||
this.alter.insert(node.range[0], targetName + (isComputed ? '' : '.')); | ||
} | ||
// text change 'method(<something>)' => 'method = function(<something>)', '[method](<something>)' => '[method] = function(<something>)' | ||
this.alter.insert(keyRange[1], " = function"); | ||
this.alter.insertBefore(node.range[1], ';', {extend: true}); | ||
} | ||
@@ -337,3 +395,3 @@ | ||
// text change 'super.a(<some>)' => 'super$0.a(<some>)' | ||
this.alter.replace(node.range[0], node.range[1], this.__currentSuperRefName); | ||
this.alter.replace(node.range[0], node.range[1], this.__superRefName); | ||
} | ||
@@ -340,0 +398,0 @@ else if( isClass(node) ) { |
@@ -40,2 +40,26 @@ /*globals require, module*/ | ||
function isExpressionStatement(node) { | ||
let type; | ||
return node && (type = node.type) | ||
&& (type === "ExpressionStatement"); | ||
} | ||
function isLiteral(node) { | ||
let type; | ||
return node && (type = node.type) | ||
&& (type === "Literal"); | ||
} | ||
function isIdentifier(node) { | ||
let type; | ||
return node && (type = node.type) | ||
&& (type === "Identifier"); | ||
} | ||
function isProperty(node) { | ||
let type; | ||
return node && (type = node.type) | ||
&& (type === "Property"); | ||
} | ||
function isNonFunctionBlock(node) { | ||
@@ -61,3 +85,3 @@ return node && node.type === "BlockStatement" && !isFunction(node.$parent); | ||
&& !(parentType === "MemberExpression" && parent.computed === false && parent.property === node) // obj.$ | ||
&& !(parentType === "Property" && parent.key === node) // {$: ...} | ||
&& !(parentType === "Property" && parent.key === node && parent.computed === false) // {$: ...} not the {[$]: ...} | ||
&& !(parentType === "LabeledStatement" && parent.label === node) // $: ... | ||
@@ -255,2 +279,5 @@ && !(parentType === "CatchClause" && parent.param === node) // catch($) | ||
// TODO:: refactor/redesign this function | ||
if( method.computed ) { | ||
return; | ||
} | ||
@@ -269,3 +296,7 @@ let type = method.type; | ||
// method.kind ca be 'get', 'set', '' | ||
node.$scope.add(this.getKeyName(method.key), xSpecialNode ? "var" : (method.kind || "fun"), method.value); | ||
let name = this.getKeyName(method.key); | ||
if ( !node.$scope.hasOwn(name) ) { | ||
node.$scope.add(name, xSpecialNode ? "var" : (method.kind || "fun"), method.value); | ||
} | ||
}, this); | ||
@@ -638,14 +669,24 @@ | ||
, PropertyToString: function PropertyToString(node) { | ||
assert(node.type === "Literal" || node.type === "Identifier"); | ||
, PropertyToString: function(node) { | ||
let isParentComputedProperty = node && isProperty(node.$parentNode) && node.$parentNode.computed; | ||
var result; | ||
if( node.type === "Literal" ) { | ||
result = "[" + node.raw + "]"; | ||
if ( isParentComputedProperty ) { | ||
return "[" + this.alter.get(node.range[0], node.range[1]) + "]"; | ||
} | ||
else { | ||
result = "." + node.name; | ||
let isPrimitive = isLiteral(node) || isIdentifier(node); | ||
if ( isPrimitive ) { | ||
var result; | ||
if( node.type === "Literal" ) { | ||
result = "[" + node.raw + "]"; | ||
} | ||
else { | ||
result = "." + node.name; | ||
} | ||
return result; | ||
} | ||
return result | ||
assert(false); | ||
} | ||
@@ -773,4 +814,31 @@ | ||
let findUseStrictBlock = function(node) { | ||
if ( isExpressionStatement(node.body[0]) | ||
&& isLiteral(node.body[0].expression) | ||
&& node.body[0].expression.value === 'use strict' | ||
) { | ||
return node.body[0]; | ||
} | ||
}; | ||
if ( node.type === "Program" ) { | ||
begin = 0; | ||
const useStrictBlock = findUseStrictBlock(node); | ||
if ( useStrictBlock ) { | ||
const blockEnd = useStrictBlock.range[1]; | ||
begin = useStrictBlock.expression.range[1]; | ||
if ( !useStrictBlock.$new_semi ) { | ||
if ( !this.alter.getRange(begin, blockEnd).contains(';') ) { | ||
useStrictBlock.$new_semi = true; | ||
this.alter.insertBefore(begin, ';', {extend: true}); | ||
} | ||
else { | ||
begin = blockEnd; | ||
} | ||
} | ||
} | ||
else { | ||
begin = 0; | ||
} | ||
} | ||
@@ -782,4 +850,21 @@ else if( node.type === "ClassDeclaration" || node.type === "ClassExpression" ) { | ||
const isNakedFunction = node.expression === true; | ||
const useStrictBlock = !isNakedFunction && isBlock(node.body) && findUseStrictBlock(node.body); | ||
begin = hoistScopeNodeBody.range[0] + (isNakedFunction ? 0 : 1); | ||
if ( useStrictBlock ) { | ||
const blockEnd = useStrictBlock.range[1]; | ||
begin = useStrictBlock.expression.range[1]; | ||
if ( !useStrictBlock.$new_semi ) { | ||
if ( !this.alter.getRange(begin, blockEnd).contains(';') ) { | ||
useStrictBlock.$new_semi = true; | ||
this.alter.insertBefore(begin, ';', {extend: true}); | ||
} | ||
else { | ||
begin = blockEnd; | ||
} | ||
} | ||
} | ||
else { | ||
begin = hoistScopeNodeBody.range[0] + (isNakedFunction ? 0 : 1); | ||
} | ||
} | ||
@@ -1018,3 +1103,3 @@ else if( node.type === "ComprehensionExpression" ) { | ||
if( bubbledVariable && bubbledVariable.value === variableInitValue ) { | ||
if( bubbledVariable && bubbledVariable.testValue === variableInitValue ) { | ||
return bubbledVariable; | ||
@@ -1036,5 +1121,6 @@ } | ||
let name = core.unique(variableName, true); | ||
let testValue = variableInitValue; | ||
if( variableNamePlaceholder ) { | ||
variableInitValue = variableInitValue.replace(new RegExp(variableNamePlaceholder, "g"), name); | ||
variableInitValue = variableInitValue.replace(new RegExp(variableNamePlaceholder.replace(/([\$\^\&\[\]\(\)\-])/g, '\\$1'), "g"), name); | ||
} | ||
@@ -1044,2 +1130,3 @@ | ||
name: name | ||
, testValue: testValue | ||
, value: variableInitValue | ||
@@ -1298,3 +1385,2 @@ , isFunction: isFunction | ||
else { | ||
// console.log(from, to, options, parentScope.options) | ||
computedOptions.unshift.apply(computedOptions, options.filter(function(record) { | ||
@@ -1352,2 +1438,20 @@ --commentOptionsCount; | ||
} | ||
, __printNode: function(node) { | ||
function hideSpecialProperties(node, deep) { | ||
for ( var prop in node ) if ( node.hasOwnProperty(prop) ) { | ||
if ( deep < 5 && node[prop] && typeof node[prop] === 'object' ) { | ||
hideSpecialProperties(node, deep + 1); | ||
} | ||
if ( prop.charAt(0) === '$' ) { | ||
Object.defineProperty(node, prop, {enumerable: false}); | ||
} | ||
} | ||
} | ||
hideSpecialProperties(node, 0); | ||
console.log(node); | ||
} | ||
}; | ||
@@ -1354,0 +1458,0 @@ |
@@ -329,3 +329,3 @@ "use strict"; | ||
"type": "MemberExpression", | ||
"computed": false, | ||
"computed": element.computed, | ||
"object": { | ||
@@ -332,0 +332,0 @@ "type": "Identifier", |
@@ -18,3 +18,33 @@ "use strict"; | ||
const SymbolIteratorBody = "typeof Symbol!=='undefined'&&Symbol.iterator||'@@iterator'"; | ||
function isFunction(node) { | ||
let type; | ||
return node && (type = node.type) | ||
&& type === "FunctionDeclaration" || type === "FunctionExpression" || type === "ArrowFunctionExpression"; | ||
} | ||
function isBlock(node) { | ||
let type; | ||
return node && (type = node.type) | ||
&& (type === "BlockStatement"); | ||
} | ||
function isIf(node) { | ||
let type; | ||
return node && (type = node.type) | ||
&& (type === "IfStatement"); | ||
} | ||
function isLoop(node) { | ||
let type; | ||
return node && ((type = node.type) === "ForStatement" || type === "ForInStatement" || type === "ForOfStatement" || type === "WhileStatement" || type === "DoWhileStatement"); | ||
} | ||
function isEmptyBody(node) { | ||
let bodyNode = node && node.body; | ||
return bodyNode && !(!isBlock(bodyNode) || bodyNode.body.length); | ||
} | ||
const SymbolIteratorBody = "typeof Symbol!=='undefined'&&Symbol&&Symbol.iterator||'@@iterator'"; | ||
const SymbolPolyfillMarkBody = "typeof Symbol!=='undefined'&&Symbol&&Symbol[\"__setObjectSetter__\"]"; | ||
const getIteratorBody = | ||
@@ -25,3 +55,5 @@ "(v){" + | ||
"var f;" + | ||
"if(typeof v==='object'&&typeof (f=v[${Symbol_iterator}])==='function')return f.call(v);" + | ||
"if(${Symbol_mark})${Symbol_mark}(v);" + | ||
"if(typeof v==='object'&&typeof (f=v[${Symbol_iterator}])==='function'){if(${Symbol_mark})${Symbol_mark}(void 0);return f.call(v);}" + | ||
"if(${Symbol_mark})${Symbol_mark}(void 0);" + | ||
"if((v+'')==='[object Generator]')return v;" + | ||
@@ -58,9 +90,50 @@ "}" + | ||
const replacementObj = this.createForOfReplacement(node, node.body, true); | ||
const replacementObj = this.createForOfReplacement(node, node.body, {cleanup: true}); | ||
let previousBlockNode = node, parent = node.$parentNode; | ||
while ( (previousBlockNode = previousBlockNode.$previousElementSibling) && previousBlockNode != parent ) { | ||
if ( isFunction(previousBlockNode) || isLoop(previousBlockNode) || isIf(previousBlockNode) ) { | ||
break; | ||
} | ||
} | ||
if ( isFunction(previousBlockNode) || isLoop(previousBlockNode) ) { | ||
previousBlockNode = previousBlockNode.body; | ||
} | ||
else if ( isIf(previousBlockNode) ) { | ||
previousBlockNode = previousBlockNode.consequent; | ||
} | ||
else { | ||
previousBlockNode = void 0; | ||
} | ||
if ( previousBlockNode && !isBlock(previousBlockNode) && !previousBlockNode.$isBlock ) { | ||
previousBlockNode.$isBlock = true; | ||
this.alter.insertBefore(previousBlockNode.range[0], '{'); | ||
this.alter.insert(previousBlockNode.range[1], '}'); | ||
} | ||
if ( !hasBlock ) { | ||
node.body.$isBlock = true; | ||
} | ||
this.alter.insert(//before for of | ||
node.range[0] | ||
, replacementObj.before | ||
, {extend: true, applyChanges: true} | ||
, {applyChanges: true, "__newTransitionalSubLogic":true} | ||
); | ||
let from = node.left.range[1] + 1 | ||
, to = insertHeadPosition - (hasBlock ? 1 : 0)//just before { | ||
; | ||
let lineBreaks = !hasBlock && this.alter.getRange(from, to).match(/[\r\n]/g) || []; | ||
//instead for of declaration body: for(var a of b) -> for(var a <forOfString>) | ||
this.alter.remove(from, to); | ||
if ( to < insertHeadPosition) { | ||
this.alter.insertAfter(to, ";" + replacementObj.check + ";)" + lineBreaks.join("")); | ||
} | ||
else { | ||
this.alter.insertBefore(to, ";" + replacementObj.check + ";)" + lineBreaks.join("")); | ||
} | ||
this.alter.insertBefore(//after for of body begin, but before any other insert (loop closure function start, for example) | ||
@@ -70,8 +143,9 @@ insertHeadPosition | ||
); | ||
this.alter.insertAfter(//after for of | ||
node.range[1] | ||
this.alter.insert(//after for of | ||
node.body.range[1] | ||
, (hasBlock ? "" : "}") + replacementObj.after | ||
, {extend: true} | ||
); | ||
this.alter.setState("replaceForOf"); | ||
// TODO:: StringAlter has a bug with {applyChanges: true, "__newTransitionalSubLogic":true}: the remove below does affect the result of alter.get | ||
this.alter.setState("replaceForOf");//TODO:: remove setState | ||
if( replacementObj.remove ) { | ||
@@ -84,19 +158,12 @@ // remove 'var {des, truc, turing}' from for(var {des, truc, turing} of something){ } | ||
} | ||
this.alter.restoreState();//TODO:: remove restoreState | ||
} | ||
let from = node.left.range[1] + 1 | ||
, to = insertHeadPosition - (hasBlock ? 1 : 0)//just before { | ||
; | ||
let lineBreaks = !hasBlock && this.alter.getRange(from, to).match(/[\r\n]/g) || []; | ||
, createForOfReplacement: function(node, bodyNode, options) { | ||
options = options || {}; | ||
this.alter.replace(//instead for of declaration body: for(var a of b) -> for(var a <forOfString>) | ||
from | ||
, to | ||
, replacementObj.loop + ")" + lineBreaks.join("") | ||
); | ||
this.alter.restoreState(); | ||
} | ||
, createForOfReplacement: function(node, bodyNode, needTemporaryVariableCleaning) { | ||
let scopeOptions = core.getScopeOptions(node.$scope, node); | ||
const needIteratorSupport = scopeOptions['has-iterators'] !== false || scopeOptions['has-generators'] !== false; | ||
let needTemporaryVariableCleaning = options.cleanup; | ||
let implicitDeclaration = options.implicitDeclaration; | ||
@@ -106,3 +173,11 @@ let getIteratorFunctionName; | ||
let Symbol_iterator = core.bubbledVariableDeclaration(node.$scope, "S_ITER", SymbolIteratorBody); | ||
getIteratorFunctionName = core.bubbledVariableDeclaration(node.$scope, "GET_ITER", getIteratorBody.replace("${Symbol_iterator}", Symbol_iterator), true); | ||
let Symbol_mark = core.bubbledVariableDeclaration(node.$scope, "S_MARK", SymbolPolyfillMarkBody); | ||
getIteratorFunctionName = core.bubbledVariableDeclaration( | ||
node.$scope | ||
, "GET_ITER" | ||
, getIteratorBody | ||
.replace("${Symbol_iterator}", Symbol_iterator) | ||
.replace(/\$\{Symbol_mark\}/g, Symbol_mark) | ||
, true | ||
); | ||
} | ||
@@ -161,4 +236,4 @@ else { | ||
else { | ||
beforeBeginString += (tempVars[3] + " = (" + this.alter.get(variableInit.range[0], variableInit.range[1]) + ");"); | ||
variableInitString = tempVars[3]; | ||
beforeBeginString += (tempVars[tempVars.length - 1] + " = (" + this.alter.get(variableInit.range[0], variableInit.range[1]) + ");"); | ||
variableInitString = tempVars[tempVars.length - 1]; | ||
} | ||
@@ -169,3 +244,4 @@ | ||
, initString | ||
, afterString = ";" + (needTemporaryVariableCleaning ? (tempVars.join(" = ") + " = void 0;") : "")//cleanup string | ||
, afterString = (needTemporaryVariableCleaning ? (tempVars.join(" = ") + " = void 0;") : "")//cleanup string | ||
, varsDeclaration = '' | ||
; | ||
@@ -182,3 +258,3 @@ | ||
forOfString = | ||
"; " + tempVars[2] + " ? (" + tempVars[0] + " < " + tempVars[1] + ") : !(" + tempVars[1] + " = " + tempVars[0] + "[\"next\"]())[\"done\"]; "; | ||
tempVars[2] + " ? (" + tempVars[0] + " < " + tempVars[1] + ") : !(" + tempVars[1] + " = " + tempVars[0] + "[\"next\"]())[\"done\"]"; | ||
@@ -195,3 +271,3 @@ initString = | ||
forOfString = | ||
"; " + tempVars[0] + " < " + tempVars[1] + "; "; | ||
tempVars[0] + " < " + tempVars[1]; | ||
@@ -205,3 +281,3 @@ initString = | ||
let newDefinitions = []; | ||
innerString = ";" + ( | ||
innerString = ( | ||
destructuring.unwrapDestructuring("var", variableId, variableInit, null, newDefinitions) + ";" | ||
@@ -212,4 +288,20 @@ ).substr(4);//remove "var " | ||
beforeBeginString = "var " + newDefinitions.map(function(a){ return a.id.name }).join(", ") + ";" + beforeBeginString; | ||
let varInit = variableBlock.kind == 'let' ? '=void 0' : ''; | ||
let varsDecls = newDefinitions.map(function(a){ return a.id.name + varInit }); | ||
if ( implicitDeclaration ) { | ||
varsDeclaration += ('var ' + newDefinitions.map(function(a){ return a.id.name }).join(', ') + ';'); | ||
if ( varInit ) { | ||
beforeBeginString = varsDecls.join(';') + ';' + beforeBeginString; | ||
} | ||
} | ||
else { | ||
beforeBeginString = 'var ' + varsDecls.join(', ') + ';' + beforeBeginString; | ||
} | ||
if ( varInit ) { | ||
afterString += (varsDecls.join(';') + ';'); | ||
} | ||
delete variableInit["$raw"]; | ||
@@ -227,6 +319,7 @@ } | ||
before: beforeBeginString | ||
, loop: forOfString | ||
, inner: innerString | ||
, after: afterString | ||
, check: forOfString | ||
, inner: innerString// + ',' + (isEmptyBody(node) ? 'null' : '') | ||
, after: afterString ? ';' + afterString : '' | ||
, remove: variableIdIsDestructuring ? variableBlock.range : void 0 | ||
, declarations: varsDeclaration | ||
} | ||
@@ -233,0 +326,0 @@ } |
@@ -49,3 +49,3 @@ "use strict"; | ||
&& !(parentType === "MemberExpression" && parent.computed === false && parent.property === node) // obj.$ | ||
&& !(parentType === "Property" && parent.key === node) // {$: ...} | ||
&& !(parentType === "Property" && parent.key === node && parent.computed === false) // {$: ...} not the {[$]: ...} | ||
&& !(parentType === "LabeledStatement" && parent.label === node) // $: ... | ||
@@ -308,3 +308,5 @@ && !(parentType === "CatchClause" && parent.param === node) // catch($) | ||
funcCallResult = ";var " + name + ", " + recipient + " = "; | ||
beforeHead += ";var " + name + ";"; | ||
funcCallResult = ";var " + recipient + " = "; | ||
if ( argTypeIsPrimitive ) { | ||
@@ -350,3 +352,6 @@ result = "if(" + name + "===true){" + name + "=void 0;" + keys.exitPoint + " " + recipient + "}"; | ||
this.alter.insertAfter(core.__getNodeBegin(hoistScopeNode), ";var " + name + "=" + keys.varName + ";"); | ||
if ( !hoistScopeNode['$__has__' + name] ) { | ||
hoistScopeNode['$__has__' + name] = true; | ||
this.alter.insertAfter(core.__getNodeBegin(hoistScopeNode), ";var " + name + "=" + keys.varName + ";"); | ||
} | ||
} | ||
@@ -386,3 +391,3 @@ | ||
fragmentOption.afterTail = afterTail; | ||
fragmentOption.beforeHead = beforeHead.replace(/;;/g, ";") + funcCallResult; | ||
fragmentOption.beforeHead = (beforeHead + funcCallResult).replace(/;;/g, ";"); | ||
@@ -389,0 +394,0 @@ this.alter.insert(insertHeadPosition, "--head--", fragmentOption); |
@@ -17,2 +17,25 @@ "use strict"; | ||
function isLiteral(node) { | ||
let type; | ||
return node && (type = node.type) | ||
&& (type === "Literal"); | ||
} | ||
const $defineProperty = "Object.defineProperty"; | ||
const $defineProperties = "Object.defineProperties"; | ||
const $GOPDS_P = "Object.getOwnPropertyDescriptors||function(o){" + | ||
"var d=Object.create(null);" + | ||
"for(var p in o)if(o.hasOwnProperty(p)){" + | ||
"d[p]={\"value\":o[p],\"enumerable\":true,\"configurable\":true,\"writable\":true};" + | ||
"}" + | ||
"return d;" + | ||
"}"; | ||
const $GOPDS_A = "function(o){" + | ||
"var d=Object.create(null);" + | ||
"for(var p in o)if(o.hasOwnProperty(p)){" + | ||
"d[p]=o[p];" + | ||
"}" + | ||
"return d;" + | ||
"}"; | ||
var plugin = module.exports = { | ||
@@ -53,2 +76,176 @@ reset: function() { | ||
} | ||
, '::Property[computed=true]': function(node) {//':: !:not(ObjectPattern,ArrayPattern) > Property[computed=true]' | ||
var parent = node.$parent; | ||
if( !isArrayPattern(parent) && !isObjectPattern(parent)//filter destructuring | ||
&& !parent.$uncomputed | ||
) { | ||
parent.$uncomputed = true; | ||
assert(parent.type === 'ObjectExpression'); | ||
this.replaceComputedProperties(parent); | ||
} | ||
} | ||
, replaceComputedProperties: function(node) { | ||
let properties = node.properties; | ||
let beforeString = ''; | ||
let endFragment = '}'; | ||
let computedReplacementStarted = false; | ||
let Object_defineProperty_name; | ||
let Object_defineProperties_name; | ||
let $GOPDS_P_name; | ||
let $GOPDS_A_name; | ||
let objectOpened = ''; | ||
let _this = this; | ||
function closeOpenTag(prevProperty) { | ||
if ( prevProperty ) { | ||
_this.alter.insertAfter(prevProperty.range[1], endFragment, {extend: true}); | ||
} | ||
else { | ||
objectOpened = '},'; | ||
} | ||
} | ||
let property = null, prevProperty; | ||
for ( let i = 0, len = properties.length ; i < len ; i++ ) { | ||
prevProperty = property; | ||
property = properties[i]; | ||
let isComputed = property.computed; | ||
if ( property.kind === 'get' || property.kind === 'set' ) { | ||
if ( property.$objectLiteral_pass ) { | ||
continue; | ||
} | ||
let expectedNextKind = property.kind === 'set' ? 'get' : 'set'; | ||
let nextAccessor = !isComputed && properties[i + 1]; | ||
if ( nextAccessor ) { | ||
if ( nextAccessor.computed || nextAccessor.kind !== expectedNextKind ) { | ||
nextAccessor = void 0; | ||
} | ||
} | ||
if ( nextAccessor ) { | ||
nextAccessor.$objectLiteral_pass = true; | ||
} | ||
closeOpenTag(prevProperty); | ||
if ( isComputed ) { | ||
computedReplacementStarted = true; | ||
if ( !Object_defineProperty_name ) { | ||
Object_defineProperty_name = core.bubbledVariableDeclaration(node.$scope, "DP", $defineProperty); | ||
} | ||
beforeString = Object_defineProperty_name + '(' + beforeString; | ||
} | ||
else { | ||
if ( !Object_defineProperties_name ) { | ||
Object_defineProperties_name = core.bubbledVariableDeclaration(node.$scope, "DPS", $defineProperties); | ||
} | ||
beforeString = Object_defineProperties_name + '(' + beforeString; | ||
if ( !$GOPDS_A_name ) { | ||
$GOPDS_A_name = core.bubbledVariableDeclaration(node.$scope, "GOPDS_A", $GOPDS_A); | ||
} | ||
this.alter.insertBefore(property.range[0], $GOPDS_A_name + '({'); | ||
} | ||
let propKey = property.key; | ||
this.alter.remove(property.range[0], propKey.range[0]);//remove 'set ' or 'get ', or 'set [' or 'get [' | ||
if ( isComputed === true ) { | ||
this.alter.remove(propKey.bracesRange[1] - 1, propKey.bracesRange[1]);//remove ']' | ||
} | ||
this.alter.insertBefore(propKey.range[1], (isComputed ? ',' : ':') + '{"' + property.kind + '":function'); | ||
if ( nextAccessor ) { | ||
let nextAccessorKey = nextAccessor.key; | ||
this.alter.remove(nextAccessor.range[0], nextAccessorKey.range[1]);//remove 'set <name>' or 'get <name>', or 'set [<name>' or 'get [<name>' | ||
if ( nextAccessor.computed === true ) { | ||
this.alter.remove(nextAccessorKey.bracesRange[1] - 1, nextAccessorKey.bracesRange[1]);//remove ']' | ||
} | ||
this.alter.insertBefore(nextAccessorKey.range[1], '"' + nextAccessor.kind + '":function'); | ||
this.alter.insert(nextAccessor.range[1], ',"configurable":true,"enumerable":true}'); | ||
} | ||
else { | ||
let propValue = property.value; | ||
this.alter.insert(propValue.range[1], ',"configurable":true,"enumerable":true}'); | ||
} | ||
endFragment = isComputed ? ')' : '}))'; | ||
} | ||
else if ( isComputed || (computedReplacementStarted && isLiteral(property.key)) ) { | ||
computedReplacementStarted = true; | ||
if ( !Object_defineProperty_name ) { | ||
Object_defineProperty_name = core.bubbledVariableDeclaration(node.$scope, "DP", $defineProperty); | ||
} | ||
beforeString = Object_defineProperty_name + '(' + beforeString; | ||
let propKey = property.key; | ||
if ( isComputed ) { | ||
this.alter.remove(propKey.bracesRange[0], propKey.bracesRange[0] + 1);//remove '[' | ||
this.alter.remove(propKey.bracesRange[1] - 1, propKey.bracesRange[1]);//remove ']' | ||
} | ||
else { | ||
property.$literal = true; | ||
} | ||
this.alter.insertBefore(propKey.range[1], ',{"value"'); | ||
let propValue = property.value; | ||
this.alter.insert(propValue.range[1], ',"configurable":true,"enumerable":true,"writable":true}'); | ||
closeOpenTag(prevProperty); | ||
endFragment = ')'; | ||
} | ||
else if ( computedReplacementStarted ) { | ||
if ( !Object_defineProperties_name ) { | ||
Object_defineProperties_name = core.bubbledVariableDeclaration(node.$scope, "DPS", $defineProperties); | ||
} | ||
beforeString = Object_defineProperties_name + '(' + beforeString; | ||
closeOpenTag(prevProperty); | ||
if ( !$GOPDS_P_name ) { | ||
$GOPDS_P_name = core.bubbledVariableDeclaration(node.$scope, "GOPDS_P", $GOPDS_P); | ||
} | ||
this.alter.insertBefore(property.range[0], $GOPDS_P_name + '({', {extend: true}); | ||
endFragment = '}))'; | ||
computedReplacementStarted = false; | ||
} | ||
} | ||
if ( beforeString ) { | ||
if ( endFragment === '}))' ) { | ||
endFragment = '))'; | ||
} | ||
if ( property.computed === true || property.$literal === true ) {// lastProperty | ||
this.alter.replace(node.range[1] - 1, node.range[1], endFragment, {extend: true});//replace '}' | ||
} | ||
else { | ||
this.alter.insertBefore(node.range[1], endFragment, {extend: true}); | ||
} | ||
this.alter.insertBefore(node.range[0], beforeString, {extend: true}); | ||
if ( objectOpened ) { | ||
this.alter.insert(node.range[0] + 1, objectOpened); | ||
} | ||
} | ||
} | ||
}; | ||
@@ -55,0 +252,0 @@ |
@@ -7,16 +7,8 @@ /*globals module,require*/ | ||
const error = require("./../lib/error"); | ||
const tmpl = require("./../lib/tmpl"); | ||
const core = require("./core"); | ||
const unicode = require("./unicode"); | ||
function generateUUID() { | ||
var d = new Date().getTime(); | ||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { | ||
var r = (d + Math.random()*16)%16 | 0; | ||
d = Math.floor(d/16); | ||
return (c=='x' ? r : (r&0x7|0x8)).toString(16); | ||
}); | ||
}; | ||
let UUID = tmpl.generateUUID(); | ||
let UUID = generateUUID(); | ||
var plugin = module.exports = { | ||
@@ -145,3 +137,3 @@ reset: function() { | ||
while ( quasiCookedString.contains(UUID) ) {// paranoiac mode: on | ||
UUID = generateUUID(); | ||
UUID = tmpl.generateUUID(); | ||
} | ||
@@ -148,0 +140,0 @@ variableNamePlaceholder = UUID; |
@@ -26,3 +26,4 @@ "use strict"; | ||
const SymbolIteratorBody = "typeof Symbol!=='undefined'&&Symbol.iterator||'@@iterator'"; | ||
const SymbolIteratorBody = "typeof Symbol!=='undefined'&&Symbol&&Symbol.iterator||'@@iterator'"; | ||
const SymbolPolyfillMarkBody = "typeof Symbol!=='undefined'&&Symbol&&Symbol[\"__setObjectSetter__\"]"; | ||
const callIteratorBody = | ||
@@ -33,2 +34,3 @@ "(v,f){" + | ||
"var i,r;"+ | ||
"if(${Symbol_mark})${Symbol_mark}(v);" + | ||
"if(typeof v==='object'&&typeof (f=v[${Symbol_iterator}])==='function'){" + | ||
@@ -41,2 +43,3 @@ "i=f.call(v);r=[];" + | ||
"};" + | ||
"if(${Symbol_mark})${Symbol_mark}(void 0);" + | ||
"if(r) {" + | ||
@@ -181,8 +184,3 @@ "while((f=i['next']()),f['done']!==true)r.push(f['value']);" + | ||
); | ||
// if ( !((argsLength === 1 && !isArrayExpression(args[0].argument)) ) ) { | ||
// console.log(argsLength, isArrayExpression(args[0].argument), args[0].argument, needFirstSquareBracket); | ||
// process.exit(0) | ||
// } | ||
this.replaceSpreads(node, args, true); | ||
@@ -231,3 +229,10 @@ } | ||
let Symbol_iterator = core.bubbledVariableDeclaration(node.$scope, "S_ITER", SymbolIteratorBody); | ||
return core.bubbledVariableDeclaration(node.$scope, "ITER", callIteratorBody.replace("${Symbol_iterator}", Symbol_iterator), true); | ||
let Symbol_mark = core.bubbledVariableDeclaration(node.$scope, "S_MARK", SymbolPolyfillMarkBody); | ||
return core.bubbledVariableDeclaration(node.$scope | ||
, "ITER" | ||
, callIteratorBody | ||
.replace("${Symbol_iterator}", Symbol_iterator) | ||
.replace(/\$\{Symbol_mark\}/g, Symbol_mark) | ||
, true | ||
); | ||
} | ||
@@ -267,4 +272,2 @@ | ||
if( !concatOpen ) { | ||
// let _isArrayExpression = isArrayExpression(node);// for "NewExpression" and "CallExpression", node is not a SpreadElement | ||
// let from = _isArrayExpression ? node.range[0] : firstElemIsSpreadFlag; | ||
let from = firstElemIsSpreadFlag; | ||
@@ -405,5 +408,2 @@ | ||
} | ||
// else{ | ||
// this.alter.remove(node.range[0], node.range[0] + 1); | ||
// } | ||
} | ||
@@ -410,0 +410,0 @@ else { |
Sorry, the diff of this file is too big to display
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
1528911
292
39548
262