Defines one required block parameter that may appear last. If type and name is missing the
 default type is "Callable", and the name is "block". If only one
 parameter is given, then that is the name and the type is "Callable".

 @api public
358844
def block_param(*type_and_name)
      case type_and_name.size
      when 0
        type = @all_callables
        name = :block
      when 1
        type = @all_callables
        name = type_and_name[0]
      when 2
        type, name = type_and_name
        type = Puppet::Pops::Types::TypeParser.singleton.parse(type, loader) unless type.is_a?(Puppet::Pops::Types::PAnyType)
      else
        raise ArgumentError, _("block_param accepts max 2 arguments (type, name), got %{size}.") % { size: type_and_name.size }
      end

      unless Puppet::Pops::Types::TypeCalculator.is_kind_of_callable?(type, false)
        raise ArgumentError, _("Expected PCallableType or PVariantType thereof, got %{type_class}") % { type_class: type.class }
      end

      unless name.is_a?(Symbol)
        raise ArgumentError, _("Expected block_param name to be a Symbol, got %{name_class}") % { name_class: name.class }
      end

      if @block_type.nil?
        @block_type = type
        @block_name = name
      else
        raise ArgumentError, _('Attempt to redefine block')
      end
    end
1172193
def p_Callable(p):
    '''
    
    '''
    if len(p) <= 3:
        p[0] = Callable(p[1], None)
    else:
        p[0] = Callable(p[1], p[3])
1121336
function getBlock(type) {
  switch (type) {
    case 'Radio':
    case 'Bool':
      return Radio;

    case 'Checkbox':
      return Checkbox;

    case 'Number':
      return Number;

    case 'Select':
      return Select;

    case 'Image':
      return Image;

    case 'Text':
      return Text;

    case 'Input':
      return Input;

    case 'Textarea':
      return Textarea;

    case 'Data':
      return Data;

    case 'Evaluation':
      return Evaluation;

    case 'FetchOrg':
      return FetchOrg;

    case 'Table':
      return Table;

    case 'Signature':
      return Signature;

    case 'Summary':
      return Summary;

    case 'Sum':
      return Sum;

    case 'Switch':
      return Switch;

    case 'Information':
      return Information;

    default:
      return null;
  }
}
476788
def method_missing name, *values, &block
      return @_items.send( name, *values, &block ) if @_items.respond_to? name     # @_items methods are highest priority

      name = name.to_s.chomp('=')

      if block_given?                                                  # block is a nested configuration
        if block.arity == 1                                            # yield DSL needs deferred block to set parent without binding
          return _set name, Configuration.new_defer_block_for_parent( self, @_options, &block )
        else
          return _set name, Configuration.new( nil, @_options, &block ) # eval DSL can set parent from block binding in initialize
        end
      end

      return _get name if values.empty?                               # just get item
      return _set name, values if values.size > 1                     # set item to multiple values
      return _set name, values.first                                  # set item to single value
    end
850457
private CodeBlock methodCallCodeWithJMapperTypeParameters( CodeBlock.Builder builder, ImmutableList<? extends JMapperType> parameters
    ) {
        return methodCallParametersCode( builder, Lists.transform( parameters, new Function<JMapperType, CodeBlock>() {

            @Override
            public CodeBlock apply( JMapperType jMapperType ) {
                return jMapperType.getInstance();
            }
        } ) );
    }
896041
function (parameters, result) {
                var
                    len,
                    idx,
                    parameter,
                    name,
                    value;
                len = parameters.length;
                for (idx = 0; idx < len; ++idx) {
                    parameter = parameters[idx];
                    name = parameter._name;
                    if (undefined === result[name]) {
                        if (parameter._required) {
                            gpf.Error.paramsRequiredMissing({
                                name: name
                            });
                        }
                        value = parameter._defaultValue;
                        if (undefined !== value) {
                            if (parameter._multiple) {
                                value = [value];
                            }
                            result[name] = value;
                        } else if (parameter._multiple) {
                            result[name] = [];
                        }
                    }
                }
            }
