Create a gist now

Instantly share code, notes, and snippets.

Blog post notes
class SomeAppWithAnUnmacroedView < ShatnerBase
get '/' do
render do
def_edb render, 'views/index.edb'
end
end
end
class ScopedBody
def defining_class
scope.defining_class
end
end
$ rake test --trace
** Invoke test (first_time)
...
Inferring types...
test_shatner.mirah:44: undefined method `name' for nil:NilClass
render do
^^^^^^^^^^^^^^
def_edb render, 'views/index.edb'
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
end
^^^^^^^
rake aborted!
undefined method `name' for nil:NilClass
/Users/nick/hacking/mirah/lib/mirah/ast/scope.rb:164:in `binding_type'
/Users/nick/hacking/mirah/lib/mirah/ast/scope.rb:162:in `binding_type'
/Users/nick/hacking/mirah/lib/mirah/ast/structure.rb:185:in `binding_type'
/Users/nick/hacking/mirah/lib/mirah/ast/structure.rb:149:in `prepare'
/Users/nick/hacking/mirah/lib/mirah/ast/call.rb:97:in `infer'
org
Inferring types...
Compiling...
test_shatner.mirah
Done!
cd -
Done Compiling Tests
** Execute test
running tests
Running org.shatner.SinatraCloneTest
Testsuite: org.shatner.SinatraCloneTest
Tests run: 3, Failures: 0, Errors: 1, Time elapsed: 0.037 sec
... elided ...
Testcase: test_some_app_with_view_prints_bananas took 0.002 sec
Caused an ERROR
(class: org/shatner/SomeAppWithAnUnmacroedView$__xform_tmp_6, method: call signature: ()Ljava/lang/Object;) Incompatible argument to function
java.lang.VerifyError: (class: org/shatner/SomeAppWithAnUnmacroedView$__xform_tmp_6, method: call signature: ()Ljava/lang/Object;) Incompatible argument to function
at org.shatner.SomeAppWithAnUnmacroedView.<init>(test_shatner.mirah:83)
at org.shatner.SinatraCloneTest.test_some_app_with_view_prints_bananas(test_shatner.mirah:134)
test_shatner.mirah:44: undefined method `defining_class' for #<Mirah::AST::ScopedBody:0x32535e27>
render do
^^^^^^^^^^^^^^
def_edb render, 'views/index.edb'
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
end
^^^^^^^
rake aborted!
undefined method `defining_class' for #<Mirah::AST::ScopedBody:0x32535e27>
/Users/nick/hacking/mirah/lib/mirah/ast/structure.rb:155:in `prepare'
/Users/nick/hacking/mirah/lib/mirah/ast/call.rb:97:in `infer'
org/jruby/RubyKernel.java:2082:in `send'
// Generated from test_shatner.mirah
package org.shatner;
public class SomeAppWithAnUnmacroedView extends org.shatner.ShatnerBase {
public SomeAppWithAnUnmacroedView() {
org.shatner.SomeAppWithAnUnmacroedView.__xform_tmp_5 $binding = new org.shatner.SomeAppWithAnUnmacroedView.__xform_tmp_5();
java.lang.String temp$1 = null;
{
temp$1 = "/";
}
org.shatner.SomeAppWithAnUnmacroedView.__xform_tmp_6 temp$2 = new org.shatner.SomeAppWithAnUnmacroedView.__xform_tmp_6($binding);
this.add_callback_for_route("GET", temp$1, temp$2);
}
public static class __xform_tmp_5 extends java.lang.Object {
}
public static class __xform_tmp_6 extends java.lang.Object implements org.shatner.ShatnerCallable {
private org.shatner.SomeAppWithAnUnmacroedView.__xform_tmp_5 binding;
public __xform_tmp_6(org.shatner.SomeAppWithAnUnmacroedView.__xform_tmp_5 binding) {
this.binding = binding;
}
public java.lang.Object call() {
org.shatner.SomeAppWithAnUnmacroedView.__xform_tmp_5 $binding = this.binding;
java.lang.String result = null;
org.shatner.ShatnerView view = null;
java.lang.String temp$1 = null;
{
temp$1 = this.render(new org.shatner.SomeAppWithAnUnmacroedView.__xform_tmp_6.__xform_tmp_8($binding));
}
result = temp$1;
return result;
}
public java.lang.Object render(org.shatner.ShatnerView view) {
org.shatner.SomeAppWithAnUnmacroedView.__xform_tmp_5 $binding = this.binding;
java.lang.String result = null;
return view.render();
}
public static class __xform_tmp_6 extends java.lang.Object implements org.shatner.ShatnerView {
private org.shatner.SomeAppWithAnUnmacroedView.__xform_tmp_6.__xform_tmp_7 binding;
public __xform_tmp_6(org.shatner.SomeAppWithAnUnmacroedView.__xform_tmp_6.__xform_tmp_7 binding) {
this.binding = binding;
}
public java.lang.String render() {
org.shatner.SomeAppWithAnUnmacroedView.__xform_tmp_6.__xform_tmp_7 $binding = this.binding;
return ;
}
public java.lang.String render() {
java.lang.StringBuilder _edbout = null;
_edbout = new java.lang.StringBuilder();
_edbout.append("bananas");
return _edbout.toString();
}
}
}
}
Inferring types...
Compiling...
test_shatner.mirah
test_shatner.mirah:44: undefined method `[]' for nil:NilClass
render do
^^^^
def_edb render, 'views/index.edb'
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
end
^^^^^^^
rake aborted!
undefined method `[]' for nil:NilClass
/Users/nick/hacking/mirah/lib/mirah/jvm/compiler/jvm_bytecode.rb:530:in `get_binding'
/Users/nick/hacking/mirah/lib/mirah/jvm/compiler/jvm_bytecode.rb:830:in `prepare_binding'
/Users/nick/hacking/mirah/lib/mirah/jvm/compiler/jvm_bytecode.rb:192:in `method_body'
/Users/nick/hacking/mirah/lib/mirah/jvm/compiler/base.rb:260:in `with'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment