JS: Autoformat

This commit is contained in:
Asger Feldthaus
2020-05-19 12:05:32 +01:00
parent f49b36aec7
commit 3f30564d93
7 changed files with 15 additions and 21 deletions

View File

@@ -311,9 +311,7 @@ class ControlFlowNode extends @cfg_node, Locatable, NodeInStmtContainer {
* Holds if this is a final node, that is, a CFG node where execution of a
* toplevel or function terminates.
*/
final predicate isAFinalNode() {
isAFinalNodeOfContainer(_)
}
final predicate isAFinalNode() { isAFinalNodeOfContainer(_) }
/**
* Holds if this node is unreachable, that is, it has no predecessors in the CFG.
@@ -371,7 +369,9 @@ class ControlFlowEntryNode extends SyntheticControlFlowNode, @entry_node {
/** A synthetic CFG node marking the exit of a function or toplevel script. */
class ControlFlowExitNode extends SyntheticControlFlowNode, @exit_node {
override predicate isAFinalNodeOfContainer(StmtContainer container) { exit_cfg_node(this, container) }
override predicate isAFinalNodeOfContainer(StmtContainer container) {
exit_cfg_node(this, container)
}
override string toString() { result = "exit node of " + getContainer().toString() }
}

View File

@@ -1225,9 +1225,7 @@ module DataFlow {
/**
* INTERNAL: Use `parameterNode(Parameter)` instead.
*/
predicate parameterNode(DataFlow::Node nd, Parameter p) {
nd = valueNode(p)
}
predicate parameterNode(DataFlow::Node nd, Parameter p) { nd = valueNode(p) }
/**
* INTERNAL: Use `thisNode(StmtContainer container)` instead.

View File

@@ -263,9 +263,7 @@ class AnalyzedFunction extends DataFlow::AnalyzedValueNode {
* of functions that cannot actually complete normally, since it does not
* account for `finally` blocks and does not check reachability.
*/
private predicate mayReturnImplicitly() {
terminalNode(astNode, any(ExprOrStmt st))
}
private predicate mayReturnImplicitly() { terminalNode(astNode, any(ExprOrStmt st)) }
}
pragma[noinline]

View File

@@ -265,9 +265,7 @@ private PrimitiveType getAnAddOperandPrimitiveType(Expr e, int n) {
* Holds if `e` is a `+` or `+=` expression that could be interpreted as a string append
* (as opposed to a numeric addition) at runtime.
*/
private predicate isStringAppend(Expr e) {
getAnAddOperandPrimitiveType(e, _) = TTString()
}
private predicate isStringAppend(Expr e) { getAnAddOperandPrimitiveType(e, _) = TTString() }
/**
* Holds if `e` is a `+` or `+=` expression that could be interpreted as a numeric addition

View File

@@ -3,6 +3,7 @@
*
* Contains the raw data type underlying `DataFlow::Node`.
*/
private import javascript
/**

View File

@@ -92,8 +92,11 @@ private module CachedSteps {
cached
predicate calls(DataFlow::InvokeNode invk, Function f) { f = invk.getACallee(0) }
private predicate callsBoundInternal(DataFlow::InvokeNode invk, Function f, int boundArgs, boolean contextDependent) {
CallGraph::getABoundFunctionReference(f.flow(), boundArgs, contextDependent).flowsTo(invk.getCalleeNode())
private predicate callsBoundInternal(
DataFlow::InvokeNode invk, Function f, int boundArgs, boolean contextDependent
) {
CallGraph::getABoundFunctionReference(f.flow(), boundArgs, contextDependent)
.flowsTo(invk.getCalleeNode())
}
/**

View File

@@ -7,9 +7,7 @@ import semmle.javascript.frameworks.HTTP
import semmle.javascript.security.SensitiveActions
module NodeJSLib {
private GlobalVariable processVariable() {
variables(result, "process", any(GlobalScope sc))
}
private GlobalVariable processVariable() { variables(result, "process", any(GlobalScope sc)) }
pragma[nomagic]
private GlobalVarAccess processExprInTopLevel(TopLevel tl) {
@@ -27,9 +25,7 @@ module NodeJSLib {
* an import of the `process` module.
*/
private class ImplicitProcessImport extends DataFlow::ModuleImportNode::Range {
ImplicitProcessImport() {
this = DataFlow::exprNode(processExprInNodeModule())
}
ImplicitProcessImport() { this = DataFlow::exprNode(processExprInNodeModule()) }
override string getPath() { result = "process" }
}