694617
function getCurrentItem(opts: Options, value: Value, block?: Block): ?Block {
    const { document } = value;

    if (!block) {
        if (!value.selection.startKey) return null;
        block = value.startBlock;
    }

    const parent = document.getParent(block.key);
    return parent && parent.type === opts.typeItem ? parent : null;
}
434204
def define(&block)
      if block && block.arity > 0
        block.call @ns
      elsif block
        @ns.instance_eval(&block)
      end
      @ns
    end
1174396
function() {
    var TYPES =
        [[Blockly.Msg.TEXT_PROMPT_TYPE_TEXT, 'TEXT'],
         [Blockly.Msg.TEXT_PROMPT_TYPE_NUMBER, 'NUMBER']];
    // Assign 'this' to a variable for use in the closure below.
    var thisBlock = this;
    this.setHelpUrl(Blockly.Msg.TEXT_PROMPT_HELPURL);
    this.setColour(Blockly.Blocks.texts.HUE);
    var dropdown = new Blockly.FieldDropdown(TYPES, function(newOp) {
      thisBlock.updateType_(newOp);
    });
    this.appendDummyInput()
        .appendField(dropdown, 'TYPE')
        .appendField(this.newQuote_(true))
        .appendField(new Blockly.FieldTextInput(''), 'TEXT')
        .appendField(this.newQuote_(false));
    this.setOutput(true, 'String');
    // Assign 'this' to a variable for use in the tooltip closure below.
    var thisBlock = this;
    this.setTooltip(function() {
      return (thisBlock.getFieldValue('TYPE') == 'TEXT') ?
          Blockly.Msg.TEXT_PROMPT_TOOLTIP_TEXT :
          Blockly.Msg.TEXT_PROMPT_TOOLTIP_NUMBER;
    });
  }
182685
def bound_method(block)
      type = self.type
      arity = block.arity
      arity += 1 if arity >= 0 # Make sure the object gets passed
      arity += 1 if arity == 1 && type == :around # Make sure the block gets passed

      method = lambda { |object, *args| object.instance_exec(*args, &block) }


      # Proxy arity to the original block
      (
      class << method;
        self;
      end).class_eval do
        define_method(:arity) { arity }
      end

      method
    end
68517
def method_missing(m, *args, &block)
      if args.any?
        args = args.first if args.length == 1
        @var << { m.to_sym => args }
        instance_variable_set "@#{m}", args
      else
        instance_variable_get "@#{m}"
      end
    end
644531
private Map<String, Object> bindBlocks(PrepareSignatureContext sig, PrepareInvocationContext inv) {

    if(inv == null) {
      return Collections.emptyMap();
    }
    
    BlockDeclContext allDecl = null;
    BlockDeclContext unnamedDecl = null;
    
    List<NamedOutputBlockContext> namedBlocks = new ArrayList<>(inv.namedBlocks);
    Map<String, Object> blocks = new HashMap<>();
    
    for (BlockDeclContext blockDecl : sig.blockDecls) {
      
      if (blockDecl.flag != null) {
        if (blockDecl.flag.getText().equals("*")) {
          if (allDecl != null) {
            throw new ExecutionException("only a single parameter can be marked with '*'", getLocation(blockDecl));
          }
          allDecl = blockDecl;
        }
        else if (blockDecl.flag.getText().equals("+")) {
          if (unnamedDecl != null) {
            throw new ExecutionException("only a single parameter can be marked with '+'", getLocation(blockDecl));
          }
          unnamedDecl = blockDecl;
        }
        else {
          throw new ExecutionException("unknown block declaration flag", getLocation(blockDecl));
        }
        continue;
      }
      
      //Find the block
      
      ParserRuleContext paramBlock = findAndRemoveBlock(namedBlocks, name(blockDecl));
      
      //Bind the block
      
      BoundParamOutputBlock boundBlock = bindBlock(paramBlock);

      blocks.put(name(blockDecl), boundBlock);
      
    }
    
    //
    // Bind unnamed block (if requested)
    //
    
    if (unnamedDecl != null) {
      
      UnnamedOutputBlockContext unnamedBlock = inv.unnamedBlock;
      
      BoundParamOutputBlock boundUnnamedBlock = bindBlock(unnamedBlock);
      
      blocks.put(unnamedDecl.id.getText(), boundUnnamedBlock);
      
    }
    
    //
    // Bind rest of blocks (if requested)
    //
    
    if (allDecl != null) {
      
      Map<String, Block> otherBlocks = new HashMap<>();
      
      // Add unnamed block if it wasn't bound explicitly
      if (inv.unnamedBlock != null && unnamedDecl == null) {
        
        UnnamedOutputBlockContext unnamedBlock = inv.unnamedBlock;
        
        BoundParamOutputBlock boundUnnamedBlock = new BoundParamOutputBlock(unnamedBlock, mode(unnamedBlock), currentScope);
        
        otherBlocks.put("", boundUnnamedBlock);
      }
      
      // Add all other unbound blocks
      for (NamedOutputBlockContext namedBlock : namedBlocks) {
        
        String blockName = nullToEmpty(name(namedBlock));
        
        BoundParamOutputBlock boundNamedBlock = new BoundParamOutputBlock(namedBlock, mode(namedBlock), currentScope);
        
        otherBlocks.put(blockName, boundNamedBlock);
        
      }

      blocks.put(allDecl.id.getText(), otherBlocks);
      
    }

    return blocks;
  }
