mirror of
https://github.com/github/codeql.git
synced 2026-05-05 21:55:19 +02:00
JS: Deprecate getOwnOptionsObject()
This commit is contained in:
@@ -190,10 +190,12 @@ module Vue {
|
||||
}
|
||||
|
||||
/**
|
||||
* DEPRECATED. Use `getOwnOptions().getARhs()`.
|
||||
*
|
||||
* Gets the options passed to the Vue object, such as the object literal `{...}` in `new Vue{{...})`
|
||||
* or the default export of a single-file component.
|
||||
*/
|
||||
DataFlow::Node getOwnOptionsObject() { none() } // overridden in subclasses
|
||||
deprecated DataFlow::Node getOwnOptionsObject() { none() } // overridden in subclasses
|
||||
|
||||
/**
|
||||
* Gets the class implementing this Vue component, if any.
|
||||
@@ -201,14 +203,14 @@ module Vue {
|
||||
* Specifically, this is a class annotated with `@Component` which flows to the options
|
||||
* object of this Vue component.
|
||||
*/
|
||||
ClassComponent getAsClassComponent() { result.flowsTo(getOwnOptionsObject()) }
|
||||
ClassComponent getAsClassComponent() { result = getOwnOptions().getAValueReachingRhs() }
|
||||
|
||||
/**
|
||||
* Gets the node for option `name` for this component, not including
|
||||
* those from extended objects and mixins.
|
||||
*/
|
||||
DataFlow::Node getOwnOption(string name) {
|
||||
result = getOwnOptionsObject().getALocalSource().getAPropertyWrite(name).getRhs()
|
||||
result = getOwnOptions().getMember(name).getARhs()
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -378,8 +380,6 @@ module Vue {
|
||||
|
||||
override API::Node getOwnOptions() { result = def.getParameter(0) }
|
||||
|
||||
override DataFlow::Node getOwnOptionsObject() { result = def.getArgument(0) }
|
||||
|
||||
override Template::Element getTemplateElement() { none() }
|
||||
|
||||
override Component getABaseComponent() {
|
||||
@@ -426,8 +426,6 @@ module Vue {
|
||||
|
||||
override API::Node getOwnOptions() { result = extend.getParameter(0) }
|
||||
|
||||
override DataFlow::Node getOwnOptionsObject() { result = extend.getArgument(0) }
|
||||
|
||||
override Template::Element getTemplateElement() { none() }
|
||||
|
||||
override Component getABaseComponent() {
|
||||
@@ -473,8 +471,6 @@ module Vue {
|
||||
|
||||
override API::Node getOwnOptions() { result = def.getParameter(1) }
|
||||
|
||||
override DataFlow::Node getOwnOptionsObject() { result = def.getArgument(1) }
|
||||
|
||||
override Template::Element getTemplateElement() { none() }
|
||||
}
|
||||
|
||||
@@ -547,34 +543,6 @@ module Vue {
|
||||
result.getARhs() = getModule().getDefaultOrBulkExport()
|
||||
}
|
||||
|
||||
override DataFlow::Node getOwnOptionsObject() {
|
||||
exists(ExportDefaultDeclaration decl |
|
||||
decl.getTopLevel() = getModule() and
|
||||
result = DataFlow::valueNode(decl.getOperand())
|
||||
)
|
||||
}
|
||||
|
||||
override DataFlow::Node getOwnOption(string name) {
|
||||
// The options of a single file component are defined by the exported object of the script element.
|
||||
// Our current module model does not support reads on this object very well, so we use custom steps for the common cases for now.
|
||||
exists(Module m, DefiniteAbstractValue abstractOptions |
|
||||
any(AnalyzedPropertyWrite write).writes(abstractOptions, name, result) and
|
||||
m = getModule()
|
||||
|
|
||||
// ES2015 exports
|
||||
exists(ExportDeclaration export, DataFlow::AnalyzedNode exported |
|
||||
export.getEnclosingModule() = m and
|
||||
abstractOptions = exported.getAValue()
|
||||
|
|
||||
exported = export.(BulkReExportDeclaration).getSourceNode("default") or
|
||||
exported.asExpr() = export.(ExportDefaultDeclaration).getOperand()
|
||||
)
|
||||
or
|
||||
// Node.js exports
|
||||
abstractOptions = m.(NodeModule).getAModuleExportsValue()
|
||||
)
|
||||
}
|
||||
|
||||
override string toString() { result = file.toString() }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user