Add experimental support for ES7 function bind. (issue #1287)

This commit is contained in:
Ingvar Stepanyan
2015-05-13 17:58:21 +03:00
parent b0317f9bab
commit 37f662d790
16 changed files with 127 additions and 4 deletions

View File

@@ -0,0 +1,2 @@
var f = ctx::ns.obj.func;
var g = ::ns.obj.func;

View File

@@ -0,0 +1,6 @@
"use strict";
var _context;
var f = ns.obj.func.bind(ctx);
var g = (_context = ns.obj).func.bind(_context);

View File

@@ -0,0 +1,4 @@
ctx::ns.obj.func();
::ns.obj.func();
ns.obj2::ns.obj1.func();

View File

@@ -0,0 +1,8 @@
"use strict";
var _context;
ns.obj.func.call(ctx);
(_context = ns.obj).func.call(_context);
ns.obj1.func.call(ns.obj2);

View File

@@ -0,0 +1,6 @@
import { map, takeWhile, forEach } from "iterlib";
getPlayers()
::map(x => x.character())
::takeWhile(x => x.strength > 100)
::forEach(x => console.log(x));

View File

@@ -0,0 +1,11 @@
"use strict";
var _iterlib = require("iterlib");
_iterlib.forEach.call(_iterlib.takeWhile.call(_iterlib.map.call(getPlayers(), function (x) {
return x.character();
}), function (x) {
return x.strength > 100;
}), function (x) {
return console.log(x);
});

View File

@@ -0,0 +1,3 @@
{
"optional": "es7.functionBind"
}