TS7 binary AST uses bit 6 for ExportContext (set on all nodes inside
`declare module` contexts), not GlobalAugmentation as previously assumed.
GlobalAugmentation is not a flag in the TS7 binary format at all.
Fix by using a synthetic flag bit (1<<30) for GlobalAugmentation that the
converter sets on `declare global {}` nodes based on the name identifier
being "global". This lets the Java extractor correctly distinguish
`declare global {}` from regular namespace declarations.
Also corrects the flag shift: ExportContext=64 (bit 6), ContainsThis=128
(bit 7), etc., matching the actual TS7 binary layout.
TRAP test results: 494/495 passing (99.8%)
Remaining: badimport.ts (TS7 binary API doesn't report parse diagnostics)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
JavaScript extractor
This directory contains the source code of the JavaScript extractor. The extractor depends on various libraries that are not currently bundled with the source code, so at present it cannot be built in isolation.
The extractor consists of a parser for the latest version of ECMAScript, including a few proposed and historic extensions (see src/com/semmle/jcorn), classes for representing JavaScript and TypeScript ASTs (src/com/semmle/js/ast and src/com/semmle/ts/ast), and various other bits of functionality. Historically, the main entry point of the JavaScript extractor has been com.semmle.js.extractor.Main. However, this class is slowly being phased out in favour of com.semmle.js.extractor.AutoBuild, which is the entry point used by CodeQL.
License
Like the CodeQL queries, the JavaScript extractor is licensed under the MIT License by GitHub. Some code is derived from other projects, whose licenses are noted in other LICENSE-*.md files in this folder.