php.runtime.Memory.isImmutable()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(2.7k)|赞(0)|评价(0)|浏览(124)

本文整理了Java中php.runtime.Memory.isImmutable()方法的一些代码示例,展示了Memory.isImmutable()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Memory.isImmutable()方法的具体详情如下:
包路径:php.runtime.Memory
类名称:Memory
方法名:isImmutable

Memory.isImmutable介绍

暂无

代码示例

代码示例来源:origin: jphp-group/jphp

public static void checkYieldReference(Memory memory, Environment env, TraceInfo trace) {
    if (memory.isImmutable()) {
      env.error(trace, ErrorType.E_NOTICE, Messages.ERR_YIELD_NOT_REFERENCE.fetch());
    }
  }
}

代码示例来源:origin: jphp-group/jphp

public static void checkReturnReference(Memory memory, Environment env, TraceInfo trace) {
  if (memory.isImmutable() && !memory.isUndefined()) {
    env.warning(trace, Messages.ERR_RETURN_NOT_REFERENCE.fetch());
  }
}

代码示例来源:origin: jphp-group/jphp

@Test
public void testValueOf(){
  Memory memory = ReferenceMemory.valueOf(Memory.TRUE);
  Assert.assertTrue(memory instanceof ReferenceMemory);
  Assert.assertFalse(memory.isImmutable());
  Assert.assertNotNull(memory.toImmutable());
  Assert.assertTrue(memory.toImmutable().isImmutable());
  Assert.assertTrue(memory.toImmutable() instanceof TrueMemory);
}

代码示例来源:origin: jphp-group/jphp

@Test
public void testFalse(){
  Memory memory = Memory.FALSE;
  Assert.assertEquals(Memory.Type.BOOL, memory.type);
  Assert.assertFalse(memory.toBoolean());
  Assert.assertEquals("", memory.toString());
  Assert.assertEquals(0.0, memory.toDouble(), 0.000001);
  Assert.assertEquals(0, memory.toLong());
  Assert.assertNotNull(memory.toNumeric());
  Assert.assertEquals(Memory.Type.INT, memory.toNumeric().type);
  Assert.assertEquals(0, memory.toNumeric().toLong());
  Assert.assertEquals(memory, memory.toImmutable());
  Assert.assertTrue(memory.isImmutable());
}

代码示例来源:origin: jphp-group/jphp

@Test
public void testTrue(){
  Memory memory = Memory.TRUE;
  Assert.assertEquals(Memory.Type.BOOL, memory.type);
  Assert.assertTrue(memory.toBoolean());
  Assert.assertEquals("1", memory.toString());
  Assert.assertEquals(1.0, memory.toDouble(), 0.000001);
  Assert.assertEquals(1, memory.toLong());
  Assert.assertNotNull(memory.toNumeric());
  Assert.assertEquals(Memory.Type.INT, memory.toNumeric().type);
  Assert.assertEquals(1, memory.toNumeric().toLong());
  Assert.assertEquals(memory, memory.toImmutable());
  Assert.assertTrue(memory.isImmutable());
}

代码示例来源:origin: jphp-group/jphp

@Test
public void testNull(){
  Memory memory = Memory.NULL;
  Assert.assertEquals(Memory.Type.NULL, memory.type);
  Assert.assertFalse(memory.toBoolean());
  Assert.assertEquals("", memory.toString());
  Assert.assertEquals(0.0, memory.toDouble(), 0.000001);
  Assert.assertEquals(0, memory.toLong());
  Assert.assertNotNull(memory.toNumeric());
  Assert.assertEquals(Memory.Type.INT, memory.toNumeric().type);
  Assert.assertEquals(0, memory.toNumeric().toLong());
  Assert.assertEquals(memory, memory.toImmutable());
  Assert.assertTrue(memory.isImmutable());
}

相关文章