etng-r2/etng-convert-constant-methods-pass.g
author Tony Garnock-Jones <tonygarnockjones@gmail.com>
Wed, 16 Jan 2019 17:15:58 +0000
changeset 438 1fe179d53161
parent 234 10e62e160cb0
permissions -rw-r--r--
Add missing primitive implementation for the plain interpreter.
201
9b22b7a23e39 Convert constant-methods to normal methods.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
diff changeset
     1
-- -*- text -*-
9b22b7a23e39 Convert constant-methods to normal methods.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
diff changeset
     2
9b22b7a23e39 Convert constant-methods to normal methods.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
diff changeset
     3
pass = toplevel;
9b22b7a23e39 Convert constant-methods to normal methods.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
diff changeset
     4
9b22b7a23e39 Convert constant-methods to normal methods.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
diff changeset
     5
expr =
234
10e62e160cb0 Switch from "[]" to "rec {}", and add "rec selfid {}" form
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 201
diff changeset
     6
	  {#object :selfid method*:methods ~_} ->
10e62e160cb0 Switch from "[]" to "rec {}", and add "rec selfid {}" form
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 201
diff changeset
     7
		(convert-constant-methods `(object ,selfid) methods)
10e62e160cb0 Switch from "[]" to "rec {}", and add "rec selfid {}" form
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 201
diff changeset
     8
	| {#function method*:methods ~_} ->
10e62e160cb0 Switch from "[]" to "rec {}", and add "rec selfid {}" form
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 201
diff changeset
     9
		(convert-constant-methods '(function) methods)
201
9b22b7a23e39 Convert constant-methods to normal methods.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
diff changeset
    10
;
9b22b7a23e39 Convert constant-methods to normal methods.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
diff changeset
    11
9b22b7a23e39 Convert constant-methods to normal methods.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
diff changeset
    12
method =
9b22b7a23e39 Convert constant-methods to normal methods.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
diff changeset
    13
	  {#constant-method {pattern*}:patterns expr:body ~_} -> `(constant-method ,patterns ,body)
9b22b7a23e39 Convert constant-methods to normal methods.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
diff changeset
    14
;