public string stringifyValue(IVMValue value) { if (value is ExpressionValue exprValue3) { var result = this.generator.expr(exprValue3.value); return(result); } return(null); }
public IVMValue propAccess(IVMValue obj, string propName) { if (obj is ExpressionValue exprValue2 && propName == "type") { return(new TypeValue(exprValue2.value.getType())); } if (obj is TypeValue typeValue2 && propName == "name" && typeValue2.type is ClassType classType) { return(new StringValue(classType.decl.name)); } return(null); }
public IVMValue propAccess(IVMValue obj, string propName) { if (this.context.hooks != null) { var value = this.context.hooks.propAccess(obj, propName); if (value != null) { return(value); } } if (!(obj is ObjectValue)) { throw new Error("You can only access a property of an object!"); } if (!((((ObjectValue)obj)).props.hasKey(propName))) { throw new Error($"Property '{propName}' does not exists on this object!"); } return((((ObjectValue)obj)).props.get(propName)); }
public string escape(IVMValue value) { if (value is ExpressionValue exprValue && exprValue.value is RegexLiteral regexLit) { return(JSON.stringify("/" + regexLit.pattern.replace(new RegExp("/"), "\\/") + "/")); }
public string escape(IVMValue value) { if (value is ExpressionValue exprValue && exprValue.value is RegexLiteral regexLit) { return(JSON.stringify(regexLit.pattern)); }
public bool equals(IVMValue other) { return(false); }
public bool equals(IVMValue other) { return(other is TypeValue typeValue && TypeHelper.equals(typeValue.type, this.type)); }
public bool equals(IVMValue other) { return(other is ExpressionValue exprValue && exprValue.value == this.value); }
public bool equals(IVMValue other) { return(other is BooleanValue boolValue && boolValue.value == this.value); }
public bool equals(IVMValue other) { return(other is NumericValue numValue && numValue.value == this.value); }
public bool equals(IVMValue other) { return(other is StringValue strValue && strValue.value == this.value); }