Skip to content

Instantly share code, notes, and snippets.

@vguerra
Created July 9, 2018 11:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vguerra/5cfe45b2dda873deefd3cc444fc8d507 to your computer and use it in GitHub Desktop.
Save vguerra/5cfe45b2dda873deefd3cc444fc8d507 to your computer and use it in GitHub Desktop.
AST dump
(source_file
(top_level_code_decl
(brace_stmt
(defer_stmt
(func_decl implicit "$defer()" interface type='() -> ()' access=fileprivate
(parameter_list)
(brace_stmt
(call_expr type='()' location=../../../../examples/defer.swift:2:5 range=[../../../../examples/defer.swift:2:5 - line:2:28] nothrow arg_labels=_:
(declref_expr type='(Any..., String, String) -> ()' location=../../../../examples/defer.swift:2:5 range=[../../../../examples/defer.swift:2:5 - line:2:5] decl=Swift.(file).print(_:separator:terminator:) function_ref=single)
(tuple_shuffle_expr implicit type='(Any..., separator: String, terminator: String)' location=../../../../examples/defer.swift:2:11 range=[../../../../examples/defer.swift:2:10 - line:2:28] scalar_to_tuple elements=[-2, -1, -1] variadic_sources=[0] default_args_owner=Swift.(file).print(_:separator:terminator:)
(paren_expr type='Any' location=../../../../examples/defer.swift:2:11 range=[../../../../examples/defer.swift:2:10 - line:2:28]
(erasure_expr implicit type='Any' location=../../../../examples/defer.swift:2:11 range=[../../../../examples/defer.swift:2:11 - line:2:11]
(string_literal_expr type='String' location=../../../../examples/defer.swift:2:11 range=[../../../../examples/defer.swift:2:11 - line:2:11] encoding=utf8 value="end of program." builtin_initializer=Swift.(file).String.init(_builtinStringLiteral:utf8CodeUnitCount:isASCII:) initializer=**NULL**)))))))
(call_expr implicit type='()' location=../../../../examples/defer.swift:1:7 range=[../../../../examples/defer.swift:1:7 - line:1:7] nothrow arg_labels=
(declref_expr implicit type='() -> ()' location=../../../../examples/defer.swift:1:7 range=[../../../../examples/defer.swift:1:7 - line:1:7] decl=defer.(file).top-level code.$defer() direct_to_storage function_ref=single)
(tuple_expr implicit type='()')))))
(top_level_code_decl
(brace_stmt
(pattern_binding_decl
(pattern_named type='Int' 'x')
(call_expr implicit type='Int' location=../../../../examples/defer.swift:5:9 range=[../../../../examples/defer.swift:5:9 - line:5:9] nothrow arg_labels=_builtinIntegerLiteral:
(constructor_ref_call_expr implicit type='(_MaxBuiltinIntegerType) -> Int' location=../../../../examples/defer.swift:5:9 range=[../../../../examples/defer.swift:5:9 - line:5:9] nothrow
(declref_expr implicit type='(Int.Type) -> (_MaxBuiltinIntegerType) -> Int' location=../../../../examples/defer.swift:5:9 range=[../../../../examples/defer.swift:5:9 - line:5:9] decl=Swift.(file).Int.init(_builtinIntegerLiteral:) function_ref=single)
(type_expr implicit type='Int.Type' location=../../../../examples/defer.swift:5:9 range=[../../../../examples/defer.swift:5:9 - line:5:9] typerepr='Int'))
(tuple_expr implicit type='(_builtinIntegerLiteral: Int2048)' location=../../../../examples/defer.swift:5:9 range=[../../../../examples/defer.swift:5:9 - line:5:9] names=_builtinIntegerLiteral
(integer_literal_expr type='Int2048' location=../../../../examples/defer.swift:5:9 range=[../../../../examples/defer.swift:5:9 - line:5:9] value=1))))
))
(var_decl "x" type='Int' interface type='Int' access=internal let storage_kind=stored)
(top_level_code_decl
(brace_stmt
(pattern_binding_decl
(pattern_named type='Int' 'y')
(call_expr implicit type='Int' location=../../../../examples/defer.swift:6:9 range=[../../../../examples/defer.swift:6:9 - line:6:9] nothrow arg_labels=_builtinIntegerLiteral:
(constructor_ref_call_expr implicit type='(_MaxBuiltinIntegerType) -> Int' location=../../../../examples/defer.swift:6:9 range=[../../../../examples/defer.swift:6:9 - line:6:9] nothrow
(declref_expr implicit type='(Int.Type) -> (_MaxBuiltinIntegerType) -> Int' location=../../../../examples/defer.swift:6:9 range=[../../../../examples/defer.swift:6:9 - line:6:9] decl=Swift.(file).Int.init(_builtinIntegerLiteral:) function_ref=single)
(type_expr implicit type='Int.Type' location=../../../../examples/defer.swift:6:9 range=[../../../../examples/defer.swift:6:9 - line:6:9] typerepr='Int'))
(tuple_expr implicit type='(_builtinIntegerLiteral: Int2048)' location=../../../../examples/defer.swift:6:9 range=[../../../../examples/defer.swift:6:9 - line:6:9] names=_builtinIntegerLiteral
(integer_literal_expr type='Int2048' location=../../../../examples/defer.swift:6:9 range=[../../../../examples/defer.swift:6:9 - line:6:9] value=3))))
))
(var_decl "y" type='Int' interface type='Int' access=internal let storage_kind=stored)
(top_level_code_decl
(brace_stmt
(if_stmt
(call_expr implicit type='Int1' location=../../../../examples/defer.swift:8:4 range=[../../../../examples/defer.swift:8:4 - line:8:10] nothrow arg_labels=
(dot_syntax_call_expr implicit type='() -> Int1' location=../../../../examples/defer.swift:8:4 range=[../../../../examples/defer.swift:8:4 - line:8:10] nothrow
(declref_expr implicit type='(Bool) -> () -> Int1' location=../../../../examples/defer.swift:8:7 range=[../../../../examples/defer.swift:8:7 - line:8:7] decl=Swift.(file).Bool._getBuiltinLogicValue() function_ref=double)
(paren_expr type='(Bool)' location=../../../../examples/defer.swift:8:7 range=[../../../../examples/defer.swift:8:4 - line:8:10]
(binary_expr type='Bool' location=../../../../examples/defer.swift:8:7 range=[../../../../examples/defer.swift:8:5 - line:8:9] nothrow
(dot_syntax_call_expr implicit type='(Int, Int) -> Bool' location=../../../../examples/defer.swift:8:7 range=[../../../../examples/defer.swift:8:7 - line:8:7] nothrow
(declref_expr type='(Int.Type) -> (Int, Int) -> Bool' location=../../../../examples/defer.swift:8:7 range=[../../../../examples/defer.swift:8:7 - line:8:7] decl=Swift.(file).Int.> function_ref=unapplied)
(type_expr implicit type='Int.Type' location=../../../../examples/defer.swift:8:7 range=[../../../../examples/defer.swift:8:7 - line:8:7] typerepr='Int'))
(tuple_expr implicit type='(Int, Int)' location=../../../../examples/defer.swift:8:5 range=[../../../../examples/defer.swift:8:5 - line:8:9]
(declref_expr type='Int' location=../../../../examples/defer.swift:8:5 range=[../../../../examples/defer.swift:8:5 - line:8:5] decl=defer.(file).x@../../../../examples/defer.swift:5:5 direct_to_storage function_ref=unapplied)
(declref_expr type='Int' location=../../../../examples/defer.swift:8:9 range=[../../../../examples/defer.swift:8:9 - line:8:9] decl=defer.(file).y@../../../../examples/defer.swift:6:5 direct_to_storage function_ref=unapplied)))))
(tuple_expr implicit type='()'))
(brace_stmt
(defer_stmt
(func_decl implicit "$defer()" interface type='() -> ()' access=fileprivate
(parameter_list)
(brace_stmt
(call_expr type='()' location=../../../../examples/defer.swift:10:9 range=[../../../../examples/defer.swift:10:9 - line:10:42] nothrow arg_labels=_:
(declref_expr type='(Any..., String, String) -> ()' location=../../../../examples/defer.swift:10:9 range=[../../../../examples/defer.swift:10:9 - line:10:9] decl=Swift.(file).print(_:separator:terminator:) function_ref=single)
(tuple_shuffle_expr implicit type='(Any..., separator: String, terminator: String)' location=../../../../examples/defer.swift:10:15 range=[../../../../examples/defer.swift:10:14 - line:10:42] scalar_to_tuple elements=[-2, -1, -1] variadic_sources=[0] default_args_owner=Swift.(file).print(_:separator:terminator:)
(paren_expr type='Any' location=../../../../examples/defer.swift:10:15 range=[../../../../examples/defer.swift:10:14 - line:10:42]
(erasure_expr implicit type='Any' location=../../../../examples/defer.swift:10:15 range=[../../../../examples/defer.swift:10:15 - line:10:15]
(string_literal_expr type='String' location=../../../../examples/defer.swift:10:15 range=[../../../../examples/defer.swift:10:15 - line:10:15] encoding=utf8 value="not so useful defer stmt." builtin_initializer=Swift.(file).String.init(_builtinStringLiteral:utf8CodeUnitCount:isASCII:) initializer=**NULL**)))))))
(call_expr implicit type='()' location=../../../../examples/defer.swift:9:11 range=[../../../../examples/defer.swift:9:11 - line:9:11] nothrow arg_labels=
(declref_expr implicit type='() -> ()' location=../../../../examples/defer.swift:9:11 range=[../../../../examples/defer.swift:9:11 - line:9:11] decl=defer.(file).top-level code.$defer() direct_to_storage function_ref=single)
(tuple_expr implicit type='()'))))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment