| CODENOTIFIER | HelpYou are not signed inSign in |
Project: JRuby
Revision: 7634
Author: headius
Date: 02 Sep 2008 23:21:38
Changes:Bytecode fix: trycatch was not stringifying the incoming type
Duby addition: -e support for direct execution.
| ... | ...@@ -9,9 +9,13 @@ | |
| 9 | 9 | module Duby |
| 10 | 10 | def self.run(filename, *args) |
| 11 | 11 | java.lang.System.set_property("jruby.duby.enabled", "true") |
| 12 | ast = Duby::AST.parse(File.read(filename)) | |
| 13 | ||
| 14 | ast = Duby::AST.parse(File.read(filename)) | |
| 12 | ||
| 13 | if filename == '-e' | |
| 14 | filename = 'dash_e' | |
| 15 | ast = Duby::AST.parse(args[0]) | |
| 16 | else | |
| 17 | ast = Duby::AST.parse(File.read(filename)) | |
| 18 | end | |
| 15 | 19 | |
| 16 | 20 | typer = Duby::Typer::Simple.new(:script) |
| 17 | 21 | ast.infer(typer) |
| ... | ...@@ -30,5 +34,5 @@ | |
| 30 | 34 | end |
| 31 | 35 | |
| 32 | 36 | if __FILE__ == $0 |
| 33 | Duby.run(ARGV[0], ARGV[1..-1]) | |
| 37 | Duby.run(ARGV[0], *ARGV[1..-1]) | |
| 34 | 38 | end |
| 35 | 39 | \ No newline at end of file |
| ... | ...@@ -14,10 +14,14 @@ | |
| 14 | 14 | import "org.objectweb.asm.Label" |
| 15 | 15 | end |
| 16 | 16 | |
| 17 | import java.lang.Object | |
| 18 | import java.lang.System | |
| 19 | import java.io.PrintStream | |
| 20 | import java.lang.Void | |
| 17 | JObject = java.lang.Object | |
| 18 | JSystem = java.lang.System | |
| 19 | JPrintStream = java.io.PrintStream | |
| 20 | JVoid = java.lang.Void | |
| 21 | JInteger = java.lang.Integer | |
| 22 | JFloat = java.lang.Float | |
| 23 | JLong = java.lang.Long | |
| 24 | JDobule = java.lang.Double | |
| 21 | 25 | |
| 22 | 26 | b = binding |
| 23 | 27 | OpcodeStackDeltas = {} |
| ... | ...@@ -257,7 +261,7 @@ | |
| 257 | 261 | end |
| 258 | 262 | |
| 259 | 263 | def trycatch(from, to, target, type) |
| 260 | method_visitor.visit_try_catch_block(from, to, target, type) | |
| 264 | method_visitor.visit_try_catch_block(from, to, target, p(type)) | |
| 261 | 265 | end |
| 262 | 266 | |
| 263 | 267 | class SmartLabel |
| ... | ...@@ -278,10 +282,14 @@ | |
| 278 | 282 | end |
| 279 | 283 | |
| 280 | 284 | def aprintln |
| 285 | println | |
| 286 | end | |
| 287 | ||
| 288 | def println(type = JObject) | |
| 281 | 289 | dup |
| 282 | 290 | getstatic System, "out", PrintStream |
| 283 | 291 | swap |
| 284 | invokevirtual PrintStream, "println", [Void::TYPE, Object] | |
| 292 | invokevirtual PrintStream, "println", [JVoid::TYPE, type] | |
| 285 | 293 | end |
| 286 | 294 | |
| 287 | 295 | def swap2 |