Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e982a84

Browse files
Merge pull request gpujs#213 from gpujs/212-funky-function-support
fix gpujs#212
2 parents c6ea5ef + f0eefff commit e982a84

File tree

15 files changed

+4076
-24
lines changed

15 files changed

+4076
-24
lines changed

bin/gpu-core.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* GPU Accelerated JavaScript
66
*
77
* @version 1.0.0-rc.1
8-
* @date Sat Oct 07 2017 14:26:08 GMT+0100 (BST)
8+
* @date Tue Oct 24 2017 10:09:18 GMT-0400 (EDT)
99
*
1010
* @license MIT
1111
* The MIT License

bin/gpu-core.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bin/gpu.js

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* GPU Accelerated JavaScript
66
*
77
* @version 1.0.0-rc.1
8-
* @date Sat Oct 07 2017 14:26:09 GMT+0100 (BST)
8+
* @date Tue Oct 24 2017 10:09:18 GMT-0400 (EDT)
99
*
1010
* @license MIT
1111
* The MIT License
@@ -615,6 +615,10 @@ module.exports = function (_BaseFunctionNode) {
615615

616616
if (ast.type === 'MemberExpression') {
617617
if (ast.object && ast.property) {
618+
if (ast.object.hasOwnProperty('name') && ast.object.name[0] === '_') {
619+
return this.astMemberExpressionUnroll(ast.property, funcParam);
620+
}
621+
618622
return this.astMemberExpressionUnroll(ast.object, funcParam) + '.' + this.astMemberExpressionUnroll(ast.property, funcParam);
619623
}
620624
}
@@ -623,6 +627,13 @@ module.exports = function (_BaseFunctionNode) {
623627
return ast.value;
624628
}
625629

630+
if (ast.hasOwnProperty('expressions')) {
631+
var firstExpression = ast.expressions[0];
632+
if (firstExpression.type === 'Literal' && firstExpression.value === 0 && ast.expressions.length === 2) {
633+
return this.astMemberExpressionUnroll(ast.expressions[1]);
634+
}
635+
}
636+
626637
throw this.astErrorOutput('Unknown CallExpression_unroll', ast, funcParam);
627638
}
628639

@@ -2545,10 +2556,21 @@ module.exports = function (_FunctionNodeBase) {
25452556

25462557
if (ast.type === 'MemberExpression') {
25472558
if (ast.object && ast.property) {
2559+
if (ast.object.hasOwnProperty('name') && ast.object.name[0] === '_') {
2560+
return this.astMemberExpressionUnroll(ast.property, funcParam);
2561+
}
2562+
25482563
return this.astMemberExpressionUnroll(ast.object, funcParam) + '.' + this.astMemberExpressionUnroll(ast.property, funcParam);
25492564
}
25502565
}
25512566

2567+
if (ast.hasOwnProperty('expressions')) {
2568+
var firstExpression = ast.expressions[0];
2569+
if (firstExpression.type === 'Literal' && firstExpression.value === 0 && ast.expressions.length === 2) {
2570+
return this.astMemberExpressionUnroll(ast.expressions[1]);
2571+
}
2572+
}
2573+
25522574
throw this.astErrorOutput('Unknown CallExpression_unroll', ast, funcParam);
25532575
}
25542576

@@ -4598,15 +4620,15 @@ var types = {
45984620
eq: new TokenType("=", {beforeExpr: true, isAssign: true}),
45994621
assign: new TokenType("_=", {beforeExpr: true, isAssign: true}),
46004622
incDec: new TokenType("++/--", {prefix: true, postfix: true, startsExpr: true}),
4601-
prefix: new TokenType("!/~", {beforeExpr: true, prefix: true, startsExpr: true}),
4623+
prefix: new TokenType("prefix", {beforeExpr: true, prefix: true, startsExpr: true}),
46024624
logicalOR: binop("||", 1),
46034625
logicalAND: binop("&&", 2),
46044626
bitwiseOR: binop("|", 3),
46054627
bitwiseXOR: binop("^", 4),
46064628
bitwiseAND: binop("&", 5),
4607-
equality: binop("==/!=/===/!==", 6),
4608-
relational: binop("</>/<=/>=", 7),
4609-
bitShift: binop("<</>>/>>>", 8),
4629+
equality: binop("==/!=", 6),
4630+
relational: binop("</>", 7),
4631+
bitShift: binop("<</>>", 8),
46104632
plusMin: new TokenType("+/-", {beforeExpr: true, binop: 9, prefix: true, startsExpr: true}),
46114633
modulo: binop("%", 10),
46124634
star: binop("*", 10),
@@ -4854,7 +4876,7 @@ Parser.prototype.parse = function parse () {
48544876
var pp = Parser.prototype;
48554877

48564878

4857-
var literal = /^(?:'((?:\\.|[^'])*?)'|"((?:\\.|[^"])*?)"|;)/;
4879+
var literal = /^(?:'((?:[^']|\.)*)'|"((?:[^"]|\.)*)"|;)/;
48584880
pp.strictDirective = function(start) {
48594881
var this$1 = this;
48604882

@@ -6426,7 +6448,7 @@ pp$3.parseTemplate = function(ref) {
64266448

64276449
pp$3.isAsyncProp = function(prop) {
64286450
return !prop.computed && prop.key.type === "Identifier" && prop.key.name === "async" &&
6429-
(this.type === types.name || this.type === types.num || this.type === types.string || this.type === types.bracketL || this.type.keyword) &&
6451+
(this.type === types.name || this.type === types.num || this.type === types.string || this.type === types.bracketL) &&
64306452
!lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
64316453
};
64326454

@@ -7220,7 +7242,7 @@ pp$8.readToken_caret = function() {
72207242
pp$8.readToken_plus_min = function(code) {
72217243
var next = this.input.charCodeAt(this.pos + 1);
72227244
if (next === code) {
7223-
if (next == 45 && !this.inModule && this.input.charCodeAt(this.pos + 2) == 62 &&
7245+
if (next == 45 && this.input.charCodeAt(this.pos + 2) == 62 &&
72247246
(this.lastTokEnd === 0 || lineBreak.test(this.input.slice(this.lastTokEnd, this.pos)))) {
72257247
this.skipLineComment(3);
72267248
this.skipSpace();
@@ -7240,8 +7262,9 @@ pp$8.readToken_lt_gt = function(code) {
72407262
if (this.input.charCodeAt(this.pos + size) === 61) { return this.finishOp(types.assign, size + 1) }
72417263
return this.finishOp(types.bitShift, size)
72427264
}
7243-
if (next == 33 && code == 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) == 45 &&
7265+
if (next == 33 && code == 60 && this.input.charCodeAt(this.pos + 2) == 45 &&
72447266
this.input.charCodeAt(this.pos + 3) == 45) {
7267+
if (this.inModule) { this.unexpected(); }
72457268
this.skipLineComment(4);
72467269
this.skipSpace();
72477270
return this.nextToken()
@@ -7671,7 +7694,7 @@ pp$8.readWord = function() {
76717694
};
76727695

76737696

7674-
var version = "5.1.2";
7697+
var version = "5.1.1";
76757698

76767699

76777700
function parse(input, options) {

bin/gpu.min.js

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)