FuckItJS相当于Ruby

时间:2012-07-06 01:01:48

标签: ruby metaprogramming rubinius

  

FuckItJS

     

Javascript错误Steamroller

     

FuckItJS使用最先进的技术来确保您的JavaScript   无论编译器是否喜欢,代码都会运行。

     

技术

     

通过称为Eval-Rinse-Reload-And-Repeat,FuckItJS的过程   反复编译代码,检测错误并切片   脚本中的行。为了生存这样一个暴力的过程,FuckItJS   每次迭代后重新加载自己,允许onerror处理程序   在你编写的代码中捕获每一个错误。

我正在确定lib/my_file.rb中的哪些代码导致Rubinius出现以下错误:

$ ruby lib/my_file.rb 
An exception occurred running lib/my_file.rb
    Error trying to compile /path/to/lib/my_file.rb (Rubinius::CompileError)

Backtrace:
 Rubinius::Compiler.compiler_error at /Users/agrimm/.rbenv/versions/rbx-1.2.4
                                      /lib/compiler/compiler.rbc:11
        Rubinius::Compiler.compile at /Users/agrimm/.rbenv/versions/rbx-1.2.4
                                      /lib/compiler/compiler.rbc:62
  Rubinius::CodeLoader#compile_file at kernel/delta/codeloader.rb:146
     Rubinius::CodeLoader#load_file at kernel/delta/codeloader.rb:118
   Rubinius::CodeLoader#load_script at kernel/delta/codeloader.rb:61
   Rubinius::CodeLoader.load_script at kernel/delta/codeloader.rb:90
            Rubinius::Loader#script at kernel/loader.rb:618
              Rubinius::Loader#main at kernel/loader.rb:762

Caused by: undefined method `body' on an instance of Rubinius::AST::SplatValue. (NoMethodError)

Backtrace:
  Kernel(Rubinius::AST::SplatValue)#body (method_missing) at kernel/delta/kernel.rb:79
  Rubinius::AST::OpAssign1#initialize at /Users/agrimm/.rbenv/versions/rbx-1.2.4
                                         /lib/compiler/ast/operators.rbc:136
 Rubinius::Melbourne#process_op_asgn1 at /Users/agrimm/.rbenv/versions/rbx-1.2.4
                                         /lib/melbourne/processor.rbc:332
      Rubinius::Melbourne#file_to_ast at /private/var/folders/3x
                                         /y_8y8vr53ws_kxj97km79q5h0000gn/T
                                         /ruby-build.20120706090940.39603
                                         /rubinius-1.2.4/lib/ext/melbourne
                                         /melbourne.cpp
       Rubinius::Melbourne#parse_file at /Users/agrimm/.rbenv/versions/rbx-1.2.4
                                         /lib/melbourne.rbc:83
 Rubinius::Compiler::FileParser#parse at /Users/agrimm/.rbenv/versions/rbx-1.2.4
                                         /lib/compiler/stages.rbc:219
  Rubinius::Compiler::Parser(Rubinius::Compiler::FileParser)#run at \
          /Users/agrimm/.rbenv/versions/rbx-1.2.4/lib/compiler/stages.rbc:202
               Rubinius::Compiler#run at /Users/agrimm/.rbenv/versions/rbx-1.2.4
                                         /lib/compiler/compiler.rbc:332
           Rubinius::Compiler.compile at /Users/agrimm/.rbenv/versions/rbx-1.2.4
                                         /lib/compiler/compiler.rbc:58
     Rubinius::CodeLoader#compile_file at kernel/delta/codeloader.rb:146
        Rubinius::CodeLoader#load_file at kernel/delta/codeloader.rb:118
      Rubinius::CodeLoader#load_script at kernel/delta/codeloader.rb:61
      Rubinius::CodeLoader.load_script at kernel/delta/codeloader.rb:90
               Rubinius::Loader#script at kernel/loader.rb:618
                 Rubinius::Loader#main at kernel/loader.rb:762

目前我正在评论我的部分代码以查看导致错误的原因。是否有可以自动完成此过程的库?

1 个答案:

答案 0 :(得分:1)