GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — findFirstNodeAbove should check original node · Issue #1622 · TypeScriptToLua/TypeScriptToLua

findFirstNodeAbove should check original node #1622

New issue
Copy link
New issue
Copy link
Closed
#1711
Closed
findFirstNodeAbove should check original node#1622
#1711
Copy link
Labels
bug

Description

@pilaoda
pilaoda
opened on Mar 3, 2025
Issue body actions

TypeScriptToLua/src/transformation/utils/typescript/index.ts

Lines 16 to 25 in 6fb39b6

export function findFirstNodeAbove<T extends ts.Node>(node: ts.Node, callback: (n: ts.Node) => n is T): T | undefined {
let current = node;
while (current.parent) {
if (callback(current.parent)) {
return current.parent;
} else {
current = current.parent;
}
}
}

current may be a Synthesized node and has no parent attribute. This cause isInAsyncFunction return false incorrectly.

a possible fix:

export function findFirstNodeAbove<T extends ts.Node>(node: ts.Node, callback: (n: ts.Node) => n is T): T | undefined {
    let current = ts.getOriginalNode(node);
    while (current.parent) {
        if (callback(current.parent)) {
            return current.parent;
        } else {
            current = ts.getOriginalNode(current.parent);
        }
    }
}
Reacted by Cold Fry

Activity

  1. Perryvw
    added
    bug
    on May 24, 2025
  2. RealColdFry commented on Apr 16, 2026

    @RealColdFry
    RealColdFry
    on Apr 16, 2026
    Contributor
    More actions

    looking for more synth node leaks...

  3. Perryvw
    closed this as completedin #1711on Apr 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402520 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.