1112645
function checkTypeParameter(node) {
            // Grammar Checking
            if (node.expression) {
                grammarErrorOnFirstToken(node.expression, ts.Diagnostics.Type_expected);
            }
            checkSourceElement(node.constraint);
            getConstraintOfTypeParameter(getDeclaredTypeOfTypeParameter(getSymbolOfNode(node)));
            if (produceDiagnostics) {
                checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0);
            }
        }
903615
function custom(name, url, defaults) {
    if (url && urls[name] == undefined) urls[name] = url;
    if (this[name] == undefined) {
      this[name] = function (term, options, callback) {
        // handle "termless" custom methods
        if (typeof term == 'function') {
          callback = term;
          term = '';
        } else if (term.toString() == '[Object object]') {
          callback = options;
          options = term;
          term = '';
        }
        options = normaliseArgs(options, callback);
        setLast(name, term, options);
        // slight hack to support my own shortcuts
        options[name] = options.user = term;
        options.search = encodeURIComponent(term);
        if (options.callback) load(getUrl(name, options), options, options.callback);
        return this;
      };
    }
    // makes my code nicer to read when setting up twitterlib object
    return this[name];
  }
934320
def method_missing(name, *args, &block)
      return attr(name[0..-2], args[0]) if args.size == 1 and name[-1] == '='
    end
1355319
function (definition) {
                var
                    result = new gpf.Parameter(),
                    typeDefaultValue;
                if (definition === gpf.Parameter.VERBOSE
                    || definition.prefix === gpf.Parameter.VERBOSE) {
                    definition = {
                        name: "verbose",
                        description: "Enable verbose mode",
                        type: "boolean",
                        defaultValue: false,
                        prefix: gpf.Parameter.VERBOSE
                    };
                } else if (definition === gpf.Parameter.HELP
                           || definition.prefix === gpf.Parameter.HELP) {
                    definition = {
                        name: "help",
                        description: "Display help",
                        type: "boolean",
                        defaultValue: false,
                        prefix: gpf.Parameter.HELP
                    };
                }
                gpf.json.load(result, definition);
                // name is required
                if (!result._name) {
                    gpf.Error.paramsNameRequired();
                }
                if (!result._multiple) {
                    /**
                     * When multiple is used, the default value will be an array
                     * if not specified.
                     * Otherwise, we get the default value based on the type
                     */
                    typeDefaultValue = this.DEFAULTS[result._type];
                    if (undefined === typeDefaultValue) {
                        gpf.Error.paramsTypeUnknown();
                    }
                    if (result.hasOwnProperty("_defaultValue")) {
                        result._defaultValue =
                            gpf.value(result._defaultValue, typeDefaultValue,
                                result._type);
                    }
                }
                return result;
            }
1309058
protected function detectParameterType()
    {
        $this->setType(null);

        if ($this->defaultValue !== null) {
            $value = $this->defaultValue->getValue();
            if (is_array($value) === true) {
                $this->setType('array');
            }
        }

        return $this;
    }