Emits a JSDoc @typedef for a struct.
334659
def _generate_struct(self, struct_type, extra_parameters=None, nameOverride=None):
        
        extra_parameters = extra_parameters if extra_parameters is not None else []
        self._emit_jsdoc_header(struct_type.doc)
        self.emit(
            ' * @typedef {Object} %s' % (
                nameOverride if nameOverride else fmt_type_name(struct_type)
            )
        )

        # Some structs can explicitly list their subtypes. These structs
        # have a .tag field that indicate which subtype they are.
        if struct_type.is_member_of_enumerated_subtypes_tree():
            if struct_type.has_enumerated_subtypes():
                # This struct is the parent to multiple subtypes.
                # Determine all of the possible values of the .tag
                # property.
                tag_values = []
                for tags, _ in struct_type.get_all_subtypes_with_tags():
                    for tag in tags:
                        tag_values.append('"%s"' % tag)

                jsdoc_tag_union = fmt_jsdoc_union(tag_values)
                txt = '@property {%s} .tag - Tag identifying the subtype variant.' % \
                    jsdoc_tag_union
                self.emit_wrapped_text(txt)
            else:
                # This struct is a particular subtype. Find the applicable
                # .tag value from the parent type, which may be an
                # arbitrary number of steps up the inheritance hierarchy.
                parent = struct_type.parent_type
                while not parent.has_enumerated_subtypes():
                    parent = parent.parent_type
                # parent now contains the closest parent type in the
                # inheritance hierarchy that has enumerated subtypes.
                # Determine which subtype this is.
                for subtype in parent.get_enumerated_subtypes():
                    if subtype.data_type == struct_type:
                        txt = '@property {\'%s\'} [.tag] - Tag identifying ' \
                            'this subtype variant. This field is only ' \
                            'present when needed to discriminate ' \
                            'between multiple possible subtypes.' % \
                            subtype.name
                        self.emit_wrapped_text(txt)
                        break

        for param_name, param_type, param_docstring in extra_parameters:
            param_docstring = ' - %s' % param_docstring if param_docstring else ''
            self.emit_wrapped_text(
                '@property {%s} %s%s' % (
                    param_type,
                    param_name,
                    param_docstring,
                ),
                prefix=' * ',
            )

        # NOTE: JSDoc @typedef does not support inheritance. Using @class would be inappropriate,
        # since these are not nominal types backed by a constructor. Thus, we emit all_fields,
        # which includes fields on parent types.
        for field in struct_type.all_fields:
            field_doc = ' - ' + field.doc if field.doc else ''
            field_type, nullable, _ = unwrap(field.data_type)
            field_js_type = fmt_type(field_type)
            # Translate nullable types into optional properties.
            field_name = '[' + field.name + ']' if nullable else field.name
            self.emit_wrapped_text(
                '@property {%s} %s%s' % (
                    field_js_type,
                    field_name,
                    self.process_doc(field_doc, self._docf),
                ),
                prefix=' * ',
            )

        self.emit(' */')
116126
def type_stmt(self, stmt, p_elem, pset):
        
        typedef = stmt.i_typedef
        if typedef and not stmt.i_is_derived: # just ref
            uname, dic = self.unique_def_name(typedef)
            if uname not in dic:
                self.install_def(uname, typedef, dic)
            SchemaNode("ref", p_elem).set_attr("name", uname)
            defst = typedef.search_one("default")
            if defst:
                dic[uname].default = defst.arg
                occur = 1
            else:
                occur = dic[uname].occur
            if occur > 0: self.propagate_occur(p_elem, occur)
            return
        chain = [stmt]
        tdefault = None
        while typedef:
            type_ = typedef.search_one("type")
            chain.insert(0, type_)
            if tdefault is None:
                tdef = typedef.search_one("default")
                if tdef:
                    tdefault = tdef.arg
            typedef = type_.i_typedef
        if tdefault and p_elem.occur == 0:
            p_elem.default = tdefault
            self.propagate_occur(p_elem, 1)
        self.type_handler[chain[0].arg](chain, p_elem)
992330
def _generate_struct_class(self, ns, data_type):
        # type: (ApiNamespace, Struct) -> None
        """"""
        self.emit(self._class_declaration_for_type(ns, data_type))
        with self.indent():
            self._generate_struct_class_init(ns, data_type)
            self._generate_struct_class_properties(ns, data_type)
            self._generate_struct_or_union_class_custom_annotations()

        self._generate_validator_for(data_type)
        self.emit()
42843
public static TypeDef typeGenericOf(TypeDef base, TypeParamDef... parameters) {
        return new TypeDefBuilder(base)
                .withParameters(parameters)
                .build();
    }
272095
FunctionTypeBuilder inferKind(@Nullable JSDocInfo info) {
    if (info != null) {
      if (!NodeUtil.isMethodDeclaration(errorRoot)) {
        isConstructor = info.isConstructor();
        isInterface = info.isInterface();
        isRecord = info.usesImplicitMatch();
        makesStructs = info.makesStructs();
        makesDicts = info.makesDicts();
      }
      isAbstract = info.isAbstract();
    }
    if (isClass) {
      // If a CLASS literal has not been explicitly declared an interface, it's a constructor.
      // If it's not expicitly @dict or @unrestricted then it's @struct.
      isConstructor = !isInterface;
      makesStructs = info == null || (!makesDicts && !info.makesUnrestricted());
    }

    if (makesStructs && !(isConstructor || isInterface)) {
      reportWarning(CONSTRUCTOR_REQUIRED, "@struct", formatFnName());
    } else if (makesDicts && !isConstructor) {
      reportWarning(CONSTRUCTOR_REQUIRED, "@dict", formatFnName());
    }
    return this;
  }
281404
function jsdocCommand( jsdoc ) {
	var cmd = [];
	cmd.unshift( jsdoc.options );
	if ( jsdoc.tutorials.length > 0 ) {
		cmd.push( "-u " + path.resolve( jsdoc.tutorials ) );
	}
	cmd.push( "-d " + path.resolve( jsdoc.dest ) );
	cmd.push( "-t " + path.resolve( jsdoc.template ) );
	cmd.push( "-c " + path.resolve( jsdoc.config ) );
	sys.each( jsdoc.src, function ( src ) {
		cmd.push( path.resolve( src ) );
	} );
	cmd.unshift( path.resolve( "./node_modules/jsdoc/jsdoc" ) );
	cmd.unshift( "node" );

	return cmd.join( " " );
}
307230
public JsCodeBuilder append(JsDoc jsDoc) {
    jsDoc.collectRequires(requireCollector);
    return appendLine(jsDoc.toString());
  }
1346345
def typedef_callable_handle(tokens):
    """"""
    if len(tokens) == 1:
        return '_coconut.typing.Callable[..., ' + tokens[0] + ']'
    elif len(tokens) == 2:
        return '_coconut.typing.Callable[[' + tokens[0] + '], ' + tokens[1] + ']'
    else:
        raise CoconutInternalException("invalid Callable typedef tokens", tokens)
519309
def __registerStructStr():
    """"""
    structs = (LockerInfo, DevCommandInfo, AttributeDimension, CommandInfo,
               DeviceInfo, DeviceAttributeConfig, AttributeInfo, AttributeAlarmInfo,
               ChangeEventInfo, PeriodicEventInfo, ArchiveEventInfo,
               AttributeEventInfo, AttributeInfoEx, PipeInfo,
               DeviceAttribute, DeviceAttributeHistory, DeviceData, DeviceDataHistory,
               DevicePipe, DbDatum, DbDevInfo, DbDevImportInfo, DbDevExportInfo,
               DbServerInfo, GroupReply, GroupAttrReply, GroupCmdReply,
               DevError, EventData, AttrConfEventData, DataReadyEventData,
               AttributeConfig, AttributeConfig_2, AttributeConfig_3,
               AttributeConfig_5,
               ChangeEventProp, PeriodicEventProp, ArchiveEventProp,
               AttributeAlarm, EventProperties)

    for struct in structs:
        struct.__str__ = __str__Struct
        struct.__repr__ = __repr__Struct

    # special case for TimeVal: it already has a str representation itself
    TimeVal.__repr__ = __repr__Struct

    # special case for DevFailed: we want a better pretty print
    # also, because it is an Exception it has the message attribute which
    # generates a Deprecation warning in python 2.6
    DevFailed.__str__ = __str__DevFailed
    DevFailed.__repr__ = __repr__DevFailed

    DevError.__str__ = __str__DevError
348623
def _generate_struct_cstor_signature_default(self, struct):
        """"""
        if not self._struct_has_defaults(struct):
            return

        fields_no_default = [
            f for f in struct.all_fields
            if not f.has_default and not is_nullable_type(f.data_type)
        ]
        signature = fmt_signature(
            func=self._cstor_name_from_fields(fields_no_default),
            args=self._cstor_args_from_fields(
                fields_no_default, is_struct=True),
            return_type='instancetype')

        self.emit(comment_prefix)
        description_str = (
            'Convenience constructor (exposes only non-nullable '
            'instance variables with no default value).')
        self.emit_wrapped_text(description_str, prefix=comment_prefix)
        self.emit(comment_prefix)
        for field in fields_no_default:
            doc = self.process_doc(field.doc,
                                   self._docf) if field.doc else undocumented
            self.emit_wrapped_text(
                '@param {} {}'.format(fmt_var(field.name), doc),
                prefix=comment_prefix)
        if struct.all_fields:
            self.emit(comment_prefix)
        self.emit_wrapped_text(
            '@return An initialized instance.', prefix=comment_prefix)
        self.emit(comment_prefix)

        self.emit('{};'.format(signature))
        self.emit()
784882
function(node) {
				var lhs = node.left,
					affectsProto;

				if (lhs.type !== "MemberExpression" || lhs.object.type !== "MemberExpression") {
					return;
				}

				affectsProto = lhs.object.computed ?
					lhs.object.property.type === "Literal" && lhs.object.property.value === "prototype" :
					lhs.object.property.name === "prototype";

				if (!affectsProto) {
					return;
				}

				modifiedBuiltins.forEach(function(builtin) {
					if (lhs.object.object.name === builtin) {
						context.report(node, ProblemMessages.noExtendNative, {builtin: builtin});
					}
				});
			}
663806
def format_struct(struct_def):
    '''
    '''
    text = []
    text.append('cdef struct {}:'.format(struct_def.tp_name))
    text.extend(
        ['{}{}'.format(tab, format_variable(var))
         for var in struct_def.members]
    )

    for name in struct_def.names:
        text.append('ctypedef {} {}'.format(struct_def.tp_name, name))

    return text
314017
def deftypes(self):
    """"""
    for f in self.body:
        if (hasattr(f, '_ctype')
                and (f._ctype._storage == Storages.TYPEDEF
                    or (f._name == '' and isinstance(f._ctype, ComposedType)))):
            yield f
651192
function (beanDef) {
                var typeDef = this.__baseTypes[beanDef.$type];
                this.$assert(298, typeDef != null);
                beanDef[this._MD_BUILTIN] = true;
                beanDef[this._MD_BASETYPE] = typeDef;
                var beanName = beanDef[this._MD_TYPENAME] = [this._BASE_TYPES_PACKAGE, typeDef.typeName].join('.');
                this.__processedBeans[beanName] = beanDef;
                return typeDef;
            }
884939
private static Object jsConstructor(Context cx, Scriptable scope,
                                        Object[] args)
    {
        if (args.length == 0)
            return new NativeArray(0);

        // Only use 1 arg as first element for version 1.2; for
        // any other version (including 1.3) follow ECMA and use it as
        // a length.
        if (cx.getLanguageVersion() == Context.VERSION_1_2) {
            return new NativeArray(args);
        }
        Object arg0 = args[0];
        if (args.length > 1 || !(arg0 instanceof Number)) {
            return new NativeArray(args);
        }
        long len = ScriptRuntime.toUint32(arg0);
        if (len != ((Number)arg0).doubleValue()) {
            String msg = ScriptRuntime.getMessage0("msg.arraylength.bad");
            throw ScriptRuntime.constructError("RangeError", msg);
        }
        return new NativeArray(len);
    }
259109
def typed_assign_stmt_handle(self, tokens):
        """"""
        if len(tokens) == 2:
            if self.target_info >= (3, 6):
                return tokens[0] + ": " + self.wrap_typedef(tokens[1])
            else:
                return tokens[0] + " = None" + self.wrap_comment(" type: " + tokens[1])
        elif len(tokens) == 3:
            if self.target_info >= (3, 6):
                return tokens[0] + ": " + self.wrap_typedef(tokens[1]) + " = " + tokens[2]
            else:
                return tokens[0] + " = " + tokens[2] + self.wrap_comment(" type: " + tokens[1])
        else:
            raise CoconutInternalException("invalid variable type annotation tokens", tokens)
1199283
function emit_destructor_code($out, PHP_ParserGenerator_Symbol $sp, &$lineno)
//    FILE *out;
//    struct symbol *sp;
//    struct lemon *lemp;
//    int *lineno;
    {
        $cp = 0;
        
        $linecnt = 0;
        if ($sp->type == PHP_ParserGenerator_Symbol::TERMINAL) {
            $cp = $this->tokendest;
            if ($cp === 0) {
                return;
            }
            $this->tplt_linedir($out, $this->tokendestln, $this->filename);
            fwrite($out, "{");
        } elseif ($sp->destructor) {
            $cp = $sp->destructor;
            $this->tplt_linedir($out, $sp->destructorln, $this->filename);
            fwrite($out, "{");
        } elseif ($this->vardest) {
            $cp = $this->vardest;
            if ($cp === 0) {
                return;
            }
            $this->tplt_linedir($out, $this->vardestln, $this->filename);
            fwrite($out, "{");
        } else {
            throw new Exception('emit_destructor'); /* Cannot happen */
        }
        for ($i = 0; $i < strlen($cp); $i++) {
            if ($cp[$i]=='$' && $cp[$i + 1]=='$' ) {
                fprintf($out, "(yypminor->yy%d)", $sp->dtnum);
                $i++;
                continue;
            }
            if ($cp[$i] == "\n") {
                $linecnt++;
            }
            fwrite($out, $cp[$i]);
        }
        $lineno += 3 + $linecnt;
        fwrite($out, "}\n");
        $this->tplt_linedir($out, $lineno, $this->outname);
    }