circle-ir 4.9.19 → 4.9.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analysis/config-loader.d.ts.map +1 -1
- package/dist/analysis/config-loader.js +56 -7
- package/dist/analysis/config-loader.js.map +1 -1
- package/dist/analysis/constant-propagation/evaluator.d.ts.map +1 -1
- package/dist/analysis/constant-propagation/evaluator.js.map +1 -1
- package/dist/analysis/constant-propagation/index.js.map +1 -1
- package/dist/analysis/constant-propagation/propagator.d.ts.map +1 -1
- package/dist/analysis/constant-propagation/propagator.js +3 -1
- package/dist/analysis/constant-propagation/propagator.js.map +1 -1
- package/dist/analysis/dfg-verifier.d.ts.map +1 -1
- package/dist/analysis/dfg-verifier.js.map +1 -1
- package/dist/analysis/dfg-walk.js.map +1 -1
- package/dist/analysis/findings.d.ts +1 -1
- package/dist/analysis/findings.d.ts.map +1 -1
- package/dist/analysis/findings.js +27 -1
- package/dist/analysis/findings.js.map +1 -1
- package/dist/analysis/interprocedural.js.map +1 -1
- package/dist/analysis/metrics/metric-runner.d.ts.map +1 -1
- package/dist/analysis/metrics/passes/cohesion-metrics-pass.d.ts.map +1 -1
- package/dist/analysis/metrics/passes/complexity-metrics-pass.d.ts.map +1 -1
- package/dist/analysis/metrics/passes/composite-metrics-pass.d.ts.map +1 -1
- package/dist/analysis/metrics/passes/coupling-metrics-pass.d.ts.map +1 -1
- package/dist/analysis/metrics/passes/data-flow-metrics-pass.d.ts.map +1 -1
- package/dist/analysis/metrics/passes/documentation-metrics-pass.d.ts.map +1 -1
- package/dist/analysis/metrics/passes/halstead-metrics-pass.d.ts.map +1 -1
- package/dist/analysis/metrics/passes/inheritance-metrics-pass.d.ts.map +1 -1
- package/dist/analysis/metrics/passes/size-metrics-pass.d.ts.map +1 -1
- package/dist/analysis/passes/blocking-main-thread-pass.d.ts +1 -1
- package/dist/analysis/passes/blocking-main-thread-pass.d.ts.map +1 -1
- package/dist/analysis/passes/broad-catch-pass.d.ts +1 -1
- package/dist/analysis/passes/broad-catch-pass.d.ts.map +1 -1
- package/dist/analysis/passes/cache-no-vary-pass.d.ts +1 -1
- package/dist/analysis/passes/cache-no-vary-pass.d.ts.map +1 -1
- package/dist/analysis/passes/circular-dependency-pass.d.ts.map +1 -1
- package/dist/analysis/passes/cleanup-verify-pass.d.ts +1 -1
- package/dist/analysis/passes/cleanup-verify-pass.d.ts.map +1 -1
- package/dist/analysis/passes/cleartext-credential-transport-pass.d.ts +1 -1
- package/dist/analysis/passes/cleartext-credential-transport-pass.d.ts.map +1 -1
- package/dist/analysis/passes/cli-main-reflection-suppress-pass.d.ts +1 -1
- package/dist/analysis/passes/cli-main-reflection-suppress-pass.d.ts.map +1 -1
- package/dist/analysis/passes/constant-propagation-pass.d.ts +1 -1
- package/dist/analysis/passes/constant-propagation-pass.d.ts.map +1 -1
- package/dist/analysis/passes/constant-propagation-pass.js.map +1 -1
- package/dist/analysis/passes/cross-file-pass.d.ts.map +1 -1
- package/dist/analysis/passes/cross-file-pass.js +1 -1
- package/dist/analysis/passes/cross-file-pass.js.map +1 -1
- package/dist/analysis/passes/csrf-protection-disabled-pass.d.ts +1 -1
- package/dist/analysis/passes/csrf-protection-disabled-pass.d.ts.map +1 -1
- package/dist/analysis/passes/dead-code-pass.d.ts +1 -1
- package/dist/analysis/passes/dead-code-pass.d.ts.map +1 -1
- package/dist/analysis/passes/deep-inheritance-pass.d.ts +1 -1
- package/dist/analysis/passes/deep-inheritance-pass.d.ts.map +1 -1
- package/dist/analysis/passes/dependency-fan-out-pass.d.ts +1 -1
- package/dist/analysis/passes/dependency-fan-out-pass.d.ts.map +1 -1
- package/dist/analysis/passes/deserialization-safety-gate-pass.d.ts +1 -1
- package/dist/analysis/passes/deserialization-safety-gate-pass.d.ts.map +1 -1
- package/dist/analysis/passes/deserialization-safety-gate-pass.js.map +1 -1
- package/dist/analysis/passes/double-close-pass.d.ts +1 -1
- package/dist/analysis/passes/double-close-pass.d.ts.map +1 -1
- package/dist/analysis/passes/excessive-allocation-pass.d.ts +1 -1
- package/dist/analysis/passes/excessive-allocation-pass.d.ts.map +1 -1
- package/dist/analysis/passes/feature-envy-pass.d.ts +1 -1
- package/dist/analysis/passes/feature-envy-pass.d.ts.map +1 -1
- package/dist/analysis/passes/god-class-pass.d.ts +1 -1
- package/dist/analysis/passes/god-class-pass.d.ts.map +1 -1
- package/dist/analysis/passes/infinite-loop-pass.d.ts +1 -1
- package/dist/analysis/passes/infinite-loop-pass.d.ts.map +1 -1
- package/dist/analysis/passes/info-disclosure-stacktrace-pass.d.ts +1 -1
- package/dist/analysis/passes/info-disclosure-stacktrace-pass.d.ts.map +1 -1
- package/dist/analysis/passes/insecure-cookie-pass.d.ts +1 -1
- package/dist/analysis/passes/insecure-cookie-pass.d.ts.map +1 -1
- package/dist/analysis/passes/insecure-deserialization-config-pass.d.ts +1 -1
- package/dist/analysis/passes/insecure-deserialization-config-pass.d.ts.map +1 -1
- package/dist/analysis/passes/interprocedural-pass.d.ts +1 -1
- package/dist/analysis/passes/interprocedural-pass.d.ts.map +1 -1
- package/dist/analysis/passes/jwt-verify-disabled-pass.d.ts +1 -1
- package/dist/analysis/passes/jwt-verify-disabled-pass.d.ts.map +1 -1
- package/dist/analysis/passes/language-sources-pass.d.ts +10 -10
- package/dist/analysis/passes/language-sources-pass.d.ts.map +1 -1
- package/dist/analysis/passes/language-sources-pass.js +3 -8
- package/dist/analysis/passes/language-sources-pass.js.map +1 -1
- package/dist/analysis/passes/leaked-global-pass.d.ts +1 -1
- package/dist/analysis/passes/leaked-global-pass.d.ts.map +1 -1
- package/dist/analysis/passes/library-profile-sink-gate-pass.d.ts +2 -2
- package/dist/analysis/passes/library-profile-sink-gate-pass.d.ts.map +1 -1
- package/dist/analysis/passes/library-profile-source-gate-pass.d.ts +1 -1
- package/dist/analysis/passes/library-profile-source-gate-pass.d.ts.map +1 -1
- package/dist/analysis/passes/library-profile-xss-gate-pass.d.ts +1 -1
- package/dist/analysis/passes/library-profile-xss-gate-pass.d.ts.map +1 -1
- package/dist/analysis/passes/mass-assignment-pass.d.ts +1 -1
- package/dist/analysis/passes/mass-assignment-pass.d.ts.map +1 -1
- package/dist/analysis/passes/missing-await-pass.d.ts +1 -1
- package/dist/analysis/passes/missing-await-pass.d.ts.map +1 -1
- package/dist/analysis/passes/missing-guard-dom-pass.d.ts +1 -1
- package/dist/analysis/passes/missing-guard-dom-pass.d.ts.map +1 -1
- package/dist/analysis/passes/missing-override-pass.d.ts +1 -1
- package/dist/analysis/passes/missing-override-pass.d.ts.map +1 -1
- package/dist/analysis/passes/missing-public-doc-pass.d.ts +1 -1
- package/dist/analysis/passes/missing-public-doc-pass.d.ts.map +1 -1
- package/dist/analysis/passes/missing-sanitizer-gate-pass.d.ts +1 -1
- package/dist/analysis/passes/missing-sanitizer-gate-pass.d.ts.map +1 -1
- package/dist/analysis/passes/missing-stream-pass.d.ts +1 -1
- package/dist/analysis/passes/missing-stream-pass.d.ts.map +1 -1
- package/dist/analysis/passes/module-side-effect-pass.d.ts +1 -1
- package/dist/analysis/passes/module-side-effect-pass.d.ts.map +1 -1
- package/dist/analysis/passes/mybatis-annotation-sql-sink-pass.d.ts +1 -1
- package/dist/analysis/passes/mybatis-annotation-sql-sink-pass.d.ts.map +1 -1
- package/dist/analysis/passes/n-plus-one-pass.d.ts +1 -1
- package/dist/analysis/passes/n-plus-one-pass.d.ts.map +1 -1
- package/dist/analysis/passes/naming-convention-pass.d.ts +1 -1
- package/dist/analysis/passes/naming-convention-pass.d.ts.map +1 -1
- package/dist/analysis/passes/naming-convention-pass.js.map +1 -1
- package/dist/analysis/passes/null-deref-pass.d.ts +1 -1
- package/dist/analysis/passes/null-deref-pass.d.ts.map +1 -1
- package/dist/analysis/passes/orphan-module-pass.d.ts.map +1 -1
- package/dist/analysis/passes/plaintext-password-storage-pass.d.ts +1 -1
- package/dist/analysis/passes/plaintext-password-storage-pass.d.ts.map +1 -1
- package/dist/analysis/passes/prompt-injection-safety-gate-pass.d.ts +1 -1
- package/dist/analysis/passes/prompt-injection-safety-gate-pass.d.ts.map +1 -1
- package/dist/analysis/passes/python-receiver-taint-format-pass.d.ts +1 -1
- package/dist/analysis/passes/python-receiver-taint-format-pass.d.ts.map +1 -1
- package/dist/analysis/passes/react-inline-jsx-pass.d.ts +1 -1
- package/dist/analysis/passes/react-inline-jsx-pass.d.ts.map +1 -1
- package/dist/analysis/passes/redundant-loop-pass.d.ts +1 -1
- package/dist/analysis/passes/redundant-loop-pass.d.ts.map +1 -1
- package/dist/analysis/passes/resource-leak-pass.d.ts +1 -1
- package/dist/analysis/passes/resource-leak-pass.d.ts.map +1 -1
- package/dist/analysis/passes/scan-secrets-pass.d.ts +1 -1
- package/dist/analysis/passes/scan-secrets-pass.d.ts.map +1 -1
- package/dist/analysis/passes/security-headers-pass.d.ts +1 -1
- package/dist/analysis/passes/security-headers-pass.d.ts.map +1 -1
- package/dist/analysis/passes/security-headers-pass.js.map +1 -1
- package/dist/analysis/passes/serial-await-pass.d.ts +1 -1
- package/dist/analysis/passes/serial-await-pass.d.ts.map +1 -1
- package/dist/analysis/passes/sink-filter-pass.d.ts +1 -1
- package/dist/analysis/passes/sink-filter-pass.d.ts.map +1 -1
- package/dist/analysis/passes/sink-filter-pass.js +1 -1
- package/dist/analysis/passes/sink-filter-pass.js.map +1 -1
- package/dist/analysis/passes/sink-semantics-pass.d.ts +1 -1
- package/dist/analysis/passes/sink-semantics-pass.d.ts.map +1 -1
- package/dist/analysis/passes/source-semantics-pass.d.ts +1 -1
- package/dist/analysis/passes/source-semantics-pass.d.ts.map +1 -1
- package/dist/analysis/passes/speculative-prompt-param-source-pass.d.ts +1 -1
- package/dist/analysis/passes/speculative-prompt-param-source-pass.d.ts.map +1 -1
- package/dist/analysis/passes/speculative-prompt-param-source-pass.js.map +1 -1
- package/dist/analysis/passes/spring4shell-pass.d.ts +1 -1
- package/dist/analysis/passes/spring4shell-pass.d.ts.map +1 -1
- package/dist/analysis/passes/stale-doc-ref-pass.d.ts +1 -1
- package/dist/analysis/passes/stale-doc-ref-pass.d.ts.map +1 -1
- package/dist/analysis/passes/string-concat-loop-pass.d.ts +1 -1
- package/dist/analysis/passes/string-concat-loop-pass.d.ts.map +1 -1
- package/dist/analysis/passes/swallowed-exception-pass.d.ts +1 -1
- package/dist/analysis/passes/swallowed-exception-pass.d.ts.map +1 -1
- package/dist/analysis/passes/sync-io-async-pass.d.ts +1 -1
- package/dist/analysis/passes/sync-io-async-pass.d.ts.map +1 -1
- package/dist/analysis/passes/taint-matcher-pass.d.ts +1 -1
- package/dist/analysis/passes/taint-matcher-pass.d.ts.map +1 -1
- package/dist/analysis/passes/taint-propagation-pass.d.ts +1 -1
- package/dist/analysis/passes/taint-propagation-pass.d.ts.map +1 -1
- package/dist/analysis/passes/tls-verify-disabled-pass.d.ts +1 -1
- package/dist/analysis/passes/tls-verify-disabled-pass.d.ts.map +1 -1
- package/dist/analysis/passes/todo-in-prod-pass.d.ts +1 -1
- package/dist/analysis/passes/todo-in-prod-pass.d.ts.map +1 -1
- package/dist/analysis/passes/unbounded-collection-pass.d.ts +1 -1
- package/dist/analysis/passes/unbounded-collection-pass.d.ts.map +1 -1
- package/dist/analysis/passes/unchecked-return-pass.d.ts +1 -1
- package/dist/analysis/passes/unchecked-return-pass.d.ts.map +1 -1
- package/dist/analysis/passes/unhandled-exception-pass.d.ts +1 -1
- package/dist/analysis/passes/unhandled-exception-pass.d.ts.map +1 -1
- package/dist/analysis/passes/unhandled-exception-pass.js +4 -20
- package/dist/analysis/passes/unhandled-exception-pass.js.map +1 -1
- package/dist/analysis/passes/unrestricted-file-upload-pass.d.ts +1 -1
- package/dist/analysis/passes/unrestricted-file-upload-pass.d.ts.map +1 -1
- package/dist/analysis/passes/unused-interface-method-pass.d.ts +1 -1
- package/dist/analysis/passes/unused-interface-method-pass.d.ts.map +1 -1
- package/dist/analysis/passes/unused-variable-pass.d.ts +1 -1
- package/dist/analysis/passes/unused-variable-pass.d.ts.map +1 -1
- package/dist/analysis/passes/use-after-close-pass.d.ts +1 -1
- package/dist/analysis/passes/use-after-close-pass.d.ts.map +1 -1
- package/dist/analysis/passes/variable-shadowing-pass.d.ts +1 -1
- package/dist/analysis/passes/variable-shadowing-pass.d.ts.map +1 -1
- package/dist/analysis/passes/weak-crypto-pass.d.ts +1 -1
- package/dist/analysis/passes/weak-crypto-pass.d.ts.map +1 -1
- package/dist/analysis/passes/weak-hash-pass.d.ts +1 -1
- package/dist/analysis/passes/weak-hash-pass.d.ts.map +1 -1
- package/dist/analysis/passes/weak-password-encoding-pass.d.ts +1 -1
- package/dist/analysis/passes/weak-password-encoding-pass.d.ts.map +1 -1
- package/dist/analysis/passes/weak-password-hash-pass.d.ts +1 -1
- package/dist/analysis/passes/weak-password-hash-pass.d.ts.map +1 -1
- package/dist/analysis/passes/weak-random-pass.d.ts +1 -1
- package/dist/analysis/passes/weak-random-pass.d.ts.map +1 -1
- package/dist/analysis/passes/xml-entity-expansion-pass.d.ts +1 -1
- package/dist/analysis/passes/xml-entity-expansion-pass.d.ts.map +1 -1
- package/dist/analysis/path-finder.d.ts.map +1 -1
- package/dist/analysis/path-finder.js.map +1 -1
- package/dist/analysis/project-profile-transform.js.map +1 -1
- package/dist/analysis/require-entry-path.js.map +1 -1
- package/dist/analysis/sbom.js.map +1 -1
- package/dist/analysis/taint-matcher.js.map +1 -1
- package/dist/analyzer.d.ts.map +1 -1
- package/dist/analyzer.js +4 -0
- package/dist/analyzer.js.map +1 -1
- package/dist/browser/circle-ir.js +157 -54
- package/dist/browser.js.map +1 -1
- package/dist/core/circle-ir-core.cjs +150 -29
- package/dist/core/circle-ir-core.js +150 -29
- package/dist/core/extractors/cfg.js +2 -2
- package/dist/core/extractors/cfg.js.map +1 -1
- package/dist/core/extractors/dfg.js +1 -1
- package/dist/core/extractors/dfg.js.map +1 -1
- package/dist/core/extractors/runtime-registrations.js +2 -2
- package/dist/core/extractors/runtime-registrations.js.map +1 -1
- package/dist/core/extractors/types.js.map +1 -1
- package/dist/core/parser.d.ts.map +1 -1
- package/dist/core/parser.js +4 -0
- package/dist/core/parser.js.map +1 -1
- package/dist/graph/analysis-pass.d.ts.map +1 -1
- package/dist/graph/code-graph.d.ts.map +1 -1
- package/dist/graph/dominator-graph.d.ts.map +1 -1
- package/dist/graph/exception-flow-graph.d.ts.map +1 -1
- package/dist/graph/import-graph.d.ts.map +1 -1
- package/dist/graph/project-graph.d.ts.map +1 -1
- package/dist/graph/scope-graph.d.ts.map +1 -1
- package/dist/languages/plugins/base.d.ts.map +1 -1
- package/dist/languages/plugins/bash.d.ts +1 -1
- package/dist/languages/plugins/bash.d.ts.map +1 -1
- package/dist/languages/plugins/csharp.d.ts +1 -1
- package/dist/languages/plugins/csharp.d.ts.map +1 -1
- package/dist/languages/plugins/go.d.ts +1 -1
- package/dist/languages/plugins/go.d.ts.map +1 -1
- package/dist/languages/plugins/html.d.ts +1 -1
- package/dist/languages/plugins/html.d.ts.map +1 -1
- package/dist/languages/plugins/java.d.ts +1 -1
- package/dist/languages/plugins/java.d.ts.map +1 -1
- package/dist/languages/plugins/javascript.d.ts +1 -1
- package/dist/languages/plugins/javascript.d.ts.map +1 -1
- package/dist/languages/plugins/python.d.ts +1 -1
- package/dist/languages/plugins/python.d.ts.map +1 -1
- package/dist/languages/plugins/rust.d.ts +1 -1
- package/dist/languages/plugins/rust.d.ts.map +1 -1
- package/dist/languages/plugins/vue.d.ts +1 -1
- package/dist/languages/plugins/vue.d.ts.map +1 -1
- package/dist/resolution/cross-file.d.ts.map +1 -1
- package/dist/resolution/symbol-table.d.ts.map +1 -1
- package/dist/resolution/type-hierarchy.d.ts.map +1 -1
- package/dist/resolution/type-hierarchy.js.map +1 -1
- package/dist/types/index.d.ts +28 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/wasm/web-tree-sitter.wasm +0 -0
- package/package.json +7 -7
|
@@ -122,6 +122,18 @@ function setModule(module2) {
|
|
|
122
122
|
}
|
|
123
123
|
__name(setModule, "setModule");
|
|
124
124
|
var C;
|
|
125
|
+
function newFinalizer(handler) {
|
|
126
|
+
try {
|
|
127
|
+
return new FinalizationRegistry(handler);
|
|
128
|
+
} catch (e) {
|
|
129
|
+
console.error("Unsupported FinalizationRegistry:", e);
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
__name(newFinalizer, "newFinalizer");
|
|
134
|
+
var finalizer = newFinalizer((address) => {
|
|
135
|
+
C._ts_lookahead_iterator_delete(address);
|
|
136
|
+
});
|
|
125
137
|
var LookaheadIterator = class {
|
|
126
138
|
static {
|
|
127
139
|
__name(this, "LookaheadIterator");
|
|
@@ -132,21 +144,39 @@ var LookaheadIterator = class {
|
|
|
132
144
|
/** @internal */
|
|
133
145
|
language;
|
|
134
146
|
/** @internal */
|
|
147
|
+
positioned = false;
|
|
148
|
+
/** @internal */
|
|
135
149
|
constructor(internal, address, language) {
|
|
136
150
|
assertInternal(internal);
|
|
137
151
|
this[0] = address;
|
|
138
152
|
this.language = language;
|
|
153
|
+
finalizer?.register(this, address, this);
|
|
139
154
|
}
|
|
140
|
-
/**
|
|
155
|
+
/**
|
|
156
|
+
* Get the current symbol of the lookahead iterator.
|
|
157
|
+
*
|
|
158
|
+
* Returns `null` if the iterator is not positioned on a symbol:
|
|
159
|
+
*
|
|
160
|
+
* - Before the first iteration step
|
|
161
|
+
* - After the iterator is exhausted
|
|
162
|
+
* - After a {@link reset} or {@link resetState} call
|
|
163
|
+
*/
|
|
141
164
|
get currentTypeId() {
|
|
142
|
-
return C._ts_lookahead_iterator_current_symbol(this[0]);
|
|
165
|
+
return this.positioned ? C._ts_lookahead_iterator_current_symbol(this[0]) : null;
|
|
143
166
|
}
|
|
144
|
-
/**
|
|
167
|
+
/**
|
|
168
|
+
* Get the current symbol name of the lookahead iterator.
|
|
169
|
+
*
|
|
170
|
+
* Returns `null` if the iterator is not positioned on a symbol.
|
|
171
|
+
*/
|
|
145
172
|
get currentType() {
|
|
146
|
-
|
|
173
|
+
const id = this.currentTypeId;
|
|
174
|
+
if (id === null) return null;
|
|
175
|
+
return this.language.types[id] ?? C.UTF8ToString(C._ts_language_symbol_name(this.language[0], id));
|
|
147
176
|
}
|
|
148
177
|
/** Delete the lookahead iterator, freeing its resources. */
|
|
149
178
|
delete() {
|
|
179
|
+
finalizer?.unregister(this);
|
|
150
180
|
C._ts_lookahead_iterator_delete(this[0]);
|
|
151
181
|
this[0] = 0;
|
|
152
182
|
}
|
|
@@ -159,6 +189,7 @@ var LookaheadIterator = class {
|
|
|
159
189
|
reset(language, stateId) {
|
|
160
190
|
if (C._ts_lookahead_iterator_reset(this[0], language[0], stateId)) {
|
|
161
191
|
this.language = language;
|
|
192
|
+
this.positioned = false;
|
|
162
193
|
return true;
|
|
163
194
|
}
|
|
164
195
|
return false;
|
|
@@ -170,7 +201,9 @@ var LookaheadIterator = class {
|
|
|
170
201
|
* `false` otherwise.
|
|
171
202
|
*/
|
|
172
203
|
resetState(stateId) {
|
|
173
|
-
|
|
204
|
+
if (!C._ts_lookahead_iterator_reset_state(this[0], stateId)) return false;
|
|
205
|
+
this.positioned = false;
|
|
206
|
+
return true;
|
|
174
207
|
}
|
|
175
208
|
/**
|
|
176
209
|
* Returns an iterator that iterates over the symbols of the lookahead iterator.
|
|
@@ -181,10 +214,9 @@ var LookaheadIterator = class {
|
|
|
181
214
|
[Symbol.iterator]() {
|
|
182
215
|
return {
|
|
183
216
|
next: /* @__PURE__ */ __name(() => {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}
|
|
187
|
-
return { done: true, value: "" };
|
|
217
|
+
this.positioned = Boolean(C._ts_lookahead_iterator_next(this[0]));
|
|
218
|
+
const value = this.currentType;
|
|
219
|
+
return value === null ? { done: true, value: "" } : { done: false, value };
|
|
188
220
|
}, "next")
|
|
189
221
|
};
|
|
190
222
|
}
|
|
@@ -210,6 +242,9 @@ function getText(tree, startIndex, endIndex, startPosition) {
|
|
|
210
242
|
return result ?? "";
|
|
211
243
|
}
|
|
212
244
|
__name(getText, "getText");
|
|
245
|
+
var finalizer2 = newFinalizer((address) => {
|
|
246
|
+
C._ts_tree_delete(address);
|
|
247
|
+
});
|
|
213
248
|
var Tree = class _Tree {
|
|
214
249
|
static {
|
|
215
250
|
__name(this, "Tree");
|
|
@@ -227,6 +262,7 @@ var Tree = class _Tree {
|
|
|
227
262
|
this[0] = address;
|
|
228
263
|
this.language = language;
|
|
229
264
|
this.textCallback = textCallback;
|
|
265
|
+
finalizer2?.register(this, address, this);
|
|
230
266
|
}
|
|
231
267
|
/** Create a shallow copy of the syntax tree. This is very fast. */
|
|
232
268
|
copy() {
|
|
@@ -235,6 +271,7 @@ var Tree = class _Tree {
|
|
|
235
271
|
}
|
|
236
272
|
/** Delete the syntax tree, freeing its resources. */
|
|
237
273
|
delete() {
|
|
274
|
+
finalizer2?.unregister(this);
|
|
238
275
|
C._ts_tree_delete(this[0]);
|
|
239
276
|
this[0] = 0;
|
|
240
277
|
}
|
|
@@ -315,6 +352,9 @@ var Tree = class _Tree {
|
|
|
315
352
|
return result;
|
|
316
353
|
}
|
|
317
354
|
};
|
|
355
|
+
var finalizer3 = newFinalizer((address) => {
|
|
356
|
+
C._ts_tree_cursor_delete_wasm(address);
|
|
357
|
+
});
|
|
318
358
|
var TreeCursor = class _TreeCursor {
|
|
319
359
|
static {
|
|
320
360
|
__name(this, "TreeCursor");
|
|
@@ -342,6 +382,7 @@ var TreeCursor = class _TreeCursor {
|
|
|
342
382
|
assertInternal(internal);
|
|
343
383
|
this.tree = tree;
|
|
344
384
|
unmarshalTreeCursor(this);
|
|
385
|
+
finalizer3?.register(this, this.tree[0], this);
|
|
345
386
|
}
|
|
346
387
|
/** Creates a deep copy of the tree cursor. This allocates new memory. */
|
|
347
388
|
copy() {
|
|
@@ -352,6 +393,7 @@ var TreeCursor = class _TreeCursor {
|
|
|
352
393
|
}
|
|
353
394
|
/** Delete the tree cursor, freeing its resources. */
|
|
354
395
|
delete() {
|
|
396
|
+
finalizer3?.unregister(this);
|
|
355
397
|
marshalTreeCursor(this);
|
|
356
398
|
C._ts_tree_cursor_delete_wasm(this.tree[0]);
|
|
357
399
|
this[0] = this[1] = this[2] = 0;
|
|
@@ -1446,8 +1488,9 @@ var Language = class _Language {
|
|
|
1446
1488
|
* This returns `null` if state is invalid for this language.
|
|
1447
1489
|
*
|
|
1448
1490
|
* Iterating {@link LookaheadIterator} will yield valid symbols in the given
|
|
1449
|
-
* parse state.
|
|
1450
|
-
*
|
|
1491
|
+
* parse state. A newly created iterator is not positioned on a symbol, so
|
|
1492
|
+
* {@link LookaheadIterator#currentType} returns `null` until the first
|
|
1493
|
+
* iteration step.
|
|
1451
1494
|
*
|
|
1452
1495
|
* Lookahead iterators can be useful for generating suggestions and improving
|
|
1453
1496
|
* syntax error diagnostics. To get symbols valid in an `ERROR` node, use the
|
|
@@ -1462,7 +1505,8 @@ var Language = class _Language {
|
|
|
1462
1505
|
}
|
|
1463
1506
|
/**
|
|
1464
1507
|
* Load a language from a WebAssembly module.
|
|
1465
|
-
* The module can be provided as a path to a file or as a
|
|
1508
|
+
* The module can be provided as a path to a file, a `URL` to a file, or as a
|
|
1509
|
+
* buffer.
|
|
1466
1510
|
*/
|
|
1467
1511
|
static async load(input) {
|
|
1468
1512
|
let binary2;
|
|
@@ -1489,16 +1533,27 @@ ${body2}`);
|
|
|
1489
1533
|
}
|
|
1490
1534
|
}
|
|
1491
1535
|
const mod = await C.loadWebAssemblyModule(binary2, { loadAsync: true });
|
|
1536
|
+
return _Language.loadFromWasmExports(mod, { sync: false });
|
|
1537
|
+
}
|
|
1538
|
+
static loadFromWasmExports(mod, { sync }) {
|
|
1492
1539
|
const symbolNames = Object.keys(mod);
|
|
1493
1540
|
const functionName = symbolNames.find((key) => LANGUAGE_FUNCTION_REGEX.test(key) && !key.includes("external_scanner_"));
|
|
1494
1541
|
if (!functionName) {
|
|
1495
1542
|
console.log(`Couldn't find language function in Wasm file. Symbols:
|
|
1496
1543
|
${JSON.stringify(symbolNames, null, 2)}`);
|
|
1497
|
-
throw new Error("
|
|
1544
|
+
throw new Error(`Language.${sync ? "loadSync" : "load"} failed: no language function found in Wasm file`);
|
|
1498
1545
|
}
|
|
1499
1546
|
const languageAddress = mod[functionName]();
|
|
1500
1547
|
return new _Language(INTERNAL, languageAddress);
|
|
1501
1548
|
}
|
|
1549
|
+
/**
|
|
1550
|
+
* Load a language synchronously from a pre-compiled WebAssembly module.
|
|
1551
|
+
* Use this when the host environment provides a `WebAssembly.Module` directly.
|
|
1552
|
+
*/
|
|
1553
|
+
static loadSync(wasmModule) {
|
|
1554
|
+
const mod = C.loadWebAssemblyModule(wasmModule, { loadAsync: false });
|
|
1555
|
+
return _Language.loadFromWasmExports(mod, { sync: true });
|
|
1556
|
+
}
|
|
1502
1557
|
};
|
|
1503
1558
|
async function Module2(moduleArg = {}) {
|
|
1504
1559
|
var moduleRtn;
|
|
@@ -2021,7 +2076,7 @@ async function Module2(moduleArg = {}) {
|
|
|
2021
2076
|
newDSO("__main__", 0, wasmImports);
|
|
2022
2077
|
}
|
|
2023
2078
|
};
|
|
2024
|
-
var ___heap_base =
|
|
2079
|
+
var ___heap_base = 82240;
|
|
2025
2080
|
var alignMemory = /* @__PURE__ */ __name((size, alignment) => Math.ceil(size / alignment) * alignment, "alignMemory");
|
|
2026
2081
|
var getMemory = /* @__PURE__ */ __name((size) => {
|
|
2027
2082
|
if (runtimeInitialized) {
|
|
@@ -2586,12 +2641,12 @@ async function Module2(moduleArg = {}) {
|
|
|
2586
2641
|
"value": "i32",
|
|
2587
2642
|
"mutable": false
|
|
2588
2643
|
}, 1024);
|
|
2589
|
-
var ___stack_high =
|
|
2590
|
-
var ___stack_low =
|
|
2644
|
+
var ___stack_high = 82240;
|
|
2645
|
+
var ___stack_low = 16704;
|
|
2591
2646
|
var ___stack_pointer = new WebAssembly.Global({
|
|
2592
2647
|
"value": "i32",
|
|
2593
2648
|
"mutable": true
|
|
2594
|
-
},
|
|
2649
|
+
}, 82240);
|
|
2595
2650
|
var ___table_base = new WebAssembly.Global({
|
|
2596
2651
|
"value": "i32",
|
|
2597
2652
|
"mutable": false
|
|
@@ -2852,7 +2907,7 @@ async function Module2(moduleArg = {}) {
|
|
|
2852
2907
|
Module["loadWebAssemblyModule"] = loadWebAssemblyModule;
|
|
2853
2908
|
Module["LE_HEAP_STORE_I64"] = LE_HEAP_STORE_I64;
|
|
2854
2909
|
var ASM_CONSTS = {};
|
|
2855
|
-
var _malloc, _calloc, _realloc, _free, _ts_range_edit, _memcmp, _ts_language_symbol_count, _ts_language_state_count, _ts_language_abi_version, _ts_language_name, _ts_language_field_count, _ts_language_next_state, _ts_language_symbol_name, _ts_language_symbol_for_name, _strncmp, _ts_language_symbol_type, _ts_language_field_name_for_id, _ts_lookahead_iterator_new, _ts_lookahead_iterator_delete, _ts_lookahead_iterator_reset_state, _ts_lookahead_iterator_reset, _ts_lookahead_iterator_next, _ts_lookahead_iterator_current_symbol, _ts_point_edit, _ts_parser_delete, _ts_parser_reset, _ts_parser_set_language, _ts_parser_set_included_ranges, _ts_query_new, _ts_query_delete, _iswspace, _iswalnum, _ts_query_pattern_count, _ts_query_capture_count, _ts_query_string_count, _ts_query_capture_name_for_id, _ts_query_capture_quantifier_for_id, _ts_query_string_value_for_id, _ts_query_predicates_for_pattern, _ts_query_start_byte_for_pattern, _ts_query_end_byte_for_pattern, _ts_query_is_pattern_rooted, _ts_query_is_pattern_non_local, _ts_query_is_pattern_guaranteed_at_step, _ts_query_disable_capture, _ts_query_disable_pattern, _ts_tree_copy, _ts_tree_delete, _ts_init, _ts_parser_new_wasm, _ts_parser_enable_logger_wasm, _ts_parser_parse_wasm, _ts_parser_included_ranges_wasm, _ts_language_type_is_named_wasm, _ts_language_type_is_visible_wasm, _ts_language_metadata_wasm, _ts_language_supertypes_wasm, _ts_language_subtypes_wasm, _ts_tree_root_node_wasm, _ts_tree_root_node_with_offset_wasm, _ts_tree_edit_wasm, _ts_tree_included_ranges_wasm, _ts_tree_get_changed_ranges_wasm, _ts_tree_cursor_new_wasm, _ts_tree_cursor_copy_wasm, _ts_tree_cursor_delete_wasm, _ts_tree_cursor_reset_wasm, _ts_tree_cursor_reset_to_wasm, _ts_tree_cursor_goto_first_child_wasm, _ts_tree_cursor_goto_last_child_wasm, _ts_tree_cursor_goto_first_child_for_index_wasm, _ts_tree_cursor_goto_first_child_for_position_wasm, _ts_tree_cursor_goto_next_sibling_wasm, _ts_tree_cursor_goto_previous_sibling_wasm, _ts_tree_cursor_goto_descendant_wasm, _ts_tree_cursor_goto_parent_wasm, _ts_tree_cursor_current_node_type_id_wasm, _ts_tree_cursor_current_node_state_id_wasm, _ts_tree_cursor_current_node_is_named_wasm, _ts_tree_cursor_current_node_is_missing_wasm, _ts_tree_cursor_current_node_id_wasm, _ts_tree_cursor_start_position_wasm, _ts_tree_cursor_end_position_wasm, _ts_tree_cursor_start_index_wasm, _ts_tree_cursor_end_index_wasm, _ts_tree_cursor_current_field_id_wasm, _ts_tree_cursor_current_depth_wasm, _ts_tree_cursor_current_descendant_index_wasm, _ts_tree_cursor_current_node_wasm, _ts_node_symbol_wasm, _ts_node_field_name_for_child_wasm, _ts_node_field_name_for_named_child_wasm, _ts_node_children_by_field_id_wasm, _ts_node_first_child_for_byte_wasm, _ts_node_first_named_child_for_byte_wasm, _ts_node_grammar_symbol_wasm, _ts_node_child_count_wasm, _ts_node_named_child_count_wasm, _ts_node_child_wasm, _ts_node_named_child_wasm, _ts_node_child_by_field_id_wasm, _ts_node_next_sibling_wasm, _ts_node_prev_sibling_wasm, _ts_node_next_named_sibling_wasm, _ts_node_prev_named_sibling_wasm, _ts_node_descendant_count_wasm, _ts_node_parent_wasm, _ts_node_child_with_descendant_wasm, _ts_node_descendant_for_index_wasm, _ts_node_named_descendant_for_index_wasm, _ts_node_descendant_for_position_wasm, _ts_node_named_descendant_for_position_wasm, _ts_node_start_point_wasm, _ts_node_end_point_wasm, _ts_node_start_index_wasm, _ts_node_end_index_wasm, _ts_node_to_string_wasm, _ts_node_children_wasm, _ts_node_named_children_wasm, _ts_node_descendants_of_type_wasm, _ts_node_is_named_wasm, _ts_node_has_changes_wasm, _ts_node_has_error_wasm, _ts_node_is_error_wasm, _ts_node_is_missing_wasm, _ts_node_is_extra_wasm, _ts_node_parse_state_wasm, _ts_node_next_parse_state_wasm, _ts_query_matches_wasm, _ts_query_captures_wasm, _memset, _memcpy, _memmove, _iswalpha, _iswblank, _iswdigit, _iswlower, _iswupper, _iswxdigit, _memchr, _strlen, _strcmp, _strncat, _strncpy, _towlower, _towupper, _setThrew, __emscripten_stack_restore, __emscripten_stack_alloc, _emscripten_stack_get_current, ___wasm_apply_data_relocs;
|
|
2910
|
+
var _malloc, _calloc, _realloc, _free, _ts_range_edit, _memcmp, _ts_language_symbol_count, _ts_language_state_count, _ts_language_abi_version, _ts_language_name, _ts_language_field_count, _ts_language_next_state, _ts_language_symbol_name, _ts_language_symbol_for_name, _strncmp, _ts_language_symbol_type, _ts_language_field_name_for_id, _ts_lookahead_iterator_new, _ts_lookahead_iterator_delete, _ts_lookahead_iterator_reset_state, _ts_lookahead_iterator_reset, _ts_lookahead_iterator_next, _ts_lookahead_iterator_current_symbol, _ts_point_edit, _ts_parser_delete, _ts_parser_reset, _ts_parser_set_language, _ts_parser_set_included_ranges, _ts_query_new, _ts_query_delete, _iswspace, _iswalnum, _ts_query_copy, _ts_query_pattern_count, _ts_query_capture_count, _ts_query_string_count, _ts_query_capture_name_for_id, _ts_query_capture_quantifier_for_id, _ts_query_string_value_for_id, _ts_query_predicates_for_pattern, _ts_query_start_byte_for_pattern, _ts_query_end_byte_for_pattern, _ts_query_is_pattern_rooted, _ts_query_is_pattern_non_local, _ts_query_is_pattern_guaranteed_at_step, _ts_query_disable_capture, _ts_query_disable_pattern, _ts_tree_copy, _ts_tree_delete, _ts_init, _ts_parser_new_wasm, _ts_parser_enable_logger_wasm, _ts_parser_parse_wasm, _ts_parser_included_ranges_wasm, _ts_language_type_is_named_wasm, _ts_language_type_is_visible_wasm, _ts_language_metadata_wasm, _ts_language_supertypes_wasm, _ts_language_subtypes_wasm, _ts_tree_root_node_wasm, _ts_tree_root_node_with_offset_wasm, _ts_tree_edit_wasm, _ts_tree_included_ranges_wasm, _ts_tree_get_changed_ranges_wasm, _ts_tree_cursor_new_wasm, _ts_tree_cursor_copy_wasm, _ts_tree_cursor_delete_wasm, _ts_tree_cursor_reset_wasm, _ts_tree_cursor_reset_to_wasm, _ts_tree_cursor_goto_first_child_wasm, _ts_tree_cursor_goto_last_child_wasm, _ts_tree_cursor_goto_first_child_for_index_wasm, _ts_tree_cursor_goto_first_child_for_position_wasm, _ts_tree_cursor_goto_next_sibling_wasm, _ts_tree_cursor_goto_previous_sibling_wasm, _ts_tree_cursor_goto_descendant_wasm, _ts_tree_cursor_goto_parent_wasm, _ts_tree_cursor_current_node_type_id_wasm, _ts_tree_cursor_current_node_state_id_wasm, _ts_tree_cursor_current_node_is_named_wasm, _ts_tree_cursor_current_node_is_missing_wasm, _ts_tree_cursor_current_node_id_wasm, _ts_tree_cursor_start_position_wasm, _ts_tree_cursor_end_position_wasm, _ts_tree_cursor_start_index_wasm, _ts_tree_cursor_end_index_wasm, _ts_tree_cursor_current_field_id_wasm, _ts_tree_cursor_current_depth_wasm, _ts_tree_cursor_current_descendant_index_wasm, _ts_tree_cursor_current_node_wasm, _ts_node_symbol_wasm, _ts_node_field_name_for_child_wasm, _ts_node_field_name_for_named_child_wasm, _ts_node_children_by_field_id_wasm, _ts_node_first_child_for_byte_wasm, _ts_node_first_named_child_for_byte_wasm, _ts_node_grammar_symbol_wasm, _ts_node_child_count_wasm, _ts_node_named_child_count_wasm, _ts_node_child_wasm, _ts_node_named_child_wasm, _ts_node_child_by_field_id_wasm, _ts_node_next_sibling_wasm, _ts_node_prev_sibling_wasm, _ts_node_next_named_sibling_wasm, _ts_node_prev_named_sibling_wasm, _ts_node_descendant_count_wasm, _ts_node_parent_wasm, _ts_node_child_with_descendant_wasm, _ts_node_descendant_for_index_wasm, _ts_node_named_descendant_for_index_wasm, _ts_node_descendant_for_position_wasm, _ts_node_named_descendant_for_position_wasm, _ts_node_start_point_wasm, _ts_node_end_point_wasm, _ts_node_start_index_wasm, _ts_node_end_index_wasm, _ts_node_to_string_wasm, _ts_node_children_wasm, _ts_node_named_children_wasm, _ts_node_descendants_of_type_wasm, _ts_node_is_named_wasm, _ts_node_has_changes_wasm, _ts_node_has_error_wasm, _ts_node_is_error_wasm, _ts_node_is_missing_wasm, _ts_node_is_extra_wasm, _ts_node_parse_state_wasm, _ts_node_next_parse_state_wasm, _ts_query_matches_wasm, _ts_query_captures_wasm, _memset, _memcpy, _memmove, _iswalpha, _iswblank, _iswdigit, _iswlower, _iswpunct, _iswupper, _iswxdigit, _memchr, _strlen, _strcmp, _strncat, _strncpy, _towlower, _towupper, _setThrew, __emscripten_stack_restore, __emscripten_stack_alloc, _emscripten_stack_get_current, ___wasm_apply_data_relocs;
|
|
2856
2911
|
function assignWasmExports(wasmExports2) {
|
|
2857
2912
|
Module["_malloc"] = _malloc = wasmExports2["malloc"];
|
|
2858
2913
|
Module["_calloc"] = _calloc = wasmExports2["calloc"];
|
|
@@ -2886,6 +2941,7 @@ async function Module2(moduleArg = {}) {
|
|
|
2886
2941
|
Module["_ts_query_delete"] = _ts_query_delete = wasmExports2["ts_query_delete"];
|
|
2887
2942
|
Module["_iswspace"] = _iswspace = wasmExports2["iswspace"];
|
|
2888
2943
|
Module["_iswalnum"] = _iswalnum = wasmExports2["iswalnum"];
|
|
2944
|
+
Module["_ts_query_copy"] = _ts_query_copy = wasmExports2["ts_query_copy"];
|
|
2889
2945
|
Module["_ts_query_pattern_count"] = _ts_query_pattern_count = wasmExports2["ts_query_pattern_count"];
|
|
2890
2946
|
Module["_ts_query_capture_count"] = _ts_query_capture_count = wasmExports2["ts_query_capture_count"];
|
|
2891
2947
|
Module["_ts_query_string_count"] = _ts_query_string_count = wasmExports2["ts_query_string_count"];
|
|
@@ -2991,6 +3047,7 @@ async function Module2(moduleArg = {}) {
|
|
|
2991
3047
|
Module["_iswblank"] = _iswblank = wasmExports2["iswblank"];
|
|
2992
3048
|
Module["_iswdigit"] = _iswdigit = wasmExports2["iswdigit"];
|
|
2993
3049
|
Module["_iswlower"] = _iswlower = wasmExports2["iswlower"];
|
|
3050
|
+
Module["_iswpunct"] = _iswpunct = wasmExports2["iswpunct"];
|
|
2994
3051
|
Module["_iswupper"] = _iswupper = wasmExports2["iswupper"];
|
|
2995
3052
|
Module["_iswxdigit"] = _iswxdigit = wasmExports2["iswxdigit"];
|
|
2996
3053
|
Module["_memchr"] = _memchr = wasmExports2["memchr"];
|
|
@@ -3128,6 +3185,10 @@ __name(checkModule, "checkModule");
|
|
|
3128
3185
|
var TRANSFER_BUFFER;
|
|
3129
3186
|
var LANGUAGE_VERSION;
|
|
3130
3187
|
var MIN_COMPATIBLE_VERSION;
|
|
3188
|
+
var finalizer4 = newFinalizer((addresses) => {
|
|
3189
|
+
C._ts_parser_delete(addresses[0]);
|
|
3190
|
+
C._free(addresses[1]);
|
|
3191
|
+
});
|
|
3131
3192
|
var Parser = class {
|
|
3132
3193
|
static {
|
|
3133
3194
|
__name(this, "Parser");
|
|
@@ -3159,6 +3220,7 @@ var Parser = class {
|
|
|
3159
3220
|
*/
|
|
3160
3221
|
constructor() {
|
|
3161
3222
|
this.initialize();
|
|
3223
|
+
finalizer4?.register(this, [this[0], this[1]], this);
|
|
3162
3224
|
}
|
|
3163
3225
|
/** @internal */
|
|
3164
3226
|
initialize() {
|
|
@@ -3171,6 +3233,7 @@ var Parser = class {
|
|
|
3171
3233
|
}
|
|
3172
3234
|
/** Delete the parser, freeing its resources. */
|
|
3173
3235
|
delete() {
|
|
3236
|
+
finalizer4?.unregister(this);
|
|
3174
3237
|
C._ts_parser_delete(this[0]);
|
|
3175
3238
|
C._free(this[1]);
|
|
3176
3239
|
this[0] = 0;
|
|
@@ -3346,6 +3409,10 @@ var QueryError = class _QueryError extends Error {
|
|
|
3346
3409
|
this.length = length;
|
|
3347
3410
|
this.name = "QueryError";
|
|
3348
3411
|
}
|
|
3412
|
+
kind;
|
|
3413
|
+
info;
|
|
3414
|
+
index;
|
|
3415
|
+
length;
|
|
3349
3416
|
static {
|
|
3350
3417
|
__name(this, "QueryError");
|
|
3351
3418
|
}
|
|
@@ -3541,6 +3608,9 @@ function parsePattern(index, stepType, stepValueId, captureNames, stringValues,
|
|
|
3541
3608
|
}
|
|
3542
3609
|
}
|
|
3543
3610
|
__name(parsePattern, "parsePattern");
|
|
3611
|
+
var finalizer5 = newFinalizer((address) => {
|
|
3612
|
+
C._ts_query_delete(address);
|
|
3613
|
+
});
|
|
3544
3614
|
var Query = class {
|
|
3545
3615
|
static {
|
|
3546
3616
|
__name(this, "Query");
|
|
@@ -3695,9 +3765,11 @@ var Query = class {
|
|
|
3695
3765
|
this.assertedProperties = assertedProperties;
|
|
3696
3766
|
this.refutedProperties = refutedProperties;
|
|
3697
3767
|
this.exceededMatchLimit = false;
|
|
3768
|
+
finalizer5?.register(this, address, this);
|
|
3698
3769
|
}
|
|
3699
3770
|
/** Delete the query, freeing its resources. */
|
|
3700
3771
|
delete() {
|
|
3772
|
+
finalizer5?.unregister(this);
|
|
3701
3773
|
C._ts_query_delete(this[0]);
|
|
3702
3774
|
this[0] = 0;
|
|
3703
3775
|
}
|
|
@@ -9153,7 +9225,7 @@ function buildBashCFG(tree, startId, cache) {
|
|
|
9153
9225
|
allEdges.push({ from: entryBlock.id, to: firstBlockId, type: "sequential" });
|
|
9154
9226
|
}
|
|
9155
9227
|
const exitBlock = {
|
|
9156
|
-
id: blockIdCounter
|
|
9228
|
+
id: blockIdCounter,
|
|
9157
9229
|
type: "exit",
|
|
9158
9230
|
start_line: topLevelStatements[topLevelStatements.length - 1].endPosition.row + 1,
|
|
9159
9231
|
end_line: topLevelStatements[topLevelStatements.length - 1].endPosition.row + 1
|
|
@@ -9271,7 +9343,7 @@ function buildGoCFG(tree, blockIdCounter, cache) {
|
|
|
9271
9343
|
);
|
|
9272
9344
|
if (hasTopLevelDecls) {
|
|
9273
9345
|
const block = {
|
|
9274
|
-
id: blockIdCounter
|
|
9346
|
+
id: blockIdCounter,
|
|
9275
9347
|
type: "normal",
|
|
9276
9348
|
start_line: 1,
|
|
9277
9349
|
end_line: tree.rootNode.endPosition.row + 1
|
|
@@ -10290,7 +10362,7 @@ function buildRustDFG(tree, cache) {
|
|
|
10290
10362
|
const defs = [];
|
|
10291
10363
|
const uses = [];
|
|
10292
10364
|
let defIdCounter = 1;
|
|
10293
|
-
|
|
10365
|
+
const useIdCounter = 1;
|
|
10294
10366
|
const scopeStack = [/* @__PURE__ */ new Map()];
|
|
10295
10367
|
const functions = findNodes(tree.rootNode, "function_item");
|
|
10296
10368
|
for (const func2 of functions) {
|
|
@@ -11169,7 +11241,7 @@ function parsePythonDecorator(dec) {
|
|
|
11169
11241
|
const fnNode = target.childForFieldName("function");
|
|
11170
11242
|
if (!fnNode) return null;
|
|
11171
11243
|
let receiver = "";
|
|
11172
|
-
let method
|
|
11244
|
+
let method;
|
|
11173
11245
|
if (fnNode.type === "identifier") {
|
|
11174
11246
|
method = getNodeText(fnNode);
|
|
11175
11247
|
} else if (fnNode.type === "attribute") {
|
|
@@ -11235,7 +11307,7 @@ function classifyPythonDecorator(receiver, method, imp) {
|
|
|
11235
11307
|
if (receiver && PY_HTTP_ROUTE_METHODS.has(method)) {
|
|
11236
11308
|
const isRoutey = isPyRouterReceiver(receiver);
|
|
11237
11309
|
if (isRoutey) {
|
|
11238
|
-
let framework
|
|
11310
|
+
let framework;
|
|
11239
11311
|
if (imp.hasFlask) framework = "flask";
|
|
11240
11312
|
else if (imp.hasFastApi) framework = "fastapi";
|
|
11241
11313
|
else if (method === "route") framework = "flask";
|
|
@@ -11652,12 +11724,56 @@ var DEFAULT_SOURCES = [
|
|
|
11652
11724
|
{ method: "getIn", class: "Exchange", type: "http_body", severity: "high", return_tainted: true },
|
|
11653
11725
|
{ method: "getHeader", class: "Message", type: "http_header", severity: "high", return_tainted: true },
|
|
11654
11726
|
// File name sources (common in path traversal vulnerabilities)
|
|
11655
|
-
|
|
11656
|
-
|
|
11657
|
-
|
|
11658
|
-
|
|
11659
|
-
|
|
11660
|
-
|
|
11727
|
+
//
|
|
11728
|
+
// cognium-dev#387 — the CLASSLESS `getFileName` was removed with the path
|
|
11729
|
+
// projections below. It had no class and no `languages` scope, so it matched
|
|
11730
|
+
// every `.getFileName()` anywhere, and it kept `Paths.get("/etc/app.conf")
|
|
11731
|
+
// .getFileName()` reporting path_traversal after the class-scoped
|
|
11732
|
+
// `Path.getFileName` was dropped — i.e. it silently defeated that removal,
|
|
11733
|
+
// the same way the classless `getPath` defeated the first revision of this
|
|
11734
|
+
// change. Measured redundant for the sources that matter: with it removed,
|
|
11735
|
+
// `Part.getFileName`, `BodyPart`/`MimeBodyPart.getFileName` and
|
|
11736
|
+
// `MultipartFile.getOriginalFilename` all still bind their sources from
|
|
11737
|
+
// their own class-scoped entries below.
|
|
11738
|
+
// cognium-dev#387 — REMOVED as taint sources: `File.getName`,
|
|
11739
|
+
// `File.getPath`, `File.getAbsolutePath`, `Path.toString`,
|
|
11740
|
+
// `Path.getFileName`, and the classless `getPath` further down this file.
|
|
11741
|
+
//
|
|
11742
|
+
// All of these are pure path PROJECTIONS: they hand back some part of the
|
|
11743
|
+
// path the object already holds. They cannot introduce taint that is not
|
|
11744
|
+
// already present — if the File/Path was built from untrusted input,
|
|
11745
|
+
// propagation carries it — but as blanket sources they turned every
|
|
11746
|
+
// program-constructed path into a high-severity source, and the enclosing
|
|
11747
|
+
// call is usually itself a sink, so source and sink land on the same line.
|
|
11748
|
+
// Each of these was a measured false positive with NO untrusted input
|
|
11749
|
+
// anywhere in the file:
|
|
11750
|
+
//
|
|
11751
|
+
// File f = new File("/etc/app.conf");
|
|
11752
|
+
// new FileInputStream(f.getAbsolutePath()); // path_traversal
|
|
11753
|
+
// new FileInputStream(f.getPath()); // path_traversal
|
|
11754
|
+
// new FileInputStream("/d/" + f.getName()); // path_traversal
|
|
11755
|
+
// Paths.get("/etc/app.conf").getFileName(); // path_traversal
|
|
11756
|
+
//
|
|
11757
|
+
// and conversely, with a genuinely tainted path the finding does NOT depend
|
|
11758
|
+
// on the projection being a source: it comes from the http source and
|
|
11759
|
+
// survives. Verified across six shapes — same-method, inline with no
|
|
11760
|
+
// intermediate variable, `getPath`, `Paths.get(p).toString()`, a File passed
|
|
11761
|
+
// cross-method as a parameter, and a field-held File read in another method.
|
|
11762
|
+
//
|
|
11763
|
+
// The genuinely untrusted name sources are separately class-scoped and
|
|
11764
|
+
// unaffected: `ZipEntry`/`TarArchiveEntry.getName` (Zip/Tar Slip),
|
|
11765
|
+
// `MultipartFile.getOriginalFilename`/`getName`, `Part`, `BodyPart`.
|
|
11766
|
+
// Measured: those still bind their sources with these removed.
|
|
11767
|
+
//
|
|
11768
|
+
// NO `listFiles` COVERAGE IS LOST — an earlier revision of this change
|
|
11769
|
+
// claimed there was. Measured directly, before vs after, for a File taken
|
|
11770
|
+
// from `dir.listFiles()`: `getName` 0 flows -> 0 flows, `getAbsolutePath`
|
|
11771
|
+
// 0 -> 0, `getPath` 1 -> 1. The first two never fired in that shape at all,
|
|
11772
|
+
// because class resolution does not resolve a for-each variable to `File`.
|
|
11773
|
+
// Modelling `listFiles` / `Files.list` / `Files.walk` as sources is still
|
|
11774
|
+
// worth doing — the directory listing IS external data — but it is additive,
|
|
11775
|
+
// needs its own FP measurement, and is not a regression from this change.
|
|
11776
|
+
// Tracked on #387.
|
|
11661
11777
|
// Multipart file uploads
|
|
11662
11778
|
{ method: "getOriginalFilename", class: "MultipartFile", type: "file_input", severity: "high", return_tainted: true },
|
|
11663
11779
|
{ method: "getName", class: "MultipartFile", type: "file_input", severity: "high", return_tainted: true },
|
|
@@ -11749,7 +11865,12 @@ var DEFAULT_SOURCES = [
|
|
|
11749
11865
|
// Jenkins/CI pipeline sources
|
|
11750
11866
|
{ method: "getScriptPath", type: "io_input", severity: "critical", return_tainted: true },
|
|
11751
11867
|
{ method: "getFilePathSuffix", type: "io_input", severity: "high", return_tainted: true },
|
|
11752
|
-
|
|
11868
|
+
// cognium-dev#387 — the classless `getPath` was REMOVED here too. The first
|
|
11869
|
+
// revision of this change dropped only the class-scoped `File.getPath` and
|
|
11870
|
+
// left this one, so `f.getPath()` kept emitting a `file_input` source and the
|
|
11871
|
+
// self-flow false positive survived — the change did not do what it claimed.
|
|
11872
|
+
// This entry is strictly broader than the one it shadowed: no class and no
|
|
11873
|
+
// `languages` scope, so it matched every `.getPath()` in every language.
|
|
11753
11874
|
{ method: "contentAsString", type: "file_input", severity: "critical", return_tainted: true },
|
|
11754
11875
|
{ method: "readAsString", type: "file_input", severity: "critical", return_tainted: true },
|
|
11755
11876
|
{ method: "content", type: "file_input", severity: "high", return_tainted: true },
|
|
@@ -21519,7 +21640,7 @@ var ConstantPropagator = class _ConstantPropagator {
|
|
|
21519
21640
|
}
|
|
21520
21641
|
}
|
|
21521
21642
|
const startIdx = matchingIdx >= 0 ? matchingIdx : defaultIdx;
|
|
21522
|
-
for (let i2 = 0; i2 < startIdx
|
|
21643
|
+
for (let i2 = 0; i2 < startIdx; i2++) {
|
|
21523
21644
|
this.markUnreachable(caseGroups[i2]);
|
|
21524
21645
|
}
|
|
21525
21646
|
if (startIdx >= 0) {
|
|
@@ -29476,16 +29597,12 @@ function findPythonRegexAllowlistWrapperSanitizers(code) {
|
|
|
29476
29597
|
const argName = m[3];
|
|
29477
29598
|
let foundGuard = false;
|
|
29478
29599
|
let returnsArg = false;
|
|
29479
|
-
let blockEnd = -1;
|
|
29480
29600
|
const maxScan = Math.min(lines.length, i2 + 40);
|
|
29481
29601
|
for (let j = i2 + 1; j < maxScan; j++) {
|
|
29482
29602
|
const line = lines[j];
|
|
29483
29603
|
if (line.trim() === "") continue;
|
|
29484
29604
|
const indent = line.length - line.trimStart().length;
|
|
29485
|
-
if (indent <= defIndent)
|
|
29486
|
-
blockEnd = j - 1;
|
|
29487
|
-
break;
|
|
29488
|
-
}
|
|
29605
|
+
if (indent <= defIndent) break;
|
|
29489
29606
|
if (!foundGuard) {
|
|
29490
29607
|
const guard = new RegExp(
|
|
29491
29608
|
`if\\s+not\\s+re\\.(?:fullmatch|match)\\s*\\(\\s*(${tightRegex.source})\\s*,\\s*${argName}\\s*\\)\\s*:`
|
|
@@ -29505,7 +29622,6 @@ function findPythonRegexAllowlistWrapperSanitizers(code) {
|
|
|
29505
29622
|
returnsArg = true;
|
|
29506
29623
|
}
|
|
29507
29624
|
}
|
|
29508
|
-
if (blockEnd === -1) blockEnd = Math.min(lines.length - 1, i2 + 39);
|
|
29509
29625
|
if (!foundGuard || !returnsArg) continue;
|
|
29510
29626
|
wrappers.push({ name: wrapperName, defLine: i2, defIndent });
|
|
29511
29627
|
}
|
|
@@ -32222,7 +32338,7 @@ function findRustEvalCrateCodeInjectionFindings(code, file) {
|
|
|
32222
32338
|
}
|
|
32223
32339
|
if (arg === null) continue;
|
|
32224
32340
|
if (arg.length === 0) continue;
|
|
32225
|
-
|
|
32341
|
+
const unwrapped = arg.replace(/^&\s*/, "").trim();
|
|
32226
32342
|
if (/^"[^"]*"$/.test(unwrapped)) continue;
|
|
32227
32343
|
let tainted = false;
|
|
32228
32344
|
for (const v of fn.tainted) {
|
|
@@ -32835,7 +32951,7 @@ function findJsLdapInjectionFindings(code, file) {
|
|
|
32835
32951
|
for (let i2 = 0; i2 < lines.length; i2++) {
|
|
32836
32952
|
const line = lines[i2];
|
|
32837
32953
|
const fm = line.match(filterPropRe);
|
|
32838
|
-
let expr
|
|
32954
|
+
let expr;
|
|
32839
32955
|
if (fm) {
|
|
32840
32956
|
expr = fm[1].trim();
|
|
32841
32957
|
} else if (filterShorthandRe.test(line)) {
|
|
@@ -35296,7 +35412,7 @@ var SinkFilterPass = class {
|
|
|
35296
35412
|
if (/^-?\d+$/.test(t) || /^"(?:[^"\\]|\\.)*"$/.test(t) || /^'(?:[^'\\]|\\.)*'$/.test(t)) {
|
|
35297
35413
|
continue;
|
|
35298
35414
|
}
|
|
35299
|
-
let helperName
|
|
35415
|
+
let helperName;
|
|
35300
35416
|
const directCall = t.match(/^([A-Za-z_]\w*)\s*\(/);
|
|
35301
35417
|
if (directCall) {
|
|
35302
35418
|
helperName = directCall[1] ?? null;
|
|
@@ -40582,7 +40698,7 @@ function buildSourceCoveredRanges(codeLines, language) {
|
|
|
40582
40698
|
function buildJsCoveredRanges(codeLines) {
|
|
40583
40699
|
const ranges = [];
|
|
40584
40700
|
const tryStack = [];
|
|
40585
|
-
|
|
40701
|
+
const braceDepthAtTry = [];
|
|
40586
40702
|
let braceDepth = 0;
|
|
40587
40703
|
for (let i2 = 0; i2 < codeLines.length; i2++) {
|
|
40588
40704
|
const line = codeLines[i2];
|
|
@@ -40654,12 +40770,6 @@ var UnhandledExceptionPass = class {
|
|
|
40654
40770
|
coveredRanges.push(range);
|
|
40655
40771
|
}
|
|
40656
40772
|
}
|
|
40657
|
-
const catchStarts = new Set(
|
|
40658
|
-
exGraph.pairs.map((p) => p.catchBlock.start_line)
|
|
40659
|
-
);
|
|
40660
|
-
for (const range of coveredRanges) {
|
|
40661
|
-
catchStarts.add(range.end + 1);
|
|
40662
|
-
}
|
|
40663
40773
|
const throwRe = language === "python" ? PYTHON_RAISE_RE : JS_THROW_RE;
|
|
40664
40774
|
const unhandled = [];
|
|
40665
40775
|
const reportedMethods = /* @__PURE__ */ new Set();
|
|
@@ -40667,13 +40777,6 @@ var UnhandledExceptionPass = class {
|
|
|
40667
40777
|
const lineText = codeLines[ln - 1] ?? "";
|
|
40668
40778
|
if (!throwRe.test(lineText)) continue;
|
|
40669
40779
|
let inCatch = false;
|
|
40670
|
-
for (const cs of catchStarts) {
|
|
40671
|
-
if (ln >= cs) {
|
|
40672
|
-
inCatch = true;
|
|
40673
|
-
break;
|
|
40674
|
-
}
|
|
40675
|
-
}
|
|
40676
|
-
inCatch = false;
|
|
40677
40780
|
for (const pair of exGraph.pairs) {
|
|
40678
40781
|
if (ln >= pair.catchBlock.start_line) {
|
|
40679
40782
|
const mThrow = graph.methodAtLine(ln);
|
package/dist/browser.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,YAAY,EACZ,OAAO,EACP,aAAa,EACb,qBAAqB,GAEtB,MAAM,eAAe,CAAC;AAkBvB;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,OAA+B;IACxD,MAAM,WAAW,GAAuC;QACtD,WAAW,EAAE,OAAO,CAAC,WAAW;KACjC,CAAC;IAEF,IAAI,OAAO,OAAO,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;QACxC,WAAW,CAAC,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC;IACzC,CAAC;SAAM,CAAC;QACN,WAAW,CAAC,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC;IAC3C,CAAC;IAED,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;QACzB,MAAM,KAAK,GAA+C,EAAE,CAAC;QAC7D,MAAM,OAAO,GAA2D,EAAE,CAAC;QAE3E,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;YACjE,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;gBAC9B,KAAK,CAAC,IAAyB,CAAC,GAAG,KAAK,CAAC;YAC3C,CAAC;iBAAM,IAAI,KAAK,EAAE,CAAC;gBACjB,OAAO,CAAC,IAAyB,CAAC,GAAG,KAAK,CAAC;YAC7C,CAAC;QACH,CAAC;QAED,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC;YAAE,WAAW,CAAC,aAAa,GAAG,KAAK,CAAC;QACrE,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC;YAAE,WAAW,CAAC,eAAe,GAAG,OAAO,CAAC;IAC7E,CAAC;IAED,MAAM,YAAY,CAAC,WAAW,CAAC,CAAC;AAClC,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,IAAY,EACZ,
|
|
1
|
+
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,YAAY,EACZ,OAAO,EACP,aAAa,EACb,qBAAqB,GAEtB,MAAM,eAAe,CAAC;AAkBvB;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,OAA+B;IACxD,MAAM,WAAW,GAAuC;QACtD,WAAW,EAAE,OAAO,CAAC,WAAW;KACjC,CAAC;IAEF,IAAI,OAAO,OAAO,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;QACxC,WAAW,CAAC,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC;IACzC,CAAC;SAAM,CAAC;QACN,WAAW,CAAC,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC;IAC3C,CAAC;IAED,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;QACzB,MAAM,KAAK,GAA+C,EAAE,CAAC;QAC7D,MAAM,OAAO,GAA2D,EAAE,CAAC;QAE3E,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;YACjE,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;gBAC9B,KAAK,CAAC,IAAyB,CAAC,GAAG,KAAK,CAAC;YAC3C,CAAC;iBAAM,IAAI,KAAK,EAAE,CAAC;gBACjB,OAAO,CAAC,IAAyB,CAAC,GAAG,KAAK,CAAC;YAC7C,CAAC;QACH,CAAC;QAED,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC;YAAE,WAAW,CAAC,aAAa,GAAG,KAAK,CAAC;QACrE,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC;YAAE,WAAW,CAAC,eAAe,GAAG,OAAO,CAAC;IAC7E,CAAC;IAED,MAAM,YAAY,CAAC,WAAW,CAAC,CAAC;AAClC,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,IAAY,EACZ,OAAO,GAGH,EAAE;IAEN,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,YAAY,CAAC;IAClD,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,MAAM,CAAC;IAE5C,IAAI,CAAC,qBAAqB,EAAE,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;IAClE,CAAC;IAED,OAAO,OAAO,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAC3C,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,IAAY,EACZ,OAAO,GAGH,EAAE;IAEN,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,YAAY,CAAC;IAClD,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,MAAM,CAAC;IAE5C,IAAI,CAAC,qBAAqB,EAAE,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;IAClE,CAAC;IAED,OAAO,aAAa,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;AACjD,CAAC"}
|