Fanx.Fcode.FTypeRef.isNullable C# (CSharp) Méthode

isNullable() public méthode

Is this a nullable type.
public isNullable ( ) : bool
Résultat bool
        public bool isNullable()
        {
            return (mask & NULLABLE) != 0;
        }

Usage Example

Exemple #1
0
        private void loadType(FTypeRef tref)
        {
            string podName  = tref.podName;
              string typeName = tref.typeName;

              // if pod is "sys", then we can perform a shortcut and use
              // one of the predefined fields in Sys
              if (!tref.isGenericInstance() && podName == "sys")
              {
            PERWAPI.Field field = emitter.findField("Fan.Sys.Sys", typeName + "Type", "Fan.Sys.Type");
            code.FieldInst(FieldOp.ldsfld, field);
            if (tref.isNullable()) typeToNullable();
            return;
              }

              // lazy allocate my parent's type literal map: sig -> fieldName
              if (parent.typeLiteralFields == null) parent.typeLiteralFields = new Hashtable();
              Hashtable map = parent.typeLiteralFields;

              // types are lazy loaded and then cached in a private static field called
              // type$count which will get generated by FTypeEmit (we keep track of signature
              // to fieldname in the typeConstFields map)
              string sig = tref.signature;
              string fieldName = (string)map[sig];
              if (fieldName == null)
              {
            fieldName = "type$" + map.Count;
            map[sig] = fieldName;
              }
              //int fieldRef = emit.field(parent.className + "." + fieldName + ":Lfan/sys/Type;");

              //code.op2(GETSTATIC, fieldRef);
              //code.op(DUP);
              //int nonNull = code.branch(IFNONNULL);
              //code.op(POP);
              //code.op2(LDC_W, emit.strConst(sig));
              //code.op(ICONST_1);
              //code.op2(INVOKESTATIC, parent.sysFindType());
              //code.op(DUP);
              //code.op2(PUTSTATIC, fieldRef);
              //code.mark(nonNull);

              //emitter.EmitField(string name, string type, FieldAttr attr)
              //PERWAPI.Field field = emitter.EmitField("Fan.Sys.Sys", typeName + "Type", "Fan.Sys.Type");
              //code.FieldInst(FieldOp.ldsfld, field);

              // TODO - store in static field (all that crap above this)
              code.ldstr(sig);
              Method method = emitter.findMethod("Fan.Sys.Type", "find",
            new string[] { "System.String" }, "Fan.Sys.Type");
              code.MethInst(MethodOp.call, method);
        }