Browse files

Harmonize how void works

There is some formatting change, but the meat of the commit can be seen
in Static and BasicLogic. In Static, we change resolveConstruct to
return CVoid.VOID instead of CVoid.TYPE. Then, in sequals, we check
.typeof() not .getClass(). This is an important distinction, because we
want to base the equality on whether or not mscript says it's the same
type, not if java does. Actually, because of this change, the change to
Static isn't strictly necessary, but it is beneficial, since now we
standardize what we are returning.
  • Loading branch information...
LadyCailin committed Nov 9, 2017
1 parent 0ea5ad9 commit 583f7ee0b8c627cf77fd048d0bdef092dc7235bd
@@ -460,7 +460,7 @@ public static Construct resolveConstruct(String val, Target t) throws ConfigRunt
return CNull.NULL;
return CVoid.TYPE;
return CVoid.VOID;
if (INVALID_HEX.matcher(val).matches()) {
throw new CREFormatException("Hex numbers must only contain digits 0-9, and the letters A-F, but \"" + val + "\" was found.", t);
@@ -21,24 +21,7 @@
public static final CVoid VOID = new CVoid(Target.UNKNOWN);
* Constructs a new CVoid object. Generally speaking, this should only be used when creating void values that are
* literally created by user code, all internal code should simply use {@link #VOID}. This method DOES check the
* target however, and if the target is {@link Target#UNKNOWN}, {@link CVoid#VOID} is returned anyways.
* @param t
* @return
public static CVoid GenerateCVoid(Target t) {
if (t == Target.UNKNOWN) {
return VOID;
} else {
return new CVoid(t);
* Private constructor to force usage of {@link #GenerateCVoid(com.laytonsmith.core.constructs.Target)}, which can
* return existing objects.
* Private constructor, because there can only be one
* @param t
@@ -934,7 +934,7 @@ public CBoolean exec(Target t, Environment environment, Construct... args) throw
if (args.length != 2) {
throw new CREFormatException(this.getName() + " expects 2 arguments.", t);
if (args[1].getClass().equals(args[0].getClass())) {
if (args[1].typeof().equals(args[0].typeof())) {
if (args[0] instanceof CString && args[1] instanceof CString) {
// Check for actual string equality, so we don't do type massaging
// for numeric strings. Thus '2' !== '2.0'
Oops, something went wrong.

0 comments on commit 583f7ee

Please sign in to comment.