Skip to content

Lexical scoping is not supported  #22

Description

@jiachen247

Hi can I check if this is intended?

Lexical scoping is a big part of Ecmascript / JS / TS

For example,

{
    const x = 1;
    function a() : number {
        return x + 1;
    }

    console_log(a());
}

compiles to invalid llvm ir

; ModuleID = 'test'
source_filename = "test"

define i64 @main() {
entry:
  %x = alloca double
  store double 1.000000e+00, double* %x
  %0 = call double @a()
  call void @_Z11console_logd(double %0)
  ret i64 0
}

define double @a() {
Entry:
  %0 = load double, double* %x
  %1 = fadd double %0, 1.000000e+00
  ret double %1
}

declare void @_Z11console_logd(double)

Activity

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions