Untitled

mail@pastecode.io avatar
unknown
javascript
a month ago
1.1 kB
2
Indexable
Never
/* annotations.js */
/* Experiment with distinct markers for functions, classes, and fields. */


/**
 * @virtualize
 */
function testFunction()
{
    return 1337;
}

function testString()
{
    return "Hello, World!";
}


/**
 * @virtualize
 */
function testParam( a )
{
    return a + 1;
}

/**
 * @virtualize
 */
function stringConcat( a, b )
{
    return a + b;
}

/**
 * @virtualize
 */
function bitwiseAdd( a, b )
{
    var carry = a & b;
    var result = a ^ b;
    while (carry != 0) {
        var shifted_carry = carry << 1;
        carry = result & shifted_carry;
        result = result ^ shifted_carry;
    }
    return result;
}

var a = testFunction();
console.log(`testFunction() returned ${a}`);
var b = testString();
console.log(`testString() returned ${b}`);
var c = testParam( 42 );
console.log(`testParam( 42 ) returned ${c}`);
var d = stringConcat( "Hello, ", "World!" );
console.log(`stringConcat( "Hello, ", "World!" ) returned ${d}`);
var e = bitwiseAdd( 18, 2 );
console.log(`bitwiseAdd( 18, 2 ) returned ${e}`);
Leave a Comment