Example #1
0
def test_escape_analysis():
    escape_analysis = EscapeAnalysis()
    escape_analysis.visit_fn(fn)
    may_escape = escape_analysis.may_escape

    assert "a_int" not in may_escape, "Scalars don't count as escaping"
    assert "b_array" in may_escape
    assert "c_tuple" in may_escape
    assert "d_tuple" not in may_escape
    assert "e_nested_tuple" in may_escape
    assert "f_nested_tuple" not in may_escape
def test_escape_analysis():
  escape_analysis = EscapeAnalysis()
  escape_analysis.visit_fn(fn)
  may_escape =  escape_analysis.may_escape
 
  assert "a_int" not in may_escape, "Scalars don't count as escaping"
  assert "b_array" in may_escape
  assert "c_tuple" in may_escape
  assert "d_tuple" not in may_escape
  assert "e_nested_tuple" in may_escape 
  assert "f_nested_tuple" not in may_escape
def test_escape_analysis():
    escape_analysis = EscapeAnalysis()
    escape_analysis.visit_fn(fn)
    assert "a" not in escape_analysis.may_escape, "Scalars can't escape function"
    assert "b" in escape_analysis.may_escape, "Nested tuples also escape!"
    assert "e" not in escape_analysis.may_escape