File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -496,12 +496,36 @@ Vp.local = function local(x, rhs) {
496496 return ty . Double ;
497497 } , this ) ;
498498
499+ when ( {
500+ type : 'UnaryExpression' ,
501+ operator : '-' ,
502+ argument : {
503+ type : 'Literal' ,
504+ value : match . number ,
505+ raw : hasDot
506+ }
507+ } , function ( ) {
508+ return ty . Double ;
509+ } ) ;
510+
499511 when ( {
500512 type : 'Literal' ,
501513 value : match . all ( match . integer , match . range ( - 0x80000000 , 0x100000000 ) )
502514 } , function ( vars ) {
503515 return ty . Int ;
504516 } , this ) ;
517+
518+ when ( {
519+ type : 'UnaryExpression' ,
520+ operator : '-' ,
521+ argument : {
522+ type : 'Literal' ,
523+ value : match . all ( match . number , match . range ( 0 , 0x80000001 ) ) ,
524+ raw : dotless
525+ }
526+ } , function ( ) {
527+ return ty . Int ;
528+ } ) ;
505529 } ) ;
506530} ;
507531
Original file line number Diff line number Diff line change @@ -368,3 +368,17 @@ exports.testNegativeDoubleReturn = asmAssert.one(
368368 return - 42.1 ;
369369 } ,
370370 { pass : true } ) ;
371+
372+ exports . testNegativeIntVar = asmAssert . one (
373+ "negative integer literal as variable declaration" ,
374+ function f ( ) {
375+ var i = - 42 ;
376+ } ,
377+ { pass : true } ) ;
378+
379+ exports . testNegativeDoubleVar = asmAssert . one (
380+ "negative double literal as variable declaration" ,
381+ function f ( ) {
382+ var i = - 42.1 ;
383+ } ,
384+ { pass : true } ) ;
You can’t perform that action at this time.
0 commit comments