public void removeProp(int propType) { PropListItem result = removeProp(propListHead, propType); if (result != propListHead) { propListHead = result; } }
private void stripPropertyTypes(Node behaviorValue) { List<MemberDefinition> properties = PolymerPassStaticUtils.extractProperties( behaviorValue, PolymerClassDefinition.DefinitionType.ObjectLiteral, compiler, /** constructor= */ null); for (MemberDefinition property : properties) { property.name.removeProp(Node.JSDOC_INFO_PROP); } }
public final void removeProp(Prop propType) { PropListItem result = removeProp(propListHead, (byte) propType.ordinal()); if (result != propListHead) { propListHead = result; } }
/** * Remove all JSDocs from properties of a class definition */ private void removePropertyDocs(final Node objLit) { for (MemberDefinition prop : PolymerPassStaticUtils.extractProperties(objLit)) { prop.name.removeProp(Node.JSDOC_INFO_PROP); } }
public void putIntProp(int propType, int value) { removeProp(propType); if (value != 0) { propListHead = createProp(propType, value, propListHead); } }
public void putProp(int propType, Object value) { removeProp(propType); if (value != null) { propListHead = createProp(propType, value, propListHead); } }
private static void stripPropertyTypes(Node behaviorValue) { List<MemberDefinition> properties = PolymerPassStaticUtils.extractProperties(behaviorValue); for (MemberDefinition property : properties) { property.name.removeProp(Node.JSDOC_INFO_PROP); } }
/** Remove all JSDocs from properties of a class definition */ private void removePropertyDocs( final Node objLit, PolymerClassDefinition.DefinitionType defType) { for (MemberDefinition prop : PolymerPassStaticUtils.extractProperties( objLit, defType, compiler, /** constructor= */ null)) { prop.name.removeProp(Node.JSDOC_INFO_PROP); } }
/** * @param item The item to inspect * @param propType The property to look for * @return The replacement list if the property was removed, or 'item' otherwise. */ @Nullable private final PropListItem removeProp(@Nullable PropListItem item, byte propType) { if (item == null) { return null; } else if (item.propType == propType) { return item.next; } else { PropListItem result = removeProp(item.next, propType); if (result != item.next) { return item.chain(result); } else { return item; } } }
public final void putProp(Prop propType, @Nullable Object value) { removeProp(propType); if (value != null) { propListHead = createProp((byte) propType.ordinal(), value, propListHead); } }
public final void putIntProp(Prop propType, int value) { removeProp(propType); if (value != 0) { propListHead = createProp((byte) propType.ordinal(), value, propListHead); } }
private static void removeConstantVarAnnotation(Scope scope, String name) { Var var = scope.getVar(name); Node nameNode = var == null ? null : var.getNameNode(); if (nameNode == null) { return; } if (nameNode.getBooleanProp(Node.IS_CONSTANT_VAR)) { nameNode.removeProp(Node.IS_CONSTANT_VAR); } }
private static void removeConstantVarAnnotation(Scope scope, String name) { Var var = scope.getVar(name); Node nameNode = var == null ? null : var.getNameNode(); if (nameNode == null) return; if (nameNode.getBooleanProp(Node.IS_CONSTANT_VAR)) { nameNode.removeProp(Node.IS_CONSTANT_VAR); } }
/** * @param item The item to inspect * @param propType The property to look for * @return The replacement list if the property was removed, or * 'item' otherwise. */ private PropListItem removeProp(PropListItem item, int propType) { if (item == null) { return null; } else if (item.getType() == propType) { return item.getNext(); } else { PropListItem result = removeProp(item.getNext(), propType); if (result != item.getNext()) { return item.chain(result); } else { return item; } } }
private void maybeAddVisibility(Node n) { Visibility access = (Visibility) n.getProp(Node.ACCESS_MODIFIER); if (access != null) { if (n.isComputedProp()) { compiler.report(JSError.make(n, COMPUTED_PROP_ACCESS_MODIFIER)); } JSDocInfoBuilder memberDoc = JSDocInfoBuilder.maybeCopyFrom(n.getJSDocInfo()); memberDoc.recordVisibility(access); n.setJSDocInfo(memberDoc.build()); n.removeProp(Node.ACCESS_MODIFIER); } }
private void maybeAddVisibility(Node n) { Visibility access = (Visibility) n.getProp(Node.ACCESS_MODIFIER); if (access != null) { if (n.isComputedProp()) { compiler.report(JSError.make(n, COMPUTED_PROP_ACCESS_MODIFIER)); } JSDocInfoBuilder memberDoc = JSDocInfoBuilder.maybeCopyFrom(n.getJSDocInfo()); memberDoc.recordVisibility(access); n.setJSDocInfo(memberDoc.build()); n.removeProp(Node.ACCESS_MODIFIER); } }
private static void addBehaviorSuppressions(Node behaviorValue) { for (Node keyNode : behaviorValue.children()) { if (keyNode.getFirstChild().isFunction()) { keyNode.removeProp(Node.JSDOC_INFO_PROP); JSDocInfoBuilder suppressDoc = new JSDocInfoBuilder(true); suppressDoc.addSuppression("checkTypes"); suppressDoc.addSuppression("globalThis"); keyNode.setJSDocInfo(suppressDoc.build()); } } suppressDefaultValues(behaviorValue); } }
private void addBehaviorSuppressions(Node behaviorValue) { for (Node keyNode : behaviorValue.children()) { if (keyNode.getFirstChild().isFunction()) { keyNode.removeProp(Node.JSDOC_INFO_PROP); JSDocInfoBuilder suppressDoc = new JSDocInfoBuilder(true); suppressDoc.addSuppression("checkTypes"); suppressDoc.addSuppression("globalThis"); suppressDoc.addSuppression("visibility"); keyNode.setJSDocInfo(suppressDoc.build()); } } suppressDefaultValues(behaviorValue); } }
private void maybeAddGenerics(Node n, Node jsDocNode) { Node name = n.getFirstChild(); Node generics = (Node) name.getProp(Node.GENERIC_TYPE_LIST); if (generics != null) { JSDocInfoBuilder doc = JSDocInfoBuilder.maybeCopyFrom(jsDocNode.getJSDocInfo()); // Discard the type bound (the "extends" part) for now for (Node typeName : generics.children()) { doc.recordTemplateTypeName(typeName.getString()); if (typeName.hasChildren()) { compiler.report(JSError.make(name, CANNOT_CONVERT_BOUNDED_GENERICS)); typeName.removeChildren(); } } name.removeProp(Node.GENERIC_TYPE_LIST); jsDocNode.setJSDocInfo(doc.build()); } }
private void maybeAddGenerics(Node n, Node jsDocNode) { Node name = n.getFirstChild(); Node generics = (Node) name.getProp(Node.GENERIC_TYPE_LIST); if (generics != null) { JSDocInfoBuilder doc = JSDocInfoBuilder.maybeCopyFrom(jsDocNode.getJSDocInfo()); // Discard the type bound (the "extends" part) for now for (Node typeName : generics.children()) { doc.recordTemplateTypeName(typeName.getString()); if (typeName.hasChildren()) { compiler.report(JSError.make(name, CANNOT_CONVERT_BOUNDED_GENERICS)); typeName.removeChildren(); } } name.removeProp(Node.GENERIC_TYPE_LIST); jsDocNode.setJSDocInfo(doc.build()); } }