aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm/function/field/variable/foreign.lux
blob: ec17663b7847620b1eecce243829fc175ed032df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
... This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
... If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.

(.require
 [library
  [lux (.except Type)
   [data
    [collection
     ["[0]" list]]]
   [meta
    [compiler
     [target
      [jvm
       ["_" bytecode (.only Bytecode)]
       ["[0]" field (.only Field)]
       [constant
        [pool (.only Resource)]]
       [type (.only Type)
        [category (.only Value Class)]]]]]]]]
 ["[0]" // (.only)
  ["///[1]" ////
   ["[1][0]" reference]
   [////
    [analysis (.only Environment)]
    ["[0]" synthesis]
    [///
     [reference
      [variable (.only Register)]]]]]])

(def .public (closure environment)
  (-> (Environment synthesis.Term)
      (List (Type Value)))
  (list.repeated (list.size environment) //.type))

(def .public (get class register)
  (-> (Type Class) Register
      (Bytecode Any))
  (//.get class (/////reference.foreign_name register)))

(def .public (put class register value)
  (-> (Type Class) Register (Bytecode Any)
      (Bytecode Any))
  (//.put /////reference.foreign_name class register value))

(def .public variables
  (-> (Environment synthesis.Term)
      (List (Resource Field)))
  (|>> list.size (//.variables /////reference.foreign_name)))