@@ -238,6 +238,7 @@ public int getInt() {
238
238
case GLOB -> 1 ; // Assuming globs are truthy, so 1
239
239
case REGEX -> 1 ; // Assuming regexes are truthy, so 1
240
240
case JAVAOBJECT -> value != null ? 1 : 0 ;
241
+ case TIED_SCALAR -> tiedFetch ().getInt ();
241
242
default -> Overload .numify (this ).getInt ();
242
243
};
243
244
}
@@ -254,6 +255,7 @@ public long getLong() {
254
255
case GLOB -> 1L ;
255
256
case REGEX -> 1L ;
256
257
case JAVAOBJECT -> value != null ? 1L : 0L ;
258
+ case TIED_SCALAR -> tiedFetch ().getLong ();
257
259
default -> Overload .numify (this ).getLong ();
258
260
};
259
261
}
@@ -270,6 +272,7 @@ public double getDouble() {
270
272
case GLOB -> 1.0 ;
271
273
case REGEX -> 1.0 ;
272
274
case JAVAOBJECT -> value != null ? 1.0 : 0.0 ;
275
+ case TIED_SCALAR -> tiedFetch ().getDouble ();
273
276
default -> Overload .numify (this ).getDouble ();
274
277
};
275
278
}
@@ -289,6 +292,7 @@ public boolean getBoolean() {
289
292
case GLOB -> true ;
290
293
case REGEX -> true ;
291
294
case JAVAOBJECT -> value != null ;
295
+ case TIED_SCALAR -> tiedFetch ().getBoolean ();
292
296
default -> Overload .boolify (this ).getBoolean ();
293
297
};
294
298
}
@@ -328,8 +332,19 @@ public RuntimeScalar addToScalar(RuntimeScalar scalar) {
328
332
return scalar .set (this );
329
333
}
330
334
335
+ public RuntimeScalar tiedFetch () {
336
+ throw new PerlCompilerException ("not implemented: tied FETCH on scalar" );
337
+ }
338
+
339
+ public RuntimeScalar tiedStore () {
340
+ throw new PerlCompilerException ("not implemented: tied STORE on scalar" );
341
+ }
342
+
331
343
// Setters
332
344
public RuntimeScalar set (RuntimeScalar value ) {
345
+ if (this .type == TIED_SCALAR ) {
346
+ return tiedStore ();
347
+ }
333
348
this .type = value .type ;
334
349
this .value = value .value ;
335
350
return this ;
@@ -397,6 +412,7 @@ public String toString() {
397
412
case GLOB -> value == null ? "" : value .toString ();
398
413
case REGEX -> value .toString ();
399
414
case JAVAOBJECT -> value .toString ();
415
+ case TIED_SCALAR -> tiedFetch ().toString ();
400
416
default -> Overload .stringify (this ).toString ();
401
417
};
402
418
}
0 commit comments