зеркало из https://github.com/github/codeql.git
Swift: AST and CFG tests for nil coalescing
This commit is contained in:
Родитель
7e7852eff6
Коммит
dd01da4938
|
@ -3300,6 +3300,21 @@ cfg.swift:
|
|||
# 526| Type = Int
|
||||
# 533| [ConcreteVarDecl] i
|
||||
# 533| Type = Int
|
||||
# 538| [NamedFunction] testNilCoalescing(x:)
|
||||
# 538| InterfaceType = (Int?) -> Int
|
||||
# 538| getParam(0): [ParamDecl] x
|
||||
# 538| Type = Int?
|
||||
# 538| getBody(): [BraceStmt] { ... }
|
||||
# 539| getElement(0): [ReturnStmt] return ...
|
||||
# 539| getResult(): [BinaryExpr] ... ??(_:_:) ...
|
||||
# 539| getFunction(): [DeclRefExpr] ??(_:_:)
|
||||
# 539| getArgument(0): [Argument] : x
|
||||
# 539| getExpr(): [DeclRefExpr] x
|
||||
# 539| getArgument(1): [Argument] : { ... }
|
||||
# 539| getExpr(): [AutoClosureExpr] { ... }
|
||||
# 539| getBody(): [BraceStmt] { ... }
|
||||
# 539| getElement(0): [ReturnStmt] return ...
|
||||
# 539| getResult(): [IntegerLiteralExpr] 0
|
||||
declarations.swift:
|
||||
# 1| [StructDecl] Foo
|
||||
# 2| getMember(0): [PatternBindingDecl] var ... = ...
|
||||
|
|
|
@ -534,3 +534,7 @@ func testAsyncFor () async {
|
|||
print(i)
|
||||
}
|
||||
}
|
||||
|
||||
func testNilCoalescing(x: Int?) -> Int {
|
||||
return x ?? 0
|
||||
}
|
||||
|
|
|
@ -6180,3 +6180,36 @@ cfg.swift:
|
|||
|
||||
# 534| i
|
||||
#-----| -> (Any) ...
|
||||
|
||||
# 538| enter testNilCoalescing(x:)
|
||||
#-----| -> testNilCoalescing(x:)
|
||||
|
||||
# 538| exit testNilCoalescing(x:)
|
||||
|
||||
# 538| exit testNilCoalescing(x:) (abnormal)
|
||||
#-----| -> exit testNilCoalescing(x:)
|
||||
|
||||
# 538| exit testNilCoalescing(x:) (normal)
|
||||
#-----| -> exit testNilCoalescing(x:)
|
||||
|
||||
# 538| testNilCoalescing(x:)
|
||||
#-----| -> x
|
||||
|
||||
# 538| x
|
||||
#-----| -> ??(_:_:)
|
||||
|
||||
# 539| return ...
|
||||
#-----| return -> exit testNilCoalescing(x:) (normal)
|
||||
|
||||
# 539| x
|
||||
#-----| -> { ... }
|
||||
|
||||
# 539| ... ??(_:_:) ...
|
||||
#-----| exception -> exit testNilCoalescing(x:) (abnormal)
|
||||
#-----| -> return ...
|
||||
|
||||
# 539| ??(_:_:)
|
||||
#-----| -> x
|
||||
|
||||
# 539| { ... }
|
||||
#-----| -> ... ??(_:_:) ...
|
||||
|
|
|
@ -534,3 +534,7 @@ func testAsyncFor () async {
|
|||
print(i)
|
||||
}
|
||||
}
|
||||
|
||||
func testNilCoalescing(x: Int?) -> Int {
|
||||
return x ?? 0
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче