コード例 #1
0
 public string stringifyValue(IVMValue value)
 {
     if (value is ExpressionValue exprValue3)
     {
         var result = this.generator.expr(exprValue3.value);
         return(result);
     }
     return(null);
 }
コード例 #2
0
 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);
 }
コード例 #3
0
        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));
        }
コード例 #4
0
 public string escape(IVMValue value)
 {
     if (value is ExpressionValue exprValue && exprValue.value is RegexLiteral regexLit)
     {
         return(JSON.stringify("/" + regexLit.pattern.replace(new RegExp("/"), "\\/") + "/"));
     }
コード例 #5
0
 public string escape(IVMValue value)
 {
     if (value is ExpressionValue exprValue && exprValue.value is RegexLiteral regexLit)
     {
         return(JSON.stringify(regexLit.pattern));
     }
コード例 #6
0
 public bool equals(IVMValue other)
 {
     return(false);
 }
コード例 #7
0
 public bool equals(IVMValue other)
 {
     return(other is TypeValue typeValue && TypeHelper.equals(typeValue.type, this.type));
 }
コード例 #8
0
 public bool equals(IVMValue other)
 {
     return(other is ExpressionValue exprValue && exprValue.value == this.value);
 }
コード例 #9
0
 public bool equals(IVMValue other)
 {
     return(other is BooleanValue boolValue && boolValue.value == this.value);
 }
コード例 #10
0
 public bool equals(IVMValue other)
 {
     return(other is NumericValue numValue && numValue.value == this.value);
 }
コード例 #11
0
 public bool equals(IVMValue other)
 {
     return(other is StringValue strValue && strValue.value == this.value);
 }