/** * Sets the {@link JSDocInfo} attached to this node. */ public final Node setJSDocInfo(JSDocInfo info) { putProp(Prop.JSDOC_INFO, info); return this; }
/** * Sets the ES5 directives on this node. */ public final void setDirectives(Set<String> val) { putProp(Prop.DIRECTIVES, val); }
/** * Sets the syntactical type specified on this node. * @param typeExpression */ public void setDeclaredTypeExpression(TypeDeclarationNode typeExpression) { putProp(DECLARED_TYPE_EXPR, typeExpression); }
/** * @param inputId */ public void setInputId(InputId inputId) { this.putProp(INPUT_ID, inputId); }
/** * Sets the syntactical type specified on this node. * @param typeExpression */ public final void setDeclaredTypeExpression(TypeDeclarationNode typeExpression) { putProp(Prop.DECLARED_TYPE_EXPR, typeExpression); }
/** * Sets the type of this node before casting. */ public final void setJSTypeBeforeCast(JSType type) { putProp(Prop.TYPE_BEFORE_CAST, type); }
/** * @param inputId */ public void setInputId(InputId inputId) { this.putProp(Prop.INPUT_ID, inputId); }
/** * Sets the ES5 directives on this node. */ public void setDirectives(Set<String> val) { putProp(DIRECTIVES, val); }
/** * Sets the {@link JSDocInfo} attached to this node. */ public Node setJSDocInfo(JSDocInfo info) { putProp(JSDOC_INFO_PROP, info); return this; }
public void setOriginalName(String originalName) { this.putProp(Prop.ORIGINALNAME, originalName); }
/** Moves the access modifier from the original declaration to the constructor parameter */ void moveAccessModifier(ClassMemberDeclaration declaration, Node param) { if (Visibility.PRIVATE.equals(declaration.jsDoc.getVisibility())) { param.putProp(Node.ACCESS_MODIFIER, Visibility.PRIVATE); } else if (Visibility.PROTECTED.equals(declaration.jsDoc.getVisibility())) { param.putProp(Node.ACCESS_MODIFIER, Visibility.PROTECTED); } else { param.putProp(Node.ACCESS_MODIFIER, Visibility.PUBLIC); } }
/** * Overwrite all the source information in this node with * that of {@code other}. */ public final Node useSourceInfoFrom(Node other) { setStaticSourceFileFrom(other); putProp(Prop.ORIGINALNAME, other.getProp(Prop.ORIGINALNAME)); sourcePosition = other.sourcePosition; length = other.length; return this; }
private void maybeProcessGenerics(Node n, GenericTypeListTree generics) { if (generics != null) { maybeWarnTypeSyntax(generics, Feature.GENERICS); n.putProp(Node.GENERIC_TYPE_LIST, transform(generics)); } }
private void maybeProcessGenerics(Node n, GenericTypeListTree generics) { if (generics != null) { maybeWarnTypeSyntax(generics, Feature.GENERICS); n.putProp(Node.GENERIC_TYPE_LIST, transform(generics)); } }
Node processTemplateLiteralToken(LiteralToken token) { Preconditions.checkArgument( token.type == TokenType.NO_SUBSTITUTION_TEMPLATE || token.type == TokenType.TEMPLATE_HEAD || token.type == TokenType.TEMPLATE_MIDDLE || token.type == TokenType.TEMPLATE_TAIL); Node node = newStringNode(normalizeString(token, true)); node.putProp(Node.RAW_STRING_VALUE, token.value); setSourceInfo(node, token); return node; }
/** Adds the given features to a SCRIPT node's FeatureSet property. */ static void addFeatureToScript(Node scriptNode, Feature feature) { checkState(scriptNode.isScript(), scriptNode); FeatureSet currentFeatures = getFeatureSetOfScript(scriptNode); FeatureSet newFeatures = currentFeatures != null ? currentFeatures.with(feature) : FeatureSet.BARE_MINIMUM.with(feature); scriptNode.putProp(Node.FEATURE_SET, newFeatures); } }
private void safeSetString(Node n, String newString) { String originalName = n.getString(); n.setString(newString); n.putProp(Node.ORIGINALNAME_PROP, originalName); compiler.reportCodeChange(); }
/** * Overwrite all the source information in this node with * that of {@code other}. */ public Node useSourceInfoFrom(Node other) { putProp(ORIGINALNAME_PROP, other.getProp(ORIGINALNAME_PROP)); setStaticSourceFile(other.getStaticSourceFile()); sourcePosition = other.sourcePosition; setLength(other.getLength()); return this; }
Node processComputedPropertyMemberVariable(ComputedPropertyMemberVariableTree tree) { maybeWarnForFeature(tree, Feature.COMPUTED_PROPERTIES); maybeWarnTypeSyntax(tree, Feature.MEMBER_VARIABLE_IN_CLASS); Node n = newNode(Token.COMPUTED_PROP, transform(tree.property)); maybeProcessType(n, tree.declaredType); n.putBooleanProp(Node.COMPUTED_PROP_VARIABLE, true); n.putProp(Node.ACCESS_MODIFIER, tree.access); n.setStaticMember(tree.isStatic); maybeProcessAccessibilityModifier(tree, n, tree.access); return n; }
Node processComputedPropertyMemberVariable(ComputedPropertyMemberVariableTree tree) { maybeWarnEs6Feature(tree, Feature.COMPUTED_PROPERTIES); maybeWarnTypeSyntax(tree, Feature.COMPUTED_PROPERTIES); Node n = newNode(Token.COMPUTED_PROP, transform(tree.property)); maybeProcessType(n, tree.declaredType); n.putBooleanProp(Node.COMPUTED_PROP_VARIABLE, true); n.putProp(Node.ACCESS_MODIFIER, tree.access); n.setStaticMember(tree.isStatic); maybeProcessAccessibilityModifier(n, tree.access); return n; }