MCPcopy Create free account
hub / github.com/GamerHack/GamerHack.github.io / VariableMixin

Function VariableMixin

g2all/700/module/view.js:131–153  ·  view source on GitHub ↗
(superclass)

Source from the content-addressed store, hash-verified

129}
130
131const VariableMixin = (superclass) =>
132 class extends superclass {
133 constructor(value = 0) {
134 // unlike the View classes, we don't allow number coercion. we
135 // explicitly allow floats unlike Int
136 if (typeof value !== "number") {
137 throw TypeError("value not a number");
138 }
139 super([value]);
140 }
141
142 addr_at(...args) {
143 throw TypeError("unimplemented method");
144 }
145
146 [Symbol.toPrimitive](hint) {
147 return this[0];
148 }
149
150 toString(...args) {
151 return this[0].toString(...args);
152 }
153 };
154
155export class Byte extends VariableMixin(View1) {}
156export class Short extends VariableMixin(View2) {}

Callers 3

ByteClass · 0.70
ShortClass · 0.70
WordClass · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected