view graal/com.oracle.truffle.sl.test/tests/FunctionLiteral.sl @ 19757:e8d2f3f95dcd

Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
author Christian Humer <christian.humer@gmail.com>
date Tue, 10 Mar 2015 19:28:26 +0100
parents ff3136ecb5a7
children
line wrap: on
line source

function add(a, b) {
  return a + b;
}

function sub(a, b) {
  return a - b;
}

function foo(f) {
  println(f(40, 2));
}

function main() {
  foo(add);
  foo(sub);
}