Fixed the #environment accessor for non-CompiledMethod Methods.
[cslatevm.git] / src / mobius / primitive-method.slate
blob8ed59066cea867038f2a08b3a6333ab997e6bbd1
1 "Protocol for PrimitiveMethod to be usable in the same ways as CompiledMethod."
3 m@(PrimitiveMethod traits) applyTo: args
5   error: 'The Slate VM currently does not support #applyTo: calls on PrimitiveMethods.'
6 ].
8 m@(PrimitiveMethod traits) method [m].
10 m@(PrimitiveMethod traits) acceptsAdditionalArguments [False].
11 "Primitives have no *rest parameters."
13 m@(PrimitiveMethod traits) optionalKeywords [#{}].
14 "Primitives may take optionals, but we cannot currently communicate that."
16 m@(PrimitiveMethod traits) arity
17 "Use the fact that all PrimitiveMethods have selectors to determine their
18 arity from the name."
19 [m selector arity].
21 m@(PrimitiveMethod traits) literals [#{}].
22 m@(PrimitiveMethod traits) selectors [#{}].
23 m@(PrimitiveMethod traits) code [Nil].
24 m@(PrimitiveMethod traits) sourceTree [Nil].
25 m@(PrimitiveMethod traits) registerCount [m arity].
26 m@(PrimitiveMethod traits) inputVariables [m arity].
27 m@(PrimitiveMethod traits) restVariable [Nil].
28 m@(PrimitiveMethod traits) sourceTree [Nil].
29 m@(PrimitiveMethod traits) heapAllocate [False].
30 m@(PrimitiveMethod traits) environment [Nil].
32 m@(PrimitiveMethod traits) definitionLocation
34   'primitive:' ; m index printString
37 m@(PrimitiveMethod traits) allSelectorsSent [#{}].
38 "Answer an empty Collection since PrimitiveMethods obviously don't call any
39 other methods, otherwise they wouldn't be primitive!"
41 m@(PrimitiveMethod traits) allSelectorsSentToArg: _ [#{}].
42 "Answer an empty Collection since PrimitiveMethods obviously don't call any
43 other methods, otherwise they wouldn't be primitive!"
45 m@(PrimitiveMethod traits) allSelectorsSentImplicitly [#{}].
46 "Answer an empty Collection since PrimitiveMethods obviously don't call any
47 other methods, otherwise they wouldn't be primitive!"