github.com/qri-io/qri@v0.10.1-0.20220104210721-c771715036cb/transform/staticlark/testdata/call_trace.star (about)

     1  
     2  def get_secret():
     3    return 3
     4  
     5  def get_public():
     6    return 4
     7  
     8  def modify(v):
     9    return v * 2
    10  
    11  def dangerous(s, t):
    12    print('Leak %d' % s)
    13  
    14  def bottom(m, n):
    15    a = m + 1 # m is dangerous, n is ok
    16    b = a * 2
    17    dangerous(b, 1)
    18    dangerous(n, 2)
    19  
    20  def middle(w, x, y, z):
    21    c = w + x # c is dangerous, so are w and x
    22    d = c * 3 # d is dangerous
    23    e = y + z
    24    f = d - 1 # f is dangerous
    25    g = e + 1
    26    bottom(f, g)
    27  
    28  def top():
    29    i = get_secret()
    30    j = get_public()
    31    k = modify(i)
    32    l = modify(j)
    33    middle(i, j, k, l)
    34  
    35  top()