diff options
author | Eduardo Julian | 2016-02-08 18:20:15 -0400 |
---|---|---|
committer | Eduardo Julian | 2016-02-08 18:20:15 -0400 |
commit | e813726205a35ab3a38f9b42ed69d61e9202ac16 (patch) | |
tree | ed595059017c6b10af9f9ad1f43685e149804500 | |
parent | e6c8e86823f61dddb00d5768acc1982bac173083 (diff) |
- Both abstract & native methods can now have privacy modifiers.
-rw-r--r-- | src/lux/analyser/host.clj | 8 | ||||
-rw-r--r-- | src/lux/analyser/parser.clj | 36 | ||||
-rw-r--r-- | src/lux/compiler/host.clj | 10 | ||||
-rw-r--r-- | src/lux/host.clj | 4 |
4 files changed, 32 insertions, 26 deletions
diff --git a/src/lux/analyser/host.clj b/src/lux/analyser/host.clj index 24b70e353..11914b1fa 100644 --- a/src/lux/analyser/host.clj +++ b/src/lux/analyser/host.clj @@ -643,11 +643,11 @@ (&/|reverse ?inputs)))] (return (&/$StaticMethodAnalysis (&/T [?name =privacy-modifier ?strict ?anns ?gvars ?exceptions ?inputs ?output =body])))) - (&/$AbstractMethodSyntax ?name ?anns ?gvars ?exceptions ?inputs ?output) - (return (&/$AbstractMethodAnalysis (&/T [?name ?anns ?gvars ?exceptions ?inputs ?output]))) + (&/$AbstractMethodSyntax ?name =privacy-modifier ?anns ?gvars ?exceptions ?inputs ?output) + (return (&/$AbstractMethodAnalysis (&/T [?name =privacy-modifier ?anns ?gvars ?exceptions ?inputs ?output]))) - (&/$NativeMethodSyntax ?name ?anns ?gvars ?exceptions ?inputs ?output) - (return (&/$NativeMethodAnalysis (&/T [?name ?anns ?gvars ?exceptions ?inputs ?output]))) + (&/$NativeMethodSyntax ?name =privacy-modifier ?anns ?gvars ?exceptions ?inputs ?output) + (return (&/$NativeMethodAnalysis (&/T [?name =privacy-modifier ?anns ?gvars ?exceptions ?inputs ?output]))) ))) (defn ^:private mandatory-methods [supers] diff --git a/src/lux/analyser/parser.clj b/src/lux/analyser/parser.clj index f6b76d343..980e23535 100644 --- a/src/lux/analyser/parser.clj +++ b/src/lux/analyser/parser.clj @@ -288,18 +288,20 @@ (|case ast [_ (&/$FormS (&/$Cons [_ (&/$TextS "abstract")] (&/$Cons [_ (&/$TextS ?name)] - (&/$Cons [_ (&/$TupleS anns)] - (&/$Cons [_ (&/$TupleS gvars)] - (&/$Cons [_ (&/$TupleS exceptions)] - (&/$Cons [_ (&/$TupleS inputs)] - (&/$Cons output - (&/$Nil)))))))))] - (|do [=anns (&/map% parse-ann anns) + (&/$Cons ?privacy-modifier + (&/$Cons [_ (&/$TupleS anns)] + (&/$Cons [_ (&/$TupleS gvars)] + (&/$Cons [_ (&/$TupleS exceptions)] + (&/$Cons [_ (&/$TupleS inputs)] + (&/$Cons output + (&/$Nil))))))))))] + (|do [=privacy-modifier (parse-privacy-modifier ?privacy-modifier) + =anns (&/map% parse-ann anns) =gvars (&/map% parse-text gvars) =exceptions (&/map% parse-gclass exceptions) =inputs (&/map% parse-arg-decl inputs) =output (parse-gclass output)] - (return (&/$AbstractMethodSyntax (&/T [?name =anns =gvars =exceptions =inputs =output])))) + (return (&/$AbstractMethodSyntax (&/T [?name =privacy-modifier =anns =gvars =exceptions =inputs =output])))) _ (fail ""))) @@ -308,18 +310,20 @@ (|case ast [_ (&/$FormS (&/$Cons [_ (&/$TextS "native")] (&/$Cons [_ (&/$TextS ?name)] - (&/$Cons [_ (&/$TupleS anns)] - (&/$Cons [_ (&/$TupleS gvars)] - (&/$Cons [_ (&/$TupleS exceptions)] - (&/$Cons [_ (&/$TupleS inputs)] - (&/$Cons output - (&/$Nil)))))))))] - (|do [=anns (&/map% parse-ann anns) + (&/$Cons ?privacy-modifier + (&/$Cons [_ (&/$TupleS anns)] + (&/$Cons [_ (&/$TupleS gvars)] + (&/$Cons [_ (&/$TupleS exceptions)] + (&/$Cons [_ (&/$TupleS inputs)] + (&/$Cons output + (&/$Nil))))))))))] + (|do [=privacy-modifier (parse-privacy-modifier ?privacy-modifier) + =anns (&/map% parse-ann anns) =gvars (&/map% parse-text gvars) =exceptions (&/map% parse-gclass exceptions) =inputs (&/map% parse-arg-decl inputs) =output (parse-gclass output)] - (return (&/$NativeMethodSyntax (&/T [?name =anns =gvars =exceptions =inputs =output])))) + (return (&/$NativeMethodSyntax (&/T [?name =privacy-modifier =anns =gvars =exceptions =inputs =output])))) _ (fail ""))) diff --git a/src/lux/compiler/host.clj b/src/lux/compiler/host.clj index de6e6484d..32e15637f 100644 --- a/src/lux/compiler/host.clj +++ b/src/lux/compiler/host.clj @@ -599,11 +599,12 @@ (.visitEnd))]] (return nil)))) - (&/$AbstractMethodSyntax ?name ?anns ?gvars ?exceptions ?inputs ?output) + (&/$AbstractMethodSyntax ?name ?privacy-modifier ?anns ?gvars ?exceptions ?inputs ?output) (|let [=method-decl (&/T [?name ?anns ?gvars ?exceptions (&/|map &/|second ?inputs) ?output]) [simple-signature generic-signature] (&host-generics/method-signatures =method-decl)] (&/with-writer (.visitMethod class-writer - (+ Opcodes/ACC_PUBLIC Opcodes/ACC_ABSTRACT) + (+ Opcodes/ACC_PUBLIC Opcodes/ACC_ABSTRACT + (&host/privacy-modifier->flag ?privacy-modifier)) ?name simple-signature generic-signature @@ -613,11 +614,12 @@ _ (.visitEnd =method)]] (return nil)))) - (&/$NativeMethodSyntax ?name ?anns ?gvars ?exceptions ?inputs ?output) + (&/$NativeMethodSyntax ?name ?privacy-modifier ?anns ?gvars ?exceptions ?inputs ?output) (|let [=method-decl (&/T [?name ?anns ?gvars ?exceptions (&/|map &/|second ?inputs) ?output]) [simple-signature generic-signature] (&host-generics/method-signatures =method-decl)] (&/with-writer (.visitMethod class-writer - (+ Opcodes/ACC_PUBLIC Opcodes/ACC_NATIVE) + (+ Opcodes/ACC_PUBLIC Opcodes/ACC_NATIVE + (&host/privacy-modifier->flag ?privacy-modifier)) ?name simple-signature generic-signature diff --git a/src/lux/host.clj b/src/lux/host.clj index d1b884280..3aabce165 100644 --- a/src/lux/host.clj +++ b/src/lux/host.clj @@ -327,7 +327,7 @@ (.visitMaxs 0 0) (.visitEnd))) - (&/$AbstractMethodSyntax =name =anns =gvars =exceptions =inputs =output) + (&/$AbstractMethodSyntax =name =privacy-modifier =anns =gvars =exceptions =inputs =output) (|let [method-decl [=name =anns =gvars =exceptions (&/|map &/|second =inputs) =output] [simple-signature generic-signature] (&host-generics/method-signatures method-decl)] (doto (.visitMethod =class (+ Opcodes/ACC_PUBLIC Opcodes/ACC_ABSTRACT) @@ -337,7 +337,7 @@ (->> =exceptions (&/|map &host-generics/gclass->bytecode-class-name) &/->seq (into-array java.lang.String))) (.visitEnd))) - (&/$NativeMethodSyntax =name =anns =gvars =exceptions =inputs =output) + (&/$NativeMethodSyntax =name =privacy-modifier =anns =gvars =exceptions =inputs =output) (|let [method-decl [=name =anns =gvars =exceptions (&/|map &/|second =inputs) =output] [simple-signature generic-signature] (&host-generics/method-signatures method-decl)] (doto (.visitMethod =class (+ Opcodes/ACC_PUBLIC Opcodes/ACC_NATIVE) |