From a6ad4391394f37fb8a729a26e27826c17a477fec Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Thu, 9 May 2019 20:43:13 -0400 Subject: WIP: Anonymous classes analysis & generation. --- .../tool/compiler/phase/extension/analysis/jvm.lux | 46 +++++++++++++++------- stdlib/source/lux/tool/compiler/synthesis.lux | 4 +- 2 files changed, 33 insertions(+), 17 deletions(-) (limited to 'stdlib') diff --git a/stdlib/source/lux/tool/compiler/phase/extension/analysis/jvm.lux b/stdlib/source/lux/tool/compiler/phase/extension/analysis/jvm.lux index 1c7dfdee7..a9417050a 100644 --- a/stdlib/source/lux/tool/compiler/phase/extension/analysis/jvm.lux +++ b/stdlib/source/lux/tool/compiler/phase/extension/analysis/jvm.lux @@ -1411,7 +1411,7 @@ ))) ))) -(type: #rec JVM-Type +(type: #export #rec JVM-Type [Text (List JVM-Type)]) (def: (lux-type [name parameters]) @@ -1437,45 +1437,57 @@ (function (_ jvm-type) (s.form (p.and s.text (p.some jvm-type)))))) +(type: #export (Constructor-Argument a) + [JVM-Type a]) + (def: constructor-arg - (Parser [JVM-Type Code]) + (Parser (Constructor-Argument Code)) (s.tuple (p.and ..jvm-type s.any))) -(type: (Annotation-Parameter a) +(type: #export (Annotation-Parameter a) [Text a]) (def: annotation-parameter (Parser (Annotation-Parameter Code)) (s.tuple (p.and s.text s.any))) -(type: (Annotation a) +(type: #export (Annotation a) [Text (List (Annotation-Parameter a))]) (def: annotation (Parser (Annotation Code)) (s.form (p.and s.text (p.some ..annotation-parameter)))) -(type: Type-Parameter Text) +(type: #export Type-Parameter Text) (def: type-parameter (Parser Type-Parameter) s.text) -(type: Argument +(type: #export Argument [Text JVM-Type]) (def: argument (Parser Argument) (s.tuple (p.and s.text ..jvm-type))) -(type: Overriden-Method - [JVM-Type Text Bit (List (Annotation Code)) (List Type-Parameter) Text (List Argument) JVM-Type (List JVM-Type) Code]) - -(type: Method-Definition - (#Overriden-Method Overriden-Method)) +(type: #export (Overriden-Method a) + [JVM-Type + Text + Bit + (List (Annotation a)) + (List Type-Parameter) + Text + (List Argument) + JVM-Type + (List JVM-Type) + a]) + +(type: #export (Method-Definition a) + (#Overriden-Method (Overriden-Method a))) (def: overriden-method-definition - (Parser Overriden-Method) + (Parser (Overriden-Method Code)) (<| s.form (p.after (s.this (` "override"))) ($_ p.and @@ -1510,7 +1522,7 @@ /////analysis.text) (def: (constructor-arg-analysis [type term]) - (-> [JVM-Type Analysis] Analysis) + (-> (Constructor-Argument Analysis) Analysis) (/////analysis.tuple (list (jvm-type-analysis type) term))) (def: lux-module-separator "/") @@ -1573,12 +1585,18 @@ (/////analysis.bit strict-fp?) (/////analysis.tuple (list@map annotation-analysis annotationsA)) (/////analysis.tuple (list@map type-parameter-analysis type-parameters)) + (/////analysis.text self-name) + (/////analysis.tuple (list@map (function (_ [argument argumentJT]) + (/////analysis.tuple + (list (/////analysis.text argument) + (jvm-type-analysis argumentJT)))) + arguments)) (jvm-type-analysis return-type) (/////analysis.tuple (list@map jvm-type-analysis exceptions)) (#/////analysis.Function (scope.environment scope) - bodyA) + (/////analysis.tuple (list bodyA))) ))))) methods) _ (typeA.infer selfT)] diff --git a/stdlib/source/lux/tool/compiler/synthesis.lux b/stdlib/source/lux/tool/compiler/synthesis.lux index d12c8c3ea..a30d11b92 100644 --- a/stdlib/source/lux/tool/compiler/synthesis.lux +++ b/stdlib/source/lux/tool/compiler/synthesis.lux @@ -337,9 +337,7 @@ (text.enclose ["[" "]"]))) (#Reference reference) - (|> reference - //reference.%reference - (text.enclose ["(#@ " ")"])) + (//reference.%reference reference) (#Control control) (case control -- cgit v1.2.3