def _lift_method_decl(location, *args): if len(args) >= 2 and isinstance(args[1], six.string_types): return_type, args = args[0], args[1:] if isinstance(return_type, Reference): if len(return_type.name) != 1: raise ParseError("type: \"%s\" is not a valid type" % return_type.name, location) return_type = normalise_type(return_type.name[0]) # dont want references else: return_type = None # void id = args[0] return Method(id, return_type, list(args[1:]), location)
def _lift_method_decl(location, *args): if len(args) >= 2 and isinstance(args[1], six.string_types): return_type, args = args[0], args[1:] if isinstance(return_type, Reference): if len(return_type.name) != 1: raise ParseError("type: \"%s\" is not a valid type" % return_type.name, location) return_type = normalise_type(return_type.name[0]) # dont want references else: return_type = None # void id = args[0] return Method(id, return_type, list(args[1:]), location)
def _lift_method_scalar_parameter(location, *args): if len(args) == 2: # Default the direction to 'in' if not specified. direction = 'in' type, id = args else: assert len(args) == 3 direction, type, id = args if isinstance(type, Reference): if len(type.name) != 1: raise ParseError("type: \"%s\" is not a valid type" % type.name, location) type = normalise_type(type.name[0]) return Parameter(id, direction, type, location=location)
def _lift_method_scalar_parameter(location, *args): if len(args) == 2: # Default the direction to 'in' if not specified. direction = 'in' type, id = args else: assert len(args) == 3 direction, type, id = args if isinstance(type, Reference): if len(type.name) != 1: raise ParseError("type: \"%s\" is not a valid type" % type.name, location) type = normalise_type(type.name[0]) return Parameter(id, direction, type, location=location)
def _lift_type(location, type_name): if isinstance(type_name, Reference): return type_name else: return normalise_type(type_name)
def _lift_type(location, type_name): if isinstance(type_name, Reference): return type_name else: return normalise_type(type_name)