Mercurial > hg > graal-compiler
annotate graal/com.oracle.truffle.sl.test/tests/FunctionLiteral.sl @ 21116:bf8cbbfabdcf
Use snippets for incrementing snippet counters
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Fri, 24 Apr 2015 12:05:38 -0700 |
parents | ff3136ecb5a7 |
children |
rev | line source |
---|---|
13883
ff3136ecb5a7
SL: small changes
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
1 function add(a, b) { |
ff3136ecb5a7
SL: small changes
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
2 return a + b; |
ff3136ecb5a7
SL: small changes
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
3 } |
ff3136ecb5a7
SL: small changes
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
4 |
ff3136ecb5a7
SL: small changes
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
5 function sub(a, b) { |
ff3136ecb5a7
SL: small changes
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
6 return a - b; |
ff3136ecb5a7
SL: small changes
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
7 } |
ff3136ecb5a7
SL: small changes
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
8 |
ff3136ecb5a7
SL: small changes
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
9 function foo(f) { |
ff3136ecb5a7
SL: small changes
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
10 println(f(40, 2)); |
ff3136ecb5a7
SL: small changes
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
11 } |
ff3136ecb5a7
SL: small changes
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
12 |
ff3136ecb5a7
SL: small changes
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
13 function main() { |
ff3136ecb5a7
SL: small changes
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
14 foo(add); |
ff3136ecb5a7
SL: small changes
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
15 foo(sub); |
ff3136ecb5a7
SL: small changes
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
16 } |