mirror of https://github.com/lukechilds/rollup.git
Rich-Harris
8 years ago
10 changed files with 64 additions and 1 deletions
@ -0,0 +1,19 @@ |
|||
import Node from '../Node.js'; |
|||
import { UNKNOWN } from '../values.js'; |
|||
|
|||
const operators = { |
|||
'&&': ( left, right ) => left && right, |
|||
'||': ( left, right ) => left || right |
|||
}; |
|||
|
|||
export default class LogicalExpression extends Node { |
|||
getValue () { |
|||
const leftValue = this.left.getValue(); |
|||
if ( leftValue === UNKNOWN ) return UNKNOWN; |
|||
|
|||
const rightValue = this.right.getValue(); |
|||
if ( rightValue === UNKNOWN ) return UNKNOWN; |
|||
|
|||
return operators[ this.operator ]( leftValue, rightValue ); |
|||
} |
|||
} |
@ -1,3 +1,3 @@ |
|||
module.exports = { |
|||
description: 'skips a dead branch (h)' |
|||
description: 'skips a dead branch (i)' |
|||
}; |
|||
|
@ -0,0 +1,3 @@ |
|||
module.exports = { |
|||
description: 'skips a dead branch (j)' |
|||
}; |
@ -0,0 +1,7 @@ |
|||
define(function () { 'use strict'; |
|||
|
|||
{ |
|||
console.log( 'true' ); |
|||
} |
|||
|
|||
}); |
@ -0,0 +1,5 @@ |
|||
'use strict'; |
|||
|
|||
{ |
|||
console.log( 'true' ); |
|||
} |
@ -0,0 +1,3 @@ |
|||
{ |
|||
console.log( 'true' ); |
|||
} |
@ -0,0 +1,8 @@ |
|||
(function () { |
|||
'use strict'; |
|||
|
|||
{ |
|||
console.log( 'true' ); |
|||
} |
|||
|
|||
}()); |
@ -0,0 +1,11 @@ |
|||
(function (global, factory) { |
|||
typeof exports === 'object' && typeof module !== 'undefined' ? factory() : |
|||
typeof define === 'function' && define.amd ? define(factory) : |
|||
(factory()); |
|||
}(this, (function () { 'use strict'; |
|||
|
|||
{ |
|||
console.log( 'true' ); |
|||
} |
|||
|
|||
}))); |
@ -0,0 +1,5 @@ |
|||
if ( true && true ) { |
|||
console.log( 'true' ); |
|||
} else { |
|||
console.log( 'false' ); |
|||
} |
Loading…
Reference in new issue