5
5
* GPU Accelerated JavaScript
6
6
*
7
7
* @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 )
9
9
*
10
10
* @license MIT
11
11
* The MIT License
@@ -615,6 +615,10 @@ module.exports = function (_BaseFunctionNode) {
615
615
616
616
if ( ast . type === 'MemberExpression' ) {
617
617
if ( ast . object && ast . property ) {
618
+ if ( ast . object . hasOwnProperty ( 'name' ) && ast . object . name [ 0 ] === '_' ) {
619
+ return this . astMemberExpressionUnroll ( ast . property , funcParam ) ;
620
+ }
621
+
618
622
return this . astMemberExpressionUnroll ( ast . object , funcParam ) + '.' + this . astMemberExpressionUnroll ( ast . property , funcParam ) ;
619
623
}
620
624
}
@@ -623,6 +627,13 @@ module.exports = function (_BaseFunctionNode) {
623
627
return ast . value ;
624
628
}
625
629
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
+
626
637
throw this . astErrorOutput ( 'Unknown CallExpression_unroll' , ast , funcParam ) ;
627
638
}
628
639
@@ -2545,10 +2556,21 @@ module.exports = function (_FunctionNodeBase) {
2545
2556
2546
2557
if ( ast . type === 'MemberExpression' ) {
2547
2558
if ( ast . object && ast . property ) {
2559
+ if ( ast . object . hasOwnProperty ( 'name' ) && ast . object . name [ 0 ] === '_' ) {
2560
+ return this . astMemberExpressionUnroll ( ast . property , funcParam ) ;
2561
+ }
2562
+
2548
2563
return this . astMemberExpressionUnroll ( ast . object , funcParam ) + '.' + this . astMemberExpressionUnroll ( ast . property , funcParam ) ;
2549
2564
}
2550
2565
}
2551
2566
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
+
2552
2574
throw this . astErrorOutput ( 'Unknown CallExpression_unroll' , ast , funcParam ) ;
2553
2575
}
2554
2576
@@ -4598,15 +4620,15 @@ var types = {
4598
4620
eq : new TokenType ( "=" , { beforeExpr : true , isAssign : true } ) ,
4599
4621
assign : new TokenType ( "_=" , { beforeExpr : true , isAssign : true } ) ,
4600
4622
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 } ) ,
4602
4624
logicalOR : binop ( "||" , 1 ) ,
4603
4625
logicalAND : binop ( "&&" , 2 ) ,
4604
4626
bitwiseOR : binop ( "|" , 3 ) ,
4605
4627
bitwiseXOR : binop ( "^" , 4 ) ,
4606
4628
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 ) ,
4610
4632
plusMin : new TokenType ( "+/-" , { beforeExpr : true , binop : 9 , prefix : true , startsExpr : true } ) ,
4611
4633
modulo : binop ( "%" , 10 ) ,
4612
4634
star : binop ( "*" , 10 ) ,
@@ -4854,7 +4876,7 @@ Parser.prototype.parse = function parse () {
4854
4876
var pp = Parser . prototype ;
4855
4877
4856
4878
4857
- var literal = / ^ (?: ' ( (?: \\ . | [ ^ ' ] ) * ? ) ' | " ( (?: \\ . | [ ^ " ] ) * ? ) " | ; ) / ;
4879
+ var literal = / ^ (?: ' ( (?: [ ^ ' ] | \. ) * ) ' | " ( (?: [ ^ " ] | \. ) * ) " | ; ) / ;
4858
4880
pp . strictDirective = function ( start ) {
4859
4881
var this$1 = this ;
4860
4882
@@ -6426,7 +6448,7 @@ pp$3.parseTemplate = function(ref) {
6426
6448
6427
6449
pp$3 . isAsyncProp = function ( prop ) {
6428
6450
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 ) &&
6430
6452
! lineBreak . test ( this . input . slice ( this . lastTokEnd , this . start ) )
6431
6453
} ;
6432
6454
@@ -7220,7 +7242,7 @@ pp$8.readToken_caret = function() {
7220
7242
pp$8 . readToken_plus_min = function ( code ) {
7221
7243
var next = this . input . charCodeAt ( this . pos + 1 ) ;
7222
7244
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 &&
7224
7246
( this . lastTokEnd === 0 || lineBreak . test ( this . input . slice ( this . lastTokEnd , this . pos ) ) ) ) {
7225
7247
this . skipLineComment ( 3 ) ;
7226
7248
this . skipSpace ( ) ;
@@ -7240,8 +7262,9 @@ pp$8.readToken_lt_gt = function(code) {
7240
7262
if ( this . input . charCodeAt ( this . pos + size ) === 61 ) { return this . finishOp ( types . assign , size + 1 ) }
7241
7263
return this . finishOp ( types . bitShift , size )
7242
7264
}
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 &&
7244
7266
this . input . charCodeAt ( this . pos + 3 ) == 45 ) {
7267
+ if ( this . inModule ) { this . unexpected ( ) ; }
7245
7268
this . skipLineComment ( 4 ) ;
7246
7269
this . skipSpace ( ) ;
7247
7270
return this . nextToken ( )
@@ -7671,7 +7694,7 @@ pp$8.readWord = function() {
7671
7694
} ;
7672
7695
7673
7696
7674
- var version = "5.1.2 " ;
7697
+ var version = "5.1.1 " ;
7675
7698
7676
7699
7677
7700
function parse ( input , options ) {
0 commit comments