Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remove all calls to now-noop NewROScalar

  • Loading branch information...
commit 581727d1dd6183ca80ed2589d2f78b02f3c222d2 1 parent cbe27a0
@sorear authored
View
4 docs/nam.pod
@@ -288,10 +288,6 @@ Wraps C<$obj> in a read-only variable with the list nature.
Creates a new variable of type Any containing C<$obj>.
-=head3 newscalar($obj)
-
-Wraps C<$obj> in a read-only variable.
-
=head3 newvarrayvar
=head3 newvhashvar
View
49 lib/Builtins.cs
@@ -151,7 +151,7 @@ class SubstrLValue: Variable {
int right = ((length > (str.Length - left)) ? (str.Length - left) :
(length < 0) ? 0 : length) + left;
string lfr = str.Substring(0, left);
- string mfr = v.mo.mro_raw_Str.Get(Kernel.NewROScalar(v));
+ string mfr = v.mo.mro_raw_Str.Get(v);
string rfr = str.Substring(right);
backing.Store(Kernel.BoxRaw<string>(lfr + mfr + rfr, Kernel.StrMO));
}
@@ -225,7 +225,7 @@ public partial class Builtins {
P6opaque newJunc = new P6opaque(Kernel.JunctionMO);
newJunc.slots[0] = j_.slots[0];
newJunc.slots[1] = newList;
- return Kernel.NewROScalar(newJunc);
+ return newJunc;
}
// These three functions implement type checking and junctional
@@ -1060,7 +1060,7 @@ public partial class Builtins {
else
return MakeInt(red);
}
- return Kernel.NewROScalar(n1);
+ return n1;
}
static readonly Func<Variable,Variable,Variable> gcd_d = gcd;
@@ -1513,7 +1513,7 @@ public partial class Builtins {
v.AssignO(o1.mo.mro_succ.Get(v), false);
if (!o1.IsDefined()) // note: slightly wrong for my Bool $x; $x++
o1 = Kernel.BoxRaw<int>(0, Kernel.IntMO);
- return Kernel.NewROScalar(o1);
+ return o1;
}
public static Variable preinc(Variable v) {
@@ -1526,7 +1526,7 @@ public partial class Builtins {
v.AssignO(o1.mo.mro_pred.Get(v), false);
if (!o1.IsDefined()) // note: slightly wrong for my Bool $x; $x--
o1 = Kernel.BoxRaw<int>(0, Kernel.IntMO);
- return Kernel.NewROScalar(o1);
+ return o1;
}
public static Variable predec(Variable v) {
@@ -1619,7 +1619,7 @@ public partial class Builtins {
P6opaque nj = new P6opaque(Kernel.JunctionMO);
nj.slots[0] = Kernel.BoxRaw(type, Kernel.IntMO);
nj.slots[1] = Kernel.BoxRaw(elems, Kernel.ParcelMO);
- return Kernel.NewROScalar(nj);
+ return nj;
}
public static Variable Make(Frame fr, Variable v) {
@@ -1652,7 +1652,7 @@ public partial class Builtins {
P6opaque p = new P6opaque(Kernel.PairMO);
p.slots[0] = Kernel.BoxAnyMO<string>(kv.Key, Kernel.StrMO);
p.slots[1] = kv.Value;
- lv.Push(Kernel.NewROScalar(p));
+ lv.Push(p);
break;
}
}
@@ -1933,7 +1933,7 @@ public partial class Builtins {
}
public static Variable pair(Variable key, Variable value) {
- return Kernel.NewROScalar(MakePair(key, value));
+ return MakePair(key, value);
}
public static VarDeque start_iter(Variable thing) {
@@ -1948,7 +1948,7 @@ public partial class Builtins {
VarDeque items = new VarDeque();
while (Kernel.IterHasFlat(rest, true))
items.Push(Kernel.NewMuScalar(rest.Shift().Fetch()));
- return Kernel.NewROScalar(MakeArray(items, rest));
+ return MakeArray(items, rest);
}
public static string frame_subname(Frame fr) {
@@ -2168,14 +2168,14 @@ class CrossSource: ItemSource {
thunk.slots[1] = Kernel.NewMuScalar(Kernel.AnyP);
P6opaque lst = new P6opaque(Kernel.ListMO);
lst.slots[0] = outq;
- lst.slots[1] = new VarDeque(Kernel.NewROScalar(thunk));
+ lst.slots[1] = new VarDeque(thunk);
th.caller.resultSlot = Kernel.NewRWListVar(lst);
th.lexi0 = 1;
return th.Return();
}
if (pen == null) {
if (tailmode != 0)
- return Kernel.Take(th, Kernel.NewROScalar(Kernel.EMPTYP));
+ return Kernel.Take(th, Kernel.EMPTYP);
P6opaque lst = new P6opaque(Kernel.ListMO);
lst.slots[0] = outq;
lst.slots[1] = new VarDeque();
@@ -2292,7 +2292,7 @@ class CrossSource: ItemSource {
thunk.slots[1] = Kernel.NewMuScalar(Kernel.AnyP);
P6opaque lst = new P6opaque(Kernel.ListMO);
lst.slots[0] = outq;
- lst.slots[1] = new VarDeque(Kernel.NewROScalar(thunk));
+ lst.slots[1] = new VarDeque(thunk);
th.caller.resultSlot = Kernel.NewRWListVar(lst);
th.lexi0 = 1;
return th.Return();
@@ -2302,7 +2302,7 @@ class CrossSource: ItemSource {
}
if (pen == null) {
if (tailmode != 0)
- return Kernel.Take(th, Kernel.NewROScalar(Kernel.EMPTYP));
+ return Kernel.Take(th, Kernel.EMPTYP);
P6opaque lst = new P6opaque(Kernel.ListMO);
lst.slots[0] = outq;
lst.slots[1] = new VarDeque();
@@ -2637,7 +2637,7 @@ class CrossSource: ItemSource {
n.how = Kernel.BoxAny<STable>(n, obj.mo.how).Fetch();
n.typeObject = n.initObject = new P6opaque(n);
- n.typeVar = n.initVar = Kernel.NewROScalar(n.typeObject);
+ n.typeVar = n.initVar = n.typeObject;
((P6opaque)n.typeObject).slots = null;
n.mo.superclasses.Add(obj.mo);
@@ -2660,7 +2660,7 @@ class CrossSource: ItemSource {
BuildMostDerived(obj);
if (aname != null)
Kernel.Assign((Variable)obj.GetSlot(n, aname), init);
- return Kernel.NewROScalar(obj);
+ return obj;
} else {
return n.typeVar;
}
@@ -2671,7 +2671,7 @@ class CrossSource: ItemSource {
nobj.ChangeType(type.Fetch().mo);
nobj.SetSlot(Kernel.PseudoStrMO, "$!value",
Kernel.UnboxAny<string>(str.Fetch()));
- return Kernel.NewROScalar(nobj);
+ return nobj;
}
public static void EstablishSlot(P6any n, P6how.AttrInfo ai,
@@ -2709,21 +2709,21 @@ class CrossSource: ItemSource {
Variable vx = null;
if (ai.init != null) {
vx = Kernel.RunInferior(ai.init.Invoke(Kernel.GetInferiorRoot(),
- new [] { Kernel.NewROScalar(obj) }, null));
+ new [] { obj }, null));
}
EstablishSlot(obj, ai, vx);
}
if (build != null)
Kernel.RunInferior(build.Invoke(Kernel.GetInferiorRoot(),
- new Variable[] { Kernel.NewROScalar(obj) }, null));
+ new Variable[] { obj }, null));
}
public static Variable enum_mixin_role(string name, P6any meth) {
STable r = new STable('{' + name + '}');
r.mo.FillRole(new STable[0], null);
r.typeObject = r.initObject = new P6opaque(r);
- r.typeVar = r.initVar = Kernel.NewROScalar(r.typeObject);
+ r.typeVar = r.initVar = r.typeObject;
r.mo.AddMethod(0, name, meth);
r.mo.Revalidate();
r.SetupVTables();
@@ -2735,7 +2735,7 @@ class CrossSource: ItemSource {
STable r = new STable('{' + name + '}');
r.mo.FillRole(new STable[0], null);
r.typeObject = r.initObject = new P6opaque(r);
- r.typeVar = r.initVar = Kernel.NewROScalar(r.typeObject);
+ r.typeVar = r.initVar = r.typeObject;
r.mo.AddMethod(P6how.M_MULTI, name, meth);
r.mo.Revalidate();
r.SetupVTables();
@@ -2749,7 +2749,7 @@ class CrossSource: ItemSource {
r.mo.FillRole(new STable[0], null);
r.typeObject = r.initObject = new P6opaque(r);
- r.typeVar = r.initVar = Kernel.NewROScalar(r.typeObject);
+ r.typeVar = r.initVar = r.typeObject;
r.mo.AddMethod(0, name, meth.Fetch());
r.mo.AddMethod(P6how.V_PRIVATE, name, meth.Fetch());
r.mo.AddAttribute(name, P6how.A_PUBLIC, null, stype);
@@ -2800,8 +2800,7 @@ public class Blackhole : Variable {
public static Variable sig_params(P6any sig) {
VarDeque items = new VarDeque();
- foreach (Parameter p in ((Signature)sig).parms)
- items.Push(Kernel.NewROScalar(p));
+ items.PushN(((Signature)sig).parms);
return Kernel.NewRWListVar(MakeList(items, new VarDeque()));
}
@@ -2820,9 +2819,9 @@ public class Blackhole : Variable {
if (si.param != null && si.param[0] is P6any[]) {
foreach (P6any cand in (P6any[])si.param[0])
if (cand != null)
- items.Push(Kernel.NewROScalar(cand));
+ items.Push(cand);
} else {
- items.Push(Kernel.NewROScalar(sub));
+ items.Push(sub);
}
return Kernel.NewRWListVar(MakeList(items, new VarDeque()));
}
View
55 lib/CORE.setting
@@ -227,8 +227,8 @@ sub substr-rw(\str, $start, $len?, $repl?) is Niecza::builtin('substr3', 3, 3) i
# not actually inlined but needed for constant i
sub sqrt($x) is pure { Q:CgOp { (sqrt {$x}) } }
-sub caller() { Q:CgOp { (ns (frame_caller (frame_caller (callframe)))) } }
-sub callframe() { Q:CgOp { (ns (frame_caller (callframe))) } }
+sub caller() { Q:CgOp { (frame_caller (frame_caller (callframe))) } }
+sub callframe() { Q:CgOp { (frame_caller (callframe)) } }
sub Niecza::toggle_mono_trace() { Q:CgOp { (prog (raise (s "SIGUSR2")) {0}) } }
@@ -277,9 +277,9 @@ my class Mu {
method so() { ?self }
method not() { !self }
method bless($, *%_) { Q:CgOp { (default_new (@ {self}) (unbox varhash (@ {%_}))) } }
- method CREATE() { Q:CgOp { (ns (obj_newblank (obj_llhow (@ {self})))) } }
+ method CREATE() { Q:CgOp { (obj_newblank (obj_llhow (@ {self}))) } }
method new(*%_) { Q:CgOp { (default_new (@ {self}) (unbox varhash (@ {%_}))) } }
- method clone(*%_) { Q:CgOp { (ns (repr_clone (@ {self}) (unbox varhash (@ {%_})))) } }
+ method clone(*%_) { Q:CgOp { (repr_clone (@ {self}) (unbox varhash (@ {%_}))) } }
method dispatch:<::>(|) { Q:CgOp { (dispatch_fromtype) } }
method immutable() { !defined(self) }
multi method WHICH() { ObjAt.new(str => '', ref => self) }
@@ -1012,12 +1012,12 @@ my class Code does Callable {
has $!outer;
has $!info;
- method outer() { Q:CgOp { (ns (getslot Code $!outer frame (@ {self}))) } }
+ method outer() { Q:CgOp { (getslot Code $!outer frame (@ {self})) } }
method perl() { defined(self) ?? '{ ... }' !! self.typename }
method accepts_capture($cap) { Q:CgOp { (code_accepts_capture (@ {self}) (@ {$cap})) } }
method candidates(Code:D:) { Q:CgOp { (code_candidates (@ {self})) } }
- method signature(Code:D:) { Q:CgOp { (ns (code_signature (@ {self}))) } }
+ method signature(Code:D:) { Q:CgOp { (code_signature (@ {self})) } }
method candidates_matching(|cap) { grep *.accepts_capture(cap), self.candidates }
method name(Code:D:) { Q:CgOp { (box Str (code_name (@ {self}))) } }
}
@@ -1082,7 +1082,7 @@ my class Parameter {
method named(Parameter:D:) { ? (self.named_names && !self.positional) }
method named_names(Parameter:D:) { Q:CgOp { (param_names (@ {self})) } }
method type(Parameter:D:) { Q:CgOp { (param_type (@ {self})) } }
- method sub_signature(Parameter:D:) { Q:CgOp { (ns (param_subsig (@ {self}))) } }
+ method sub_signature(Parameter:D:) { Q:CgOp { (param_subsig (@ {self})) } }
method optional(Parameter:D:) { ?( self.flags +& (HASDEFAULT +| OPTIONAL) ) }
method positional(Parameter:D:) { ?( self.flags +& POSITIONAL ) }
## method value_constraint_list() { !!! }
@@ -1375,14 +1375,14 @@ my class CallFrame {
(letn c (frame_caller (cast frame (@ {self})))
(ternary
(!= (l c) (null frame))
- (ns (l c))
+ (l c)
{Any}))
} }
method dynamic-caller() { Q:CgOp {
(letn c (frame_dyn_caller (cast frame (@ {self})))
(ternary
(!= (l c) (null frame))
- (ns (l c))
+ (l c)
{Any}))
} }
@@ -1522,7 +1522,7 @@ my class Parcel is Cool does Positional {
Q:CgOp {
(letn n (obj_newblank (obj_llhow (@ {Capture})))
(setslot Capture $!positionals (l n) (unbox fvarlist (@ {self})))
- (ns (l n)))
+ (l n))
}
}
@@ -1593,7 +1593,7 @@ my class List is Cool does Positional {
(letn n (obj_newblank (obj_llhow (@ {Capture})))
(setslot Capture $!positionals (l n) (vvarlist_to_fvarlist
(getslot List $!items vvarlist (@ {self.eager}))))
- (ns (l n)))
+ (l n))
}
}
@@ -1831,7 +1831,7 @@ my class Hash does Associative {
(setslot Capture $!positionals (l n) (fvarlist_new))
(setslot Capture $!named (l n) (varhash_dup
(unbox varhash (@ {self}))))
- (ns (l n)))
+ (l n))
}
}
@@ -1915,7 +1915,7 @@ my class Enum is Cool {
(setslot Capture $!named (l n) (l d))
(varhash_setindex (obj_getstr {$!key})
(l d) {$!value})
- (ns (l n)))
+ (l n))
}
}
@@ -2344,10 +2344,10 @@ my class Junction is Mu {
(letn ob (obj_newblank (obj_llhow (@ {self})))
(setslot Junction $!kind_ (l ob) (@ {$kind}))
(setslot Junction $!eigenstates_ (l ob) (@ {$eigenstates}))
- (ns (l ob)))
+ (l ob))
} }
- method !kind() { Q:CgOp { (ns (getslot Junction $!kind_ obj (@ {self}))) } }
- method !eigenstates() { Q:CgOp { (ns (getslot Junction $!eigenstates_ obj (@ {self}))) } }
+ method !kind() { Q:CgOp { (getslot Junction $!kind_ obj (@ {self})) } }
+ method !eigenstates() { Q:CgOp { (getslot Junction $!eigenstates_ obj (@ {self})) } }
my @kinds = <all none one any>;
method perl() {
@@ -2691,7 +2691,7 @@ my grammar Cursor is Any does Associative does Positional {
Q:CgOp { (cursor_O (cast cursor (@ {self}))
(unbox varhash (@ {%hash}))) }
}
- method ast () { Q:CgOp { (ns (cursor_ast (cast cursor (@ {self})))) } }
+ method ast () { Q:CgOp { (cursor_ast (cast cursor (@ {self}))) } }
method list () { @( self.Capture ) }
method flat () { @( self.Capture ) }
method iterator () { self.flat.iterator }
@@ -2699,17 +2699,16 @@ my grammar Cursor is Any does Associative does Positional {
method Capture () { Q:CgOp {
(letn cap (obj_newblank (obj_llhow (@ {Capture})))
(cursor_unpackcaps (cast cursor (@ {self})) (l cap))
- (newscalar (l cap)))
+ (l cap))
} }
- method cursor_start($str, $act?) { Q:CgOp { (ns (cursor_start
- (@ {self}) (obj_getstr {$str}) (@ {$act}))) } }
+ method cursor_start($str, $act?) { Q:CgOp { (cursor_start
+ (@ {self}) (obj_getstr {$str}) (@ {$act})) } }
method pos() { Q:CgOp { (box Num (cast num (cursor_pos
(cast cursor (@ {self}))))) } }
method to() { Q:CgOp { (box Num (cast num (cursor_pos
(cast cursor (@ {self}))))) } }
- method cursor($np) { Q:CgOp { (ns (cursor_butpos
- (cast cursor (@ {self}))
- (cast int (obj_getnum {$np})))) } }
+ method cursor($np) { Q:CgOp { (cursor_butpos
+ (cast cursor (@ {self})) (cast int (obj_getnum {$np}))) } }
method orig() { Q:CgOp {
(box Str (cursor_backing (cast cursor (@ {self})))) } }
method ws() { Q:CgOp { (cursor_dows (cast cursor (@ {self}))) } }
@@ -2754,7 +2753,7 @@ my class Match is Cool does Associative does Positional {
method Capture () { Q:CgOp {
(letn cap (obj_newblank (obj_llhow (@ {Capture})))
(cursor_unpackcaps (cast cursor (@ {self})) (l cap))
- (newscalar (l cap)))
+ (l cap))
} }
method new($) { die "Match.new NYI" }
method from() { Q:CgOp { (box Num (cast num (cursor_from
@@ -2764,7 +2763,7 @@ my class Match is Cool does Associative does Positional {
method pos() { self.to }
method orig() { Q:CgOp {
(box Str (cursor_backing (cast cursor (@ {self})))) } }
- method ast () { Q:CgOp { (ns (cursor_ast (cast cursor (@ {self})))) } }
+ method ast () { Q:CgOp { (cursor_ast (cast cursor (@ {self}))) } }
method chars() { defined(self) ?? $.to - $.from !! 0 }
method perl() {
self // nextsame;
@@ -2773,8 +2772,8 @@ my class Match is Cool does Associative does Positional {
"#<match from({ self.from }) to({ self.to }) text({ self }) pos({ @pos.perl }) named({ %(self).perl })>"
}
- method CURSOR() { Q:CgOp { (ns (cursor_unmatch (cast cursor (@ {self})))) } }
- method cursor() { Q:CgOp { (ns (cursor_unmatch (cast cursor (@ {self})))) } }
+ method CURSOR() { Q:CgOp { (cursor_unmatch (cast cursor (@ {self}))) } }
+ method cursor() { Q:CgOp { (cursor_unmatch (cast cursor (@ {self}))) } }
method reduced() { Q:CgOp { (box Str (cursor_reduced (cast cursor (@ {self})))) } }
method synthetic(:$cursor!, :$method = "", :$captures, :$from!, :$to!) {
my $*match;
@@ -2857,7 +2856,7 @@ my class Regex is Method {
(l csr (cursor_butpos (l incr) (l ix)))
(l ix (+ (l ix) (i 1)))
(l iter (vvarlist_new_singleton
- (subcall (@ {self}) (ns (l csr)))))
+ (subcall (@ {self}) (l csr))))
(ternary (iter_hasflat (l iter))
(letn val (vvarlist_shift (l iter))
(set_status (s $/) (l val))
View
17 lib/CodeGen.cs
@@ -375,8 +375,6 @@ sealed class Tokens {
typeof(Kernel).GetMethod("GetGlobal");
public static readonly MethodInfo Kernel_BindGlobal =
typeof(Kernel).GetMethod("BindGlobal");
- public static readonly MethodInfo Kernel_NewROScalar =
- typeof(Kernel).GetMethod("NewROScalar");
public static readonly MethodInfo Kernel_NewRWListVar =
typeof(Kernel).GetMethod("NewRWListVar");
public static readonly MethodInfo Kernel_NewRWScalar =
@@ -2303,10 +2301,9 @@ class NamProcessor {
if (brk) cands.Add(CpsOp.Null(Tokens.P6any));
}
- return CpsOp.MethodCall(Tokens.Kernel_NewROScalar,
- CpsOp.MethodCall(Tokens.Kernel_MakeDispatcher,
+ return CpsOp.MethodCall(Tokens.Kernel_MakeDispatcher,
CpsOp.StringLiteral(prefix), proto,
- CpsOp.NewArray(Tokens.P6any, cands.ToArray())));
+ CpsOp.NewArray(Tokens.P6any, cands.ToArray()));
}
object[] InlineCall(SubInfo tgt, object[] zyg) {
@@ -2617,8 +2614,7 @@ class NamProcessor {
return CpsOp.CpsCall(Tokens.Variable, Tokens.Kernel_SFH,
CpsOp.IntLiteral(SubInfo.ON_DIE),
CpsOp.Null(Tokens.Frame), CpsOp.IntLiteral(-1),
- CpsOp.Null(Tokens.String), CpsOp.MethodCall(
- Tokens.Kernel_NewROScalar, th.Scan(zyg[1])));
+ CpsOp.Null(Tokens.String), th.Scan(zyg[1]));
}
};
handlers["control"] = delegate(NamProcessor th, object[] zyg) {
@@ -2910,7 +2906,6 @@ class NamProcessor {
thandlers["set_status"] = delegate(CpsOp[] z) {
return CpsOp.MethodCall( Tokens.Kernel_SetStatus,
CpsOp.CallFrame(), z[0], z[1]); };
- thandlers["newscalar"] = Methody(null, Tokens.Kernel_NewROScalar);
thandlers["newrwlistvar"] = Methody(null, Tokens.Kernel_NewRWListVar);
thandlers["iter_hasflat"] = delegate(CpsOp[] z) {
return CpsOp.MethodCall(Tokens.Kernel_IterHasFlat,
@@ -3322,7 +3317,7 @@ class NamProcessor {
if (kv.Value is LISub) {
LISub ls = (LISub) kv.Value;
frags.Add(a(j("scopedlex"), j(kv.Key),
- a(j("newscalar"), a(j("_makesub"), ls.def))));
+ a(j("_makesub"), ls.def)));
} else if (kv.Value is LISimple) {
LISimple ls = kv.Value as LISimple;
int f = ls.flags;
@@ -4230,7 +4225,7 @@ public class DowncallReceiver : CallReceiver {
if (item is STable)
vitm = ((STable)item).typeVar;
else if (item is SubInfo)
- vitm = Kernel.NewROScalar(((SubInfo)item).protosub);
+ vitm = ((SubInfo)item).protosub;
else if (item == null)
vitm = null;
else
@@ -4377,7 +4372,7 @@ public class DowncallReceiver : CallReceiver {
if (nst.typeObject == null) // AnyMO.typeObject is set up early
nst.typeObject = new P6opaque(nst, 0);
((P6opaque)nst.typeObject).slots = null;
- nst.typeVar = Kernel.NewROScalar(nst.typeObject);
+ nst.typeVar = nst.typeObject;
if (ru.name == "CORE" && name == "Nil") {
// this anomalous type object is iterable
View
45 lib/Cursor.cs
@@ -22,11 +22,10 @@ public sealed class GState {
P6any actions_p = actions.Fetch();
Variable[] pos;
if (actions_p.mo.mro_methods.TryGetValue(name, out m)) {
- pos = new Variable[] { actions, Kernel.NewROScalar(match) };
+ pos = new Variable[] { actions, match };
} else if (actions_p.mo.mro_methods.TryGetValue("FALLBACK", out m)) {
pos = new Variable[] { actions,
- Kernel.BoxAnyMO<string>(name, Kernel.StrMO),
- Kernel.NewROScalar(match) };
+ Kernel.BoxAnyMO<string>(name, Kernel.StrMO), match };
} else {
return th;
}
@@ -35,8 +34,7 @@ public sealed class GState {
}
public GState(string orig, P6any actions) {
- this.actions = (actions == Kernel.AnyP) ? null :
- Kernel.NewROScalar(actions);
+ this.actions = (actions == Kernel.AnyP) ? null : actions;
orig_s = orig;
orig_a = orig.ToCharArray();
highwater = (orig_a.Length < 100 || !Cursor.HwTrace) ?
@@ -219,7 +217,7 @@ public sealed class RxFrame: IFreeze {
if (Cursor.Trace)
Console.WriteLine("Failing {0}@{1} after no matches",
name, from);
- return Kernel.Take(th, Kernel.NewROScalar(Kernel.EMPTYP));
+ return Kernel.Take(th, Kernel.EMPTYP);
} else {
if (Cursor.Trace)
Console.WriteLine("Failing {0}@{1} after some matches",
@@ -290,7 +288,7 @@ public sealed class RxFrame: IFreeze {
SetPos(child.pos);
if (names != null)
- PushCapture(names, Kernel.NewROScalar(child));
+ PushCapture(names, child);
}
public const int IC_ZERO_WIDTH = 1;
@@ -565,8 +563,7 @@ public sealed class RxFrame: IFreeze {
pad.cursor_class = st.ns.klass;
while (Kernel.IterHasFlat(iter, true)) {
- Variable svar = iter.Shift();
- P6any sobj = svar.Fetch();
+ P6any sobj = iter.Shift().Fetch();
retry:
if (sobj.Isa(Kernel.RegexMO)) {
@@ -579,11 +576,10 @@ public sealed class RxFrame: IFreeze {
pad.info_stack.Clear();
} else if (eval) {
sobj = Builtins.compile_bind_regex(th,
- sobj.mo.mro_raw_Str.Get(svar));
- svar = Kernel.NewROScalar(sobj);
+ sobj.mo.mro_raw_Str.Get(sobj));
goto retry;
} else {
- string str = sobj.mo.mro_raw_Str.Get(svar);
+ string str = sobj.mo.mro_raw_Str.Get(sobj);
toks.Add(str);
lads.Add(new LADStr(str));
}
@@ -700,16 +696,15 @@ public sealed class RxFrame: IFreeze {
}
public Variable StringCapture() {
- return Kernel.NewROScalar(
- new Cursor(global, st.ns.klass, st.ns.quant, st.pos,
- null, null, "ANON"));
+ return new Cursor(global, st.ns.klass, st.ns.quant, st.pos,
+ null, null, "ANON");
}
public Cursor MakeCursor() {
return new Cursor(global, st.ns.klass, this, st.ns, bt, st.pos, st.captures);
}
- public Variable MakeCursorV() { return Kernel.NewROScalar(MakeCursor()); }
+ public Variable MakeCursorV() { return MakeCursor(); }
Cursor _matchObj;
public Frame MakeMatch(Frame th) {
@@ -739,7 +734,7 @@ public sealed class RxFrame: IFreeze {
public Frame FinalEnd(Frame th) {
if (st.pos > global.highwater)
global.IncHighwater(st.pos);
- th.caller.resultSlot = Kernel.NewROScalar(_matchObj);
+ th.caller.resultSlot = _matchObj;
return th.Return();
}
public Frame End(Frame th) {
@@ -750,18 +745,18 @@ public sealed class RxFrame: IFreeze {
if (st.pos > global.highwater)
global.IncHighwater(st.pos);
if ((flags & RETURN_ONE) != 0) {
- return Kernel.Take(th, Kernel.NewROScalar(m));
+ return Kernel.Take(th, m);
} else {
th.MarkSharedChain();
flags |= RETURN_ONE;
VarDeque ks = new VarDeque();
- ks.Push(Kernel.NewROScalar(m));
+ ks.Push(m);
th.coro_return = th;
P6opaque it = new P6opaque(Kernel.GatherIteratorMO);
it.slots[0 /*frame*/] = Kernel.NewMuScalar(th);
it.slots[1 /*reify*/] = Kernel.NewMuScalar(Kernel.AnyP);
VarDeque iss = new VarDeque();
- iss.Push(Kernel.NewROScalar(it));
+ iss.Push(it);
P6opaque lst = new P6opaque(Kernel.ListMO);
lst.slots[0 /*items*/] = ks;
lst.slots[1 /*rest*/ ] = iss;
@@ -839,7 +834,7 @@ public Cursor(P6any proto, string text, P6any actions)
}
Cursor r = new Cursor(parent.global, parent.save_klass, from, to, ci,
null, method);
- th.info.dylex["$*match"].Set(th, Kernel.NewROScalar(r));
+ th.info.dylex["$*match"].Set(th, r);
if (method == "") {
return th;
} else {
@@ -873,7 +868,7 @@ public Cursor(P6any proto, string text, P6any actions)
P6opaque l = new P6opaque(Kernel.ListMO);
l.slots[0 /*items*/] = caps;
l.slots[1 /*rest*/ ] = new VarDeque();
- return Kernel.NewROScalar(l);
+ return l;
} else {
return caps.Count() != 0 ? caps[0] : Kernel.AnyMO.typeVar;
}
@@ -951,7 +946,7 @@ public Cursor(P6any proto, string text, P6any actions)
nw.captures = new CapInfo(nw.captures, new string[] { kv.Key },
Kernel.NewMuScalar(kv.Value.Fetch()));
- return Kernel.NewROScalar(nw);
+ return nw;
}
public Variable SimpleWS() {
@@ -969,7 +964,7 @@ public Cursor(P6any proto, string text, P6any actions)
while (p != l && Char.IsWhiteSpace(backing, p)) { p++; }
if (Trace)
Console.WriteLine("* match <ws> at {0} to {1}", pos, p);
- return Kernel.NewROScalar(At(p));
+ return At(p);
}
}
}
@@ -2169,7 +2164,7 @@ public class Lexer {
th.rx.PushBacktrack(2);
th.ip = 3;
al = (Variable[])(((Variable[])th.lex3).Clone());
- al[0] = Kernel.NewROScalar(th.rx.MakeCursor());
+ al[0] = th.rx.MakeCursor();
return (((P6any[])th.lex1)[th.lexi0++]).Invoke(th, al,
(VarHash)th.lex4);
case 3:
View
10 lib/JSYNC.cs
@@ -35,7 +35,7 @@ public class JsyncWriter {
} else if (obj.Isa(Kernel.StrMO)) {
WriteStr(true, Kernel.UnboxAny<string>(obj));
} else if (obj.Isa(Kernel.NumMO) || obj.Isa(Kernel.IntMO) || obj.Isa(Kernel.RatMO) || obj.Isa(Kernel.FatRatMO)) {
- WriteNum(obj.mo.mro_raw_Numeric.Get(Kernel.NewROScalar(obj)));
+ WriteNum(obj.mo.mro_raw_Numeric.Get(obj));
} else {
WriteGeneral(obj);
}
@@ -49,7 +49,7 @@ public class JsyncWriter {
void WriteArray(P6any obj) {
int a = nextanchor++;
anchors[obj] = a;
- VarDeque iter = obj.mo.mro_raw_iterator.Get(Kernel.NewROScalar(obj));
+ VarDeque iter = obj.mo.mro_raw_iterator.Get(obj);
o.AppendFormat("[\"&A{0}\"", a);
contUsed = true;
@@ -345,7 +345,7 @@ public class JsyncReader {
}
SkipWhite(true);
SkipChar(']');
- return Kernel.NewROScalar(Builtins.MakeArray(q, new VarDeque()));
+ return Builtins.MakeArray(q, new VarDeque());
} else if (look == '{') {
VarHash q = new VarHash();
int ct = 0;
@@ -804,7 +804,7 @@ public class JsonWriter {
} else if (obj.Isa(Kernel.BoolMO)) {
o.Append(Kernel.UnboxAny<int>(obj) != 0 ? "true" : "false");
} else if (obj.Isa(Kernel.NumMO) || obj.Isa(Kernel.IntMO) || obj.Isa(Kernel.RatMO) || obj.Isa(Kernel.FatRatMO)) {
- o.Append(Utils.N2S(obj.mo.mro_raw_Numeric.Get(Kernel.NewROScalar(obj))));
+ o.Append(Utils.N2S(obj.mo.mro_raw_Numeric.Get(obj)));
} else if (obj.Isa(Kernel.StrMO)) {
o.Append('"');
JsyncWriter.AddStringContents(o, Kernel.UnboxAny<string>(obj));
@@ -831,7 +831,7 @@ public class JsonWriter {
}
o.Append('}');
} else if (def && obj.Isa(Kernel.ListMO)) {
- VarDeque iter = obj.mo.mro_raw_iterator.Get(Kernel.NewROScalar(obj));
+ VarDeque iter = obj.mo.mro_raw_iterator.Get(obj);
o.Append('[');
while (Kernel.IterHasFlat(iter, true)) {
if (comma) o.Append(',');
View
80 lib/Kernel.cs
@@ -335,7 +335,7 @@ public sealed class TiedVariable: Variable {
vh.Do(this);
}
Kernel.RunInferior(store.Invoke(Kernel.GetInferiorRoot(),
- new [] { Kernel.AnyMO.typeVar, Kernel.NewROScalar(v) }, null));
+ new [] { Kernel.AnyMO.typeVar, v }, null));
}
public override void Vivify() {
@@ -1271,7 +1271,7 @@ public class LISub : LIVarish {
public LISub(SubInfo def) { this.def = def; }
internal LISub(int index, SubInfo def) { this.index = index; this.def = def; }
public override void Init(Frame f) {
- Set(f, Kernel.NewROScalar(def.protosub));
+ Set(f, def.protosub);
}
internal override void DoFreeze(FreezeBuffer fb) {
fb.Byte((byte)LexSerCode.Sub);
@@ -1380,8 +1380,7 @@ public class LIDispatch : LIVarish {
f = f.outer;
}
- Set(into, Kernel.NewROScalar(Kernel.MakeDispatcher(name, proto,
- cands.ToArray())));
+ Set(into, Kernel.MakeDispatcher(name, proto, cands.ToArray()));
}
}
@@ -1844,7 +1843,7 @@ public class UsedInScopeInfo {
th.named[(string)th.lex2] = (Variable)th.lex9;
else
th.pos[th.lexi0] = (Variable)th.lex9;
- th.caller.resultSlot = Kernel.NewROScalar(nj);
+ th.caller.resultSlot = nj;
return th.Return();
}
@@ -2438,7 +2437,7 @@ public class Frame: P6any, IFixup {
}
nw.SetSlot(Kernel.CaptureMO, "$!positionals", poscap);
nw.SetSlot(Kernel.CaptureMO, "$!named", named);
- return Kernel.NewROScalar(nw);
+ return nw;
}
public string DescribeArgs() {
@@ -2687,7 +2686,7 @@ public class Frame: P6any, IFixup {
}
nw.SetSlot(Kernel.CaptureMO, "$!positionals", spos);
nw.SetSlot(Kernel.CaptureMO, "$!named", snamed);
- src = Kernel.NewROScalar(nw);
+ src = nw;
named = null; namedc = null; posc = pos.Length;
goto gotit;
}
@@ -3070,7 +3069,7 @@ class InvokeCallMethod : InvokeHandler {
Variable[] pos, VarHash named) {
Variable[] np = new Variable[pos.Length + 1];
Array.Copy(pos, 0, np, 1, pos.Length);
- np[0] = Kernel.NewROScalar(th);
+ np[0] = th;
return th.InvokeMethod(caller, "postcircumfix:<( )>", np, named);
}
}
@@ -3197,28 +3196,27 @@ class CtxBoolUnbox : ContextHandler<bool> {
class CtxReturnSelf : ContextHandler<Variable> {
public override Variable Get(Variable obj) {
- return Kernel.NewROScalar(obj.Fetch());
+ return obj.Fetch();
}
}
class CtxReturnSelfList : ContextHandler<Variable> {
public override Variable Get(Variable obj) {
- if (obj.Mode == Variable.LIST) return obj;
+ if (obj.List) return obj;
return Kernel.NewRWListVar(obj.Fetch());
}
}
class CtxReturnSelfItem : ContextHandler<Variable> {
public override Variable Get(Variable obj) {
- if (obj.Mode != Variable.LIST) return obj;
- return Kernel.NewROScalar(obj.Fetch());
+ if (!obj.List) return obj;
+ return obj.Fetch();
}
}
class CtxAnyList : ContextHandler<Variable> {
public override Variable Get(Variable obj) {
- VarDeque itr = new VarDeque(obj.Mode == Variable.LIST ?
- Kernel.NewROScalar(obj.Fetch()) : obj);
+ VarDeque itr = new VarDeque(obj.List ? obj.Fetch() : obj);
P6any l = new P6opaque(Kernel.ListMO);
Kernel.IterToList(l, itr);
return Kernel.NewRWListVar(l);
@@ -3328,7 +3326,7 @@ class CtxContainerize : ContextHandler<Variable> {
this.inner = inner;
}
public override Variable Get(Variable obj) {
- return Kernel.NewROScalar(inner.Get(obj));
+ return inner.Get(obj);
}
}
@@ -3438,7 +3436,7 @@ class IxHashLISTSTORE : IndexHandler {
} else {
if (!Kernel.IterHasFlat(iter, true))
throw new NieczaException("Unmatched key in Hash.LISTSTORE");
- into[elt.mo.mro_raw_Str.Get(Kernel.NewROScalar(elt))] =
+ into[elt.mo.mro_raw_Str.Get(elt)] =
Kernel.NewMuScalar(iter.Shift().Fetch());
}
first = false;
@@ -4180,7 +4178,7 @@ public struct StashCursor {
st.who = who;
st.typeObject = st.initObject = new P6opaque(st, 0);
((P6opaque)st.typeObject).slots = null;
- st.typeVar = st.initVar = Kernel.NewROScalar(st.typeObject);
+ st.typeVar = st.initVar = st.typeObject;
st.mo.type = P6how.PACKAGE;
st.mo.rtype = "package";
// XXX should be PackageHOW
@@ -4338,13 +4336,12 @@ public struct StashCursor {
else if (type == WHO) {
// only special type is PARENT, maybe not even that?
P6any who = (P6any) p1;
- Variable whov = Kernel.NewROScalar(who);
Variable keyv = Kernel.BoxAnyMO(key, Kernel.StrMO);
if (bind_to != null) {
- v = who.mo.mro_bind_key.Bind(whov, keyv, bind_to);
+ v = who.mo.mro_bind_key.Bind(who, keyv, bind_to);
return;
}
- v = who.mo.mro_at_key.Get(whov, keyv);
+ v = who.mo.mro_at_key.Get(who, keyv);
if (final) return;
@@ -4353,7 +4350,7 @@ public struct StashCursor {
throw new NieczaException("Autovivification only implemented for normal-type stashes");
string name = Kernel.UnboxAny<string>(who);
P6any new_who = Kernel.BoxRaw(name + "::" + key, Kernel.StashMO);
- who.mo.mro_bind_key.Bind(whov, keyv,
+ who.mo.mro_bind_key.Bind(who, keyv,
MakePackage(key, new_who));
sc.p1 = new_who;
return;
@@ -4516,10 +4513,10 @@ public struct StashCursor {
if (bind_to != null)
throw new NieczaException("Cannot bind to a stash");
if (sc.type == WHO)
- return Kernel.NewROScalar((P6any) sc.p1);
+ return (P6any) sc.p1;
P6any who = Kernel.BoxRaw(sc, Kernel.PseudoStashMO);
who.SetSlot(Kernel.PseudoStashMO, "$!name", Kernel.BoxAnyMO(last, Kernel.StrMO));
- return Kernel.NewROScalar(who);
+ return who;
}
if (bind_to != null) {
bool list = key != "" && (key[0] == '@' || key[0] == '%');
@@ -4631,7 +4628,7 @@ class PhaserList {
public void RunNew() { if (state) Run(); }
public void Add(SubInfo what, bool immed) {
- to_run.Push(Kernel.NewROScalar(what.protosub));
+ to_run.Push(what.protosub);
if (immed && state)
Run();
}
@@ -4683,7 +4680,7 @@ public class Kernel {
Frame r = c.coro_return;
c.coro_return = c;
- r.LexicalBind("$*nextframe", NewROScalar(th));
+ r.LexicalBind("$*nextframe", th);
r.resultSlot = payload;
th.resultSlot = payload;
return r;
@@ -4748,7 +4745,7 @@ public class Kernel {
P6opaque nj = new P6opaque(Kernel.JunctionMO);
nj.slots[0] = th.lex2;
nj.slots[1] = Kernel.BoxRaw(dst, Kernel.ParcelMO);
- th.caller.resultSlot = Kernel.NewROScalar(nj);
+ th.caller.resultSlot = nj;
return th.Return();
}
@@ -5172,7 +5169,7 @@ internal class MMDCandidate : MultiCandidate {
else
return ((int) (object) v) != 0 ? TrueV : FalseV;
}
- return NewROScalar(new BoxObject<T>(v, ((P6opaque)proto).mo));
+ return new BoxObject<T>(v, ((P6opaque)proto).mo);
}
public static void SetBox<T>(P6any obj, T v) {
@@ -5186,7 +5183,7 @@ internal class MMDCandidate : MultiCandidate {
else
return ((int) (object) v) != 0 ? TrueV : FalseV;
}
- return NewROScalar(new BoxObject<T>(v, proto));
+ return new BoxObject<T>(v, proto);
}
public static P6any BoxRaw<T>(T v, STable proto) {
@@ -5243,7 +5240,6 @@ internal class MMDCandidate : MultiCandidate {
return new SimpleVariable(t, null, t.initObject);
}
- public static Variable NewROScalar(P6any o) { return o; }
public static Variable NewRWListVar(P6any container) {
return new SimpleVariable(container);
}
@@ -5332,7 +5328,7 @@ internal class MMDCandidate : MultiCandidate {
}
again: if (i == prog.Length) {
- th.caller.resultSlot = NewROScalar(n);
+ th.caller.resultSlot = n;
return th.Return();
}
@@ -5358,12 +5354,11 @@ internal class MMDCandidate : MultiCandidate {
}
}
- return init.Invoke(th, new Variable[] { NewROScalar(n) },
- build_args);
+ return init.Invoke(th, new Variable[] { n }, build_args);
} else {
P6any init = prog[i].init;
th.lexi0 = i;
- return init.Invoke(th, new [] { NewROScalar(n) }, null);
+ return init.Invoke(th, new [] { n }, null);
}
value: vx = (Variable) th.resultSlot;
@@ -5443,7 +5438,7 @@ internal class MMDCandidate : MultiCandidate {
th.coro_return = th;
thunk.slots[0] = NewMuScalar(th);
thunk.slots[1] = NewMuScalar(AnyP);
- outq.Push(NewROScalar(thunk));
+ outq.Push(thunk);
return outq;
}
outq.Push(inq0v);
@@ -5456,7 +5451,7 @@ internal class MMDCandidate : MultiCandidate {
if (IterHasFlat(inq, true)) {
return Take(th, inq.Shift());
} else {
- return Take(th, NewROScalar(Kernel.EMPTYP));
+ return Take(th, Kernel.EMPTYP);
}
}
@@ -5723,7 +5718,7 @@ internal class MMDCandidate : MultiCandidate {
r.mo.role_typecheck_list.Add(r);
r.mo.local_roles = prole.mo.local_roles;
r.typeObject = r.initObject = new P6opaque(r);
- r.typeVar = r.initVar = NewROScalar(r.typeObject);
+ r.typeVar = r.initVar = r.typeObject;
foreach (var mi in prole.mo.lmethods)
r.mo.lmethods.Add(mi);
foreach (var ai in prole.mo.local_attr)
@@ -5759,7 +5754,7 @@ internal class MMDCandidate : MultiCandidate {
r.mo.rtype = "role";
r.mo.role_typecheck_list = arg.mo.role_typecheck_list;
r.typeObject = r.initObject = new P6opaque(r);
- r.typeVar = r.initVar = NewROScalar(r.typeObject);
+ r.typeVar = r.initVar = r.typeObject;
// Hack - reseat role to this closure-clone of methods
foreach (var mi in arg.mo.lmethods) {
var nmi = mi;
@@ -5891,7 +5886,7 @@ internal class MMDCandidate : MultiCandidate {
n.how = BoxAny<STable>(n, b.how).Fetch();
n.typeObject = n.initObject = new P6opaque(n);
- n.typeVar = n.initVar = NewROScalar(n.typeObject);
+ n.typeVar = n.initVar = n.typeObject;
((P6opaque)n.typeObject).slots = null;
n.mo.superclasses.Add(b);
@@ -6168,8 +6163,8 @@ class LastFrameNode {
new CtxBoolUnbox());
BoolMO.FillProtoClass(IntMO, new string[] { "$!index" },
new STable[] { BoolMO });
- TrueV = NewROScalar(BoxRaw<int>(1, BoolMO));
- FalseV = NewROScalar(BoxRaw<int>(0, BoolMO));
+ TrueV = BoxRaw<int>(1, BoolMO);
+ FalseV = BoxRaw<int>(0, BoolMO);
FalseV.Fetch().SetSlot(BoolMO, "$!index", BoxAnyMO(0, IntMO));
TrueV.Fetch().SetSlot(BoolMO, "$!index", BoxAnyMO(1, IntMO));
@@ -6322,7 +6317,7 @@ class LastFrameNode {
fr.MarkSharedChain();
dob.slots[0] = fr;
dob.slots[1] = name;
- return NewROScalar(dob);
+ return dob;
}
private static string DescribeException(int type, Frame tgt,
@@ -6420,8 +6415,7 @@ class LastFrameNode {
new Variable[] {
Builtins.MakeParcel(Builtins.MakeInt(type),
Kernel.BoxAnyMO(name, Kernel.StrMO),
- tgt == null ? Kernel.AnyMO.typeVar :
- Kernel.NewROScalar(tgt))
+ tgt == null ? Kernel.AnyMO.typeVar : tgt)
}, null, false, null);
Variable np = Kernel.RunInferior(nfr);
if (np.Fetch().mo.mro_raw_Bool.Get(np)) {
View
9 lib/NieczaCLR.cs
@@ -267,7 +267,7 @@ sealed class PropertyProxy : Variable {
object[] argv_ = argv;
Array.Resize(ref argv_, argv.Length + 1);
if (!CLRWrapperProvider.CoerceArgument(out argv_[argv.Length],
- prop.PropertyType, Kernel.NewROScalar(v)))
+ prop.PropertyType, v))
throw new NieczaException("Unable to coerce value of type " + v.mo.name + " for " + prop.Name); // could also be a range problem
mi.Invoke(obj, argv_);
}
@@ -297,8 +297,7 @@ sealed class FieldProxy : Variable {
if (field.IsInitOnly || field.IsLiteral)
throw new NieczaException("Field " + field.Name + " is read-only");
object clr;
- if (!CLRWrapperProvider.CoerceArgument(out clr, field.FieldType,
- Kernel.NewROScalar(v)))
+ if (!CLRWrapperProvider.CoerceArgument(out clr, field.FieldType, v))
throw new NieczaException("Unable to coerce value of type " + v.mo.name + " for " + field.Name); // could also be a range problem
field.SetValue(obj, clr);
}
@@ -759,7 +758,7 @@ public class CLRWrapperProvider {
m.Invalidate();
m.box_type = t;
m.typeObject = m.initObject = new BoxObject<object>(null, m);
- m.typeVar = m.initVar = Kernel.NewROScalar(m.typeObject);
+ m.typeVar = m.initVar = m.typeObject;
if (CLROpts.Debug) {
Console.WriteLine("--- Created box for {0} ---", m.name);
foreach (var o in m.mo.type_list)
@@ -801,7 +800,7 @@ public class CLRWrapperProvider {
if (cty == typeof(Variable))
return (Variable)ret;
if (cty == typeof(P6any))
- return Kernel.NewROScalar((P6any)ret);
+ return ((P6any)ret);
if (ret == null)
return Kernel.AnyMO.typeVar;
View
7 lib/ObjModel.cs
@@ -107,8 +107,7 @@ public abstract class IndexHandler : ReflectObj {
public abstract Variable Get(Variable obj, Variable key);
public virtual P6any GetWHO(P6any obj, string key) {
- Variable r = Get(Kernel.NewROScalar(obj),
- Kernel.BoxAnyMO(key, Kernel.StrMO));
+ Variable r = Get(obj, Kernel.BoxAnyMO(key, Kernel.StrMO));
return r.Fetch().mo.who;
}
@@ -523,7 +522,7 @@ public class DispatchSet {
if (subsetFilter == null)
subsetFilter = Kernel.RunInferior(subsetWhereThunk.Invoke(
Kernel.GetInferiorRoot(), Variable.None, null));
- return Kernel.ACCEPTS(Kernel.NewROScalar(obj), subsetFilter);
+ return Kernel.ACCEPTS(obj, subsetFilter);
}
if (type == CURRIED_ROLE) {
foreach (STable cand in obj.mo.mo.type_list) {
@@ -721,7 +720,7 @@ public class DispatchSet {
n.how = Kernel.BoxAnyMO<STable>(n, Kernel.ClassHOWMO).Fetch();
n.typeObject = n.initObject = new P6opaque(n);
- n.typeVar = n.initVar = Kernel.NewROScalar(n.typeObject);
+ n.typeVar = n.initVar = n.typeObject;
((P6opaque)n.typeObject).slots = null;
n.mo.local_roles.Add(stable);
View
2  src/CgOp.pm6
@@ -38,7 +38,7 @@ CgOp._register_ops: <
iter_flatten iter_hasarg iter_hasflat iter_to_list label labelid
letn letscope letvar llhow_name ltm_push_alts mrl_count mrl_index
ncgoto newblankrwscalar newboundvar newrwlistvar newrwscalar
- newscalar newtypedscalar newvarrayvar newvhashvar newvnewarrayvar
+ newtypedscalar newvarrayvar newvhashvar newvnewarrayvar
newvnewhashvar newvsubvar note null num_to_string obj_asbool
obj_asdef obj_asnum obj_asstr obj_at_key obj_at_pos obj_delete_key
obj_does obj_exists_key obj_getbool obj_getdef obj_getnum
View
1  src/NieczaActions.pm6
@@ -2502,7 +2502,6 @@ method cgexp:quote ($/) {
my %opshortcut = (
'@' => [ 'fetch' ],
'l' => [ 'letvar' ],
- 'ns' => [ 'newscalar' ],
'nsw' => [ 'newrwscalar' ],
's' => [ 'str' ],
'i' => [ 'int' ],
View
17 src/Op.pm6
@@ -203,14 +203,14 @@ class CallMethod is CallLike {
$.receiver.cgop($body), self.argblock($body));
} elsif $meta eq '^' {
$CgOp.let($.receiver.cgop($body), -> $r {
- $CgOp.methodcall($CgOp.newscalar($CgOp.how($CgOp.fetch($r))),
+ $CgOp.methodcall($CgOp.how($CgOp.fetch($r)),
$name, $r, self.argblock($body))});
} elsif $meta eq '?' {
# TODO maybe use a lower-level check
$CgOp.let($.receiver.cgop($body), -> $r { $CgOp.let($name, -> $n {
$CgOp.ternary(
- $CgOp.obj_getbool($CgOp.methodcall($CgOp.newscalar($CgOp.how(
- $CgOp.fetch($r))), "can", $r, $CgOp.box('Str',$n))),
+ $CgOp.obj_getbool($CgOp.methodcall($CgOp.how(
+ $CgOp.fetch($r)), "can", $r, $CgOp.box('Str',$n))),
$CgOp.methodcall($r, $n, self.argblock($body)),
$CgOp.scopedlex('Nil'))})});
} elsif $meta eq '::(' {
@@ -319,7 +319,7 @@ class Interrogative is Op {
when "WHAT" { $c = $CgOp.obj_what($c); }
default { die "Invalid interrogative $_"; }
}
- $CgOp.newscalar($c);
+ $c
}
}
@@ -777,15 +777,14 @@ class Gather is Op {
# construct a List from the iterator
$CgOp.subcall($CgOp.fetch($CgOp.corelex('&_gather')),
- $CgOp.newscalar($CgOp.startgather(
- $CgOp.fetch($CgOp.scopedlex($.var)))));
+ $CgOp.startgather($CgOp.fetch($CgOp.scopedlex($.var))));
}
}
class MakeCursor is Op {
method code($ ) {
$CgOp.prog(
- $CgOp.scopedlex('$/', $CgOp.newscalar($CgOp.rxcall('MakeCursor'))),
+ $CgOp.scopedlex('$/', $CgOp.rxcall('MakeCursor')),
$CgOp.scopedlex('$/'));
}
}
@@ -856,7 +855,7 @@ class GetBlock is Op {
$body .= outer;
$op = $CgOp.frame_outer($op);
}
- $CgOp.newscalar($CgOp.frame_sub($op));
+ $CgOp.frame_sub($op);
}
}
@@ -973,7 +972,7 @@ class LexicalBind is Op {
class ROify is Op {
has $.child;
method zyg() { $.child }
- method code($body) { $CgOp.newscalar($CgOp.fetch($!child.cgop($body))) }
+ method code($body) { $CgOp.fetch($!child.cgop($body)) }
}
class Op::StateDecl is Op {
View
5 src/RxOp.pm6
@@ -406,9 +406,8 @@ class Tilde is RxOp {
push @code, $CgOp.rxbprim('Exact', $CgOp.str($!closer));
push @code, $CgOp.goto($pass);
push @code, $CgOp.label($fail);
- push @code, $CgOp.sink($CgOp.methodcall($CgOp.newscalar(
- $CgOp.rxcall("MakeCursor")), 'FAILGOAL',
- $CgOp.string_var($!closer), $CgOp.string_var($!dba),
+ push @code, $CgOp.sink($CgOp.methodcall($CgOp.rxcall("MakeCursor"),
+ 'FAILGOAL', $CgOp.string_var($!closer), $CgOp.string_var($!dba),
$CgOp.box('Num', $CgOp.cast('num', $CgOp.rxgetquant))));
push @code, $CgOp.label($pass);
push @code, $CgOp.rxcall("PopGoal", $CgOp.callframe);
Please sign in to comment.
Something went wrong with that request. Please try again.