Example #1
0
def symmetric_binary_op(state, unused_arg):
  # TODO(robertwb): This may not be entirely correct...
  b, a = state.stack.pop(), state.stack.pop()
  if a == b:
    state.stack.append(a)
  elif type(a) == type(b) and isinstance(a, typehints.SequenceTypeConstraint):
    state.stack.append(type(a)(union(element_type(a), element_type(b))))
  else:
    state.stack.append(Any)
Example #2
0
def symmetric_binary_op(state, unused_arg):
    # TODO(robertwb): This may not be entirely correct...
    b, a = state.stack.pop(), state.stack.pop()
    if a == b:
        state.stack.append(a)
    elif type(a) == type(b) and isinstance(a,
                                           typehints.SequenceTypeConstraint):
        state.stack.append(type(a)(union(element_type(a), element_type(b))))
    else:
        state.stack.append(Any)
Example #3
0
def binary_true_divide(state, unused_arg):
  u = union(state.stack.pop(), state.stack.pop)
  if u == int:
    state.stack.append(float)
  else:
    state.stack.append(u)
Example #4
0
def binary_true_divide(state, unused_arg):
    u = union(state.stack.pop(), state.stack.pop)
    if u == int:
        state.stack.append(float)
    else:
        state.stack.append(u)