getProperty method

dynamic getProperty(
  1. dynamic instance
)

读取属性

Implementation

dynamic getProperty(dynamic instance) {
  if (instance == this || instance == _vmclass) {
    //读取静态属性
    if (isExternal) {
      if (externalStaticPropertyReader != null) return externalStaticPropertyReader!();
      throw ('Not found externalStaticPropertyReader: ${_vmclass.identifier}.$identifier');
    } else {
      return (internalStaticPropertyOperator as VmValue).getLogic(); //注意:为了保证能够逻辑处理,此处使用的是逻辑值
    }
  } else {
    //读取实例属性
    if (isExternal) {
      final instanceNative = VmObject.readValue(instance);
      if (externalInstancePropertyReader != null) return externalInstancePropertyReader!(instanceNative);
      throw ('Not found externalInstancePropertyReader: ${_vmclass.identifier}.$identifier');
    } else {
      return (VmObject.readLogic(instance) as VmValue).getProperty(identifier).getLogic(); //注意:为了保证能够逻辑处理,此处使用的是逻辑值
    }
  }
}