aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--stdlib/source/lux/control/concurrency/process.lux4
-rw-r--r--stdlib/source/lux/host.jvm.lux2
-rw-r--r--stdlib/source/lux/host.old.lux40
-rw-r--r--stdlib/source/lux/target/jvm/loader.old.lux4
-rw-r--r--stdlib/source/test/lux/host.old.lux8
5 files changed, 36 insertions, 22 deletions
diff --git a/stdlib/source/lux/control/concurrency/process.lux b/stdlib/source/lux/control/concurrency/process.lux
index 400dcf2c8..6d432f48d 100644
--- a/stdlib/source/lux/control/concurrency/process.lux
+++ b/stdlib/source/lux/control/concurrency/process.lux
@@ -93,7 +93,7 @@
(`` (for {(~~ (static @.old))
(let [runnable (object [] [java/lang/Runnable]
[]
- (java/lang/Runnable [] (run) void
+ (java/lang/Runnable [] (run self) void
(io.run action)))]
(case milli-seconds
0 (java/util/concurrent/Executor::execute runnable runner)
@@ -103,7 +103,7 @@
(~~ (static @.jvm))
(let [runnable (object [] [java/lang/Runnable]
[]
- (java/lang/Runnable [] (run) void
+ (java/lang/Runnable [] (run self) void
(io.run action)))]
(case milli-seconds
0 (java/util/concurrent/Executor::execute runnable runner)
diff --git a/stdlib/source/lux/host.jvm.lux b/stdlib/source/lux/host.jvm.lux
index 1787f5f45..5345d221f 100644
--- a/stdlib/source/lux/host.jvm.lux
+++ b/stdlib/source/lux/host.jvm.lux
@@ -1457,7 +1457,7 @@
"An optional super-class can be specified before the 1st tuple. If not specified, java.lang.Object will be assumed."
(object [] [Runnable]
[]
- (Runnable [] (run) void
+ (Runnable [] (run self) void
(exec (do-something some-value)
[])))
)}
diff --git a/stdlib/source/lux/host.old.lux b/stdlib/source/lux/host.old.lux
index 939e82310..39fe0034c 100644
--- a/stdlib/source/lux/host.old.lux
+++ b/stdlib/source/lux/host.old.lux
@@ -157,6 +157,7 @@
(#VirtualMethod [Bit
Bit
(List Type-Paramameter)
+ Text
(List ArgDecl)
GenericType
Code
@@ -164,6 +165,7 @@
(#OverridenMethod [Bit
Class-Declaration
(List Type-Paramameter)
+ Text
(List ArgDecl)
GenericType
Code
@@ -621,8 +623,8 @@
(#StaticMethod strict? type-vars args return-type return-expr exs)
(make-static-method-parser params class-name method-name args)
- (^or (#VirtualMethod final? strict? type-vars args return-type return-expr exs)
- (#OverridenMethod strict? owner-class type-vars args return-type return-expr exs))
+ (^or (#VirtualMethod final? strict? type-vars self-name args return-type return-expr exs)
+ (#OverridenMethod strict? owner-class type-vars self-name args return-type return-expr exs))
(make-special-method-parser params class-name method-name args)
(#AbstractMethod type-vars args return-type exs)
@@ -866,8 +868,10 @@
final? (s.this? (' #final))
method-vars (p.default (list) (type-params^ imports))
#let [total-vars (list@compose class-vars method-vars)]
- [name arg-decls] (s.form (p.and s.local-identifier
- (arg-decls^ imports total-vars)))
+ [name this-name arg-decls] (s.form ($_ p.and
+ s.local-identifier
+ s.local-identifier
+ (arg-decls^ imports total-vars)))
return-type (generic-type^ imports total-vars)
exs (throws-decl^ imports total-vars)
annotations (annotations^ imports)
@@ -875,7 +879,10 @@
(wrap [{#member-name name
#member-privacy pm
#member-anns annotations}
- (#VirtualMethod final? strict-fp? method-vars arg-decls return-type body exs)]))))
+ (#VirtualMethod final? strict-fp?
+ method-vars
+ this-name arg-decls return-type
+ body exs)]))))
(def: (overriden-method-def^ imports)
(-> Class-Imports (Parser [Member-Declaration Method-Definition]))
@@ -884,8 +891,10 @@
owner-class (class-decl^ imports)
method-vars (p.default (list) (type-params^ imports))
#let [total-vars (list@compose (product.right owner-class) method-vars)]
- [name arg-decls] (s.form (p.and s.local-identifier
- (arg-decls^ imports total-vars)))
+ [name this-name arg-decls] (s.form ($_ p.and
+ s.local-identifier
+ s.local-identifier
+ (arg-decls^ imports total-vars)))
return-type (generic-type^ imports total-vars)
exs (throws-decl^ imports total-vars)
annotations (annotations^ imports)
@@ -893,7 +902,10 @@
(wrap [{#member-name name
#member-privacy #PublicPM
#member-anns annotations}
- (#OverridenMethod strict-fp? owner-class method-vars arg-decls return-type body exs)]))))
+ (#OverridenMethod strict-fp?
+ owner-class method-vars
+ this-name arg-decls return-type
+ body exs)]))))
(def: (static-method-def^ imports)
(-> Class-Imports (Parser [Member-Declaration Method-Definition]))
@@ -1192,7 +1204,7 @@
(code.to-text (pre-walk-replace replacer body))
)))
- (#VirtualMethod final? strict-fp? type-vars arg-decls return-type body exs)
+ (#VirtualMethod final? strict-fp? type-vars this-name arg-decls return-type body exs)
(with-parens
(spaced (list "virtual"
name
@@ -1204,9 +1216,10 @@
(with-brackets (spaced (list@map generic-type$ exs)))
(with-brackets (spaced (list@map arg-decl$ arg-decls)))
(generic-type$ return-type)
- (code.to-text (pre-walk-replace replacer body)))))
+ (code.to-text (pre-walk-replace replacer (` (let [(~ (code.local-identifier this-name)) (~' _jvm_this)]
+ (~ body))))))))
- (#OverridenMethod strict-fp? class-decl type-vars arg-decls return-type body exs)
+ (#OverridenMethod strict-fp? class-decl type-vars this-name arg-decls return-type body exs)
(let [super-replacer (parser->replacer (s.form (do p.monad
[_ (s.this (' ::super!))
args (s.tuple (p.exactly (list.size arg-decls) s.any))
@@ -1227,7 +1240,8 @@
(with-brackets (spaced (list@map generic-type$ exs)))
(with-brackets (spaced (list@map arg-decl$ arg-decls)))
(generic-type$ return-type)
- (|> body
+ (|> (` (let [(~ (code.local-identifier this-name)) (~' _jvm_this)]
+ (~ body)))
(pre-walk-replace replacer)
(pre-walk-replace super-replacer)
(code.to-text))
@@ -1380,7 +1394,7 @@
"An optional super-class can be specified before the 1st tuple. If not specified, java.lang.Object will be assumed."
(object [] [Runnable]
[]
- (Runnable [] (run) void
+ (Runnable [] (run self) void
(exec (do-something some-value)
[])))
)}
diff --git a/stdlib/source/lux/target/jvm/loader.old.lux b/stdlib/source/lux/target/jvm/loader.old.lux
index 0ca92fa23..57a715107 100644
--- a/stdlib/source/lux/target/jvm/loader.old.lux
+++ b/stdlib/source/lux/target/jvm/loader.old.lux
@@ -95,11 +95,11 @@
(-> Library java/lang/ClassLoader)
(object [] java/lang/ClassLoader []
[]
- (java/lang/ClassLoader (findClass {class-name java/lang/String}) java/lang/Class
+ (java/lang/ClassLoader (findClass self {class-name java/lang/String}) java/lang/Class
(let [classes (|> library atom.read io.run)]
(case (dictionary.get class-name classes)
(#.Some bytecode)
- (case (|> _jvm_this
+ (case (|> self
(..define class-name bytecode))
(#error.Success class)
(:assume class)
diff --git a/stdlib/source/test/lux/host.old.lux b/stdlib/source/test/lux/host.old.lux
index 04c149881..c9446b857 100644
--- a/stdlib/source/test/lux/host.old.lux
+++ b/stdlib/source/test/lux/host.old.lux
@@ -37,23 +37,23 @@
(:= ::bar value)
(:= ::baz "")
[]))
- (#public (virtual) java/lang/Object
+ (#public (virtual self) java/lang/Object
"")
(#public #static (static) java/lang/Object
"")
- (Runnable [] (run) void
+ (Runnable [] (run self) void
[]))
(def: test-runnable
(object [] [Runnable]
[]
- (Runnable [] (run) void
+ (Runnable [] (run self) void
[])))
(def: test-callable
(object [a] [(Callable a)]
[]
- (Callable [] (call) a
+ (Callable [] (call self) a
(undefined))))
(interface: TestInterface