Skip to content

Global scoped try/catch emits compilation error #537

@Ferossgp

Description

@Ferossgp

I've been trying to compile an app bundle generated by Closure Compiler.

Compiling the bundle with the Hermes compiler:

hermesc -O -emit-binary -out ./test.hbc /test.js

emits the following error:

index.js:1:1: error: Too deeply nested try/catch

Hermes versions tested with:

LLVM (http://llvm.org/):
  LLVH version 8.0.0svn
  Optimized build

Hermes JavaScript compiler.
  Hermes release version: 0.7.2
  HBC bytecode version: 76

  Features:
    Debugger
    Zip file input
---------------------------------
LLVM (http://llvm.org/):
  LLVH version 8.0.0svn
  Optimized build

Hermes JavaScript compiler.
  Hermes release version: 0.8.0
  HBC bytecode version: 83

  Features:
    Debugger
    Zip file input

By inspecting the JS code I found that the reason is the presence of a try/catch in the global scope. The try/catch does not have any recursion and deep function traces inside its scope. Removing it solves the error.

Adding this try {} catch (a) {} at the end of file, also causes the error.

Seems like there is something else in the bundle that in combination with a global try/catch causes the error.

In a simple test project, the error is not reproducible. I want to create a repro thus I would like to know some hints for the direction to dig in.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions