Skip to content

Commit 97bec17

Browse files
committed
Remove unnecessary sort casting (cont)
1 parent 09269f5 commit 97bec17

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

js-standard-builtin-objects.k

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ rule @FunctionPrototypeApply(Func:Val, ThisArg:Val, ArgArray:Val)
204204
Do Call(Func,ThisArg,@Nil);
205205
} else {
206206
If @IsOid(ArgArray) = true then {
207-
Do Call(Func, ThisArg, @Array2List(ArgArray:>Oid));
207+
Do Call(Func, ThisArg, @Array2List(ArgArray));
208208
} else {
209209
Do @Throw(@TypeError("Function.prototype.apply: argArray is not an object",Func));
210210
}
@@ -319,7 +319,7 @@ rule HasInstance@Default(F:Oid,V:Val)
319319
If @IsOid(V) = true then {
320320
Let $o = Get(F,"prototype");
321321
If @IsOid($o) = true then {
322-
Return @IsPrototypeOf($o, V:>Oid);
322+
Return @IsPrototypeOf($o, V);
323323
} else {
324324
Do @Throw(@TypeError("HasInstance@Default",F));
325325
}
@@ -592,9 +592,9 @@ rule GetOwnProperty@String(O:Oid,P:Var)
592592
=> BEGIN
593593
Let $desc = GetOwnProperty@Default(O,P);
594594
If $desc = Undefined then {
595-
If ToString(ToInteger(P:>Val)) = P then { // TODO:STD: it should have been 'ToString(abs(ToInteger(P)))'
595+
If ToString(ToInteger(P)) = P then { // TODO:STD: it should have been 'ToString(abs(ToInteger(P)))'
596596
Let $str = GetInternalProperty(O,"PrimitiveValue");
597-
Let $index = ToInteger(P:>Val);
597+
Let $index = ToInteger(P);
598598
Let $len = @LengthString($str);
599599
//If $len <=Int $index = true then {
600600
If @OrBool(@Bop(%lt,$index,0), @Bop(%ge,$index,$len)) = true then {
@@ -683,7 +683,7 @@ rule <k> @CreateNumber(V:Number) => @o(!N) ... </k>
683683
684684
// 15.7.4.5 Number.prototype.toFixed (fractionDigits)
685685
686-
syntax KItem /* String */ ::= "@NumberPrototypeToFixed" "(" Oid "," K /* Int */ ")" [seqstrict(2)]
686+
syntax KItem /* String */ ::= "@NumberPrototypeToFixed" "(" K /* Oid */ "," K /* Int */ ")" [seqstrict(1,2)]
687687
rule <k> @NumberPrototypeToFixed(O:Oid,D:Int) => #external("node\x01-p\x01-e\x01new Number(" +String Int2String(I) +String ").toFixed(" +String Int2String(D) +String ")") ... </k>
688688
<obj>
689689
<oid> O </oid>
@@ -1019,7 +1019,7 @@ rule <k> Call(@("NoConstructor"), Undefined, @Cons(O:Val,@Nil)) => Undefined ...
10191019

10201020
rule Call(@("GetInternalProperty"), Undefined, @Cons(O:Val,@Cons(P:Val,@Nil)))
10211021
=> BEGIN
1022-
Let $v = GetInternalProperty(O:>Oid,P:>Var);
1022+
Let $v = GetInternalProperty(O,P);
10231023
If @AndBool(@EqVal(P,"Prototype"), @EqVal($v,@NullOid)) = true then {
10241024
Return @NullVal;
10251025
} else {
@@ -1029,9 +1029,9 @@ rule Call(@("GetInternalProperty"), Undefined, @Cons(O:Val,@Cons(P:Val,@Nil)))
10291029
rule Call(@("SetInternalProperty"), Undefined, @Cons(O:Val,@Cons(P:Val,@Cons(V:Val,@Nil))))
10301030
=> BEGIN
10311031
If @AndBool(@EqVal(P,"Prototype"), @EqVal(V,@NullVal)) = true then {
1032-
Do SetInternalProperty(O:>Oid,P:>Var,@NullOid);
1032+
Do SetInternalProperty(O,P,@NullOid);
10331033
} else {
1034-
Do SetInternalProperty(O:>Oid,P:>Var,V);
1034+
Do SetInternalProperty(O,P,V);
10351035
}
10361036
Return Undefined;
10371037
END
@@ -1044,29 +1044,29 @@ rule Call(@( "ToPropertyDescriptor"), Undefined, @Cons(V:Val,@Nil)) => ToProp
10441044

10451045
rule Call(@("CheckObjectCoercible"), Undefined, @Cons(V:Val,@Nil)) => CheckObjectCoercible(V) ~> Undefined
10461046

1047-
rule Call(@("ObjectGetOwnPropertyNames"), Undefined, @Cons(O:Val,@Nil)) => @ObjectGetOwnPropertyNames(O:>Oid)
1047+
rule Call(@("ObjectGetOwnPropertyNames"), Undefined, @Cons(O:Val,@Nil)) => @ObjectGetOwnPropertyNames(O)
10481048

1049-
rule Call(@("FunctionPrototypeToString"), Undefined, @Cons(Func:Val,@Nil)) => @FunctionPrototypeToString(Func:>Oid)
1049+
rule Call(@("FunctionPrototypeToString"), Undefined, @Cons(Func:Val,@Nil)) => @FunctionPrototypeToString(Func)
10501050
rule Call(@("FunctionPrototypeApply" ), Undefined, @Cons(Func:Val,@Cons(ThisArg:Val,@Cons(ArgArray:Val,@Nil)))) => @FunctionPrototypeApply(Func,ThisArg,ArgArray)
10511051
rule Call(@("FunctionPrototypeBind" ), Undefined, @Cons(Func:Val,@Cons(ThisArg:Val,@Cons(ArgArray:Val,@Nil)))) => @FunctionPrototypeBind(Func,ThisArg,ArgArray)
10521052

1053-
rule Call(@("NumberPrototypeToFixed"), Undefined, @Cons(O:Val,@Cons(V:Val,@Nil))) => @NumberPrototypeToFixed(O:>Oid, ToInteger(V))
1053+
rule Call(@("NumberPrototypeToFixed"), Undefined, @Cons(O:Val,@Cons(V:Val,@Nil))) => @NumberPrototypeToFixed(O, ToInteger(V))
10541054

1055-
rule Call(@("MathFloor"), Undefined, @Cons(N:Val,@Nil)) => @MathFloor(N:>Number)
1056-
rule Call(@("MathPow"), Undefined, @Cons(N1:Val,@Cons(N2:Val,@Nil))) => @MathPow(N1:>Number, N2:>Number)
1057-
rule Call(@("MathSin"), Undefined, @Cons(N:Val,@Nil)) => @MathSin(N:>Number)
1055+
rule Call(@("MathFloor"), Undefined, @Cons(N:Val,@Nil)) => @MathFloor(N)
1056+
rule Call(@("MathPow"), Undefined, @Cons(N1:Val,@Cons(N2:Val,@Nil))) => @MathPow(N1, N2)
1057+
rule Call(@("MathSin"), Undefined, @Cons(N:Val,@Nil)) => @MathSin(N)
10581058

1059-
rule Call(@("DatePrototypeToString"), Undefined, @Cons(O:Val,@Nil)) => @DatePrototypeToString(O:>Oid)
1059+
rule Call(@("DatePrototypeToString"), Undefined, @Cons(O:Val,@Nil)) => @DatePrototypeToString(O)
10601060

10611061
rule Call(@("LengthString"), Undefined, @Cons(S:Val,@Nil)) => lengthString(S:>String)
10621062
rule Call(@("Trim"), Undefined, @Cons(S:Val,@Nil)) => trim(S:>String) // TODO:STD: check the builtin's trim has correct whitespaces and lineterminators.
1063-
rule Call(@("Int2Char"), Undefined, @Cons(I:Val,@Nil)) => @Int2Char(I:>Int)
1064-
rule Call(@("Char2Int"), Undefined, @Cons(S:Val,@Nil)) => @Char2Int(S:>String)
1065-
rule Call(@("CharAt"), Undefined, @Cons(S:Val,@Cons(N:Val,@Nil))) => @CharAt(S:>String, N:>Number)
1066-
rule Call(@("FindString"), Undefined, @Cons(S1:Val,@Cons(S2:Val,@Cons(I:Val,@Nil)))) => @FindString(S1:>String, S2:>String, I:>Int)
1067-
rule Call(@("SubstrString"), Undefined, @Cons(S:Val,@Cons(I1:Val,@Cons(I2:Val,@Nil)))) => @SubstrString(S:>String, I1:>Int, I2:>Int)
1063+
rule Call(@("Int2Char"), Undefined, @Cons(I:Val,@Nil)) => @Int2Char(I)
1064+
rule Call(@("Char2Int"), Undefined, @Cons(S:Val,@Nil)) => @Char2Int(S)
1065+
rule Call(@("CharAt"), Undefined, @Cons(S:Val,@Cons(N:Val,@Nil))) => @CharAt(S, N)
1066+
rule Call(@("FindString"), Undefined, @Cons(S1:Val,@Cons(S2:Val,@Cons(I:Val,@Nil)))) => @FindString(S1, S2, I)
1067+
rule Call(@("SubstrString"), Undefined, @Cons(S:Val,@Cons(I1:Val,@Cons(I2:Val,@Nil)))) => @SubstrString(S, I1, I2)
10681068
1069-
rule Call(@("NumberToString"), Undefined, @Cons(N:Val,@Cons(R:Val,@Nil))) => @NumberToString(N:>Number, R:>Int)
1069+
rule Call(@("NumberToString"), Undefined, @Cons(N:Val,@Cons(R:Val,@Nil))) => @NumberToString(N, R)
10701070
10711071
rule Call(@("Print"), Undefined, @Cons(V:Val,@Nil)) => @PrintNewline(V)
10721072

0 commit comments

Comments
 (0)