org.mozilla.javascript.Node.setType()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 JavaScript  
字(5.3k)|赞(0)|评价(0)|浏览(305)

本文整理了Java中org.mozilla.javascript.Node.setType()方法的一些代码示例,展示了Node.setType()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.setType()方法的具体详情如下:
包路径:org.mozilla.javascript.Node
类名称:Node
方法名:setType

Node.setType介绍

[英]Sets the node type and returns this node.
[中]设置节点类型并返回此节点。

代码示例

代码示例来源:origin: com.github.tntim96/rhino

  1. protected Node createName(int type, String name, Node child) {
  2. Node result = createName(name);
  3. result.setType(type);
  4. if (child != null)
  5. result.addChildToBack(child);
  6. return result;
  7. }

代码示例来源:origin: rhino/js

  1. private Node createName(int type, String name, Node child)
  2. {
  3. Node result = createName(name);
  4. result.setType(type);
  5. if (child != null)
  6. result.addChildToBack(child);
  7. return result;
  8. }

代码示例来源:origin: ro.isdc.wro4j/rhino

  1. protected Node createName(int type, String name, Node child) {
  2. Node result = createName(name);
  3. result.setType(type);
  4. if (child != null)
  5. result.addChildToBack(child);
  6. return result;
  7. }

代码示例来源:origin: geogebra/geogebra

  1. protected Node createName(int type, String name, Node child) {
  2. Node result = createName(name);
  3. result.setType(type);
  4. if (child != null)
  5. result.addChildToBack(child);
  6. return result;
  7. }

代码示例来源:origin: io.apigee/rhino

  1. protected Node createName(int type, String name, Node child) {
  2. Node result = createName(name);
  3. result.setType(type);
  4. if (child != null)
  5. result.addChildToBack(child);
  6. return result;
  7. }

代码示例来源:origin: io.apigee/rhino

  1. private Node makeReference(Node node) {
  2. int type = node.getType();
  3. switch (type) {
  4. case Token.NAME:
  5. case Token.GETPROP:
  6. case Token.GETELEM:
  7. case Token.GET_REF:
  8. return node;
  9. case Token.CALL:
  10. node.setType(Token.REF_CALL);
  11. return new Node(Token.GET_REF, node);
  12. }
  13. // Signal caller to report error
  14. return null;
  15. }

代码示例来源:origin: ro.isdc.wro4j/rhino

  1. private Node makeReference(Node node) {
  2. int type = node.getType();
  3. switch (type) {
  4. case Token.NAME:
  5. case Token.GETPROP:
  6. case Token.GETELEM:
  7. case Token.GET_REF:
  8. return node;
  9. case Token.CALL:
  10. node.setType(Token.REF_CALL);
  11. return new Node(Token.GET_REF, node);
  12. }
  13. // Signal caller to report error
  14. return null;
  15. }

代码示例来源:origin: rhino/js

  1. private Node makeReference(Node node)
  2. {
  3. int type = node.getType();
  4. switch (type) {
  5. case Token.NAME:
  6. case Token.GETPROP:
  7. case Token.GETELEM:
  8. case Token.GET_REF:
  9. return node;
  10. case Token.CALL:
  11. node.setType(Token.REF_CALL);
  12. return new Node(Token.GET_REF, node);
  13. }
  14. // Signal caller to report error
  15. return null;
  16. }

代码示例来源:origin: com.github.tntim96/rhino

  1. private Node makeReference(Node node) {
  2. int type = node.getType();
  3. switch (type) {
  4. case Token.NAME:
  5. case Token.GETPROP:
  6. case Token.GETELEM:
  7. case Token.GET_REF:
  8. return node;
  9. case Token.CALL:
  10. node.setType(Token.REF_CALL);
  11. return new Node(Token.GET_REF, node);
  12. }
  13. // Signal caller to report error
  14. return null;
  15. }

代码示例来源:origin: geogebra/geogebra

  1. private Node makeReference(Node node) {
  2. int type = node.getType();
  3. switch (type) {
  4. case Token.NAME:
  5. case Token.GETPROP:
  6. case Token.GETELEM:
  7. case Token.GET_REF:
  8. return node;
  9. case Token.CALL:
  10. node.setType(Token.REF_CALL);
  11. return new Node(Token.GET_REF, node);
  12. }
  13. // Signal caller to report error
  14. return null;
  15. }

代码示例来源:origin: com.sun.phobos/phobos-rhino

  1. private Node makeReference(Node node)
  2. {
  3. int type = node.getType();
  4. switch (type) {
  5. case Token.NAME:
  6. case Token.GETPROP:
  7. case Token.GETELEM:
  8. case Token.GET_REF:
  9. return node;
  10. case Token.CALL:
  11. node.setType(Token.REF_CALL);
  12. return new Node(Token.GET_REF, node);
  13. }
  14. // Signal caller to report error
  15. return null;
  16. }

代码示例来源:origin: io.apigee/rhino

  1. ((Name) left).getIdentifier());
  2. left.setType(Token.BINDNAME);
  3. return new Node(Token.SETNAME, left, right);
  4. id.setType(Token.STRING);
  5. } else {
  6. type = Token.SETELEM;

代码示例来源:origin: ro.isdc.wro4j/rhino

  1. ((Name) left).getIdentifier());
  2. left.setType(Token.BINDNAME);
  3. return new Node(Token.SETNAME, left, right);
  4. id.setType(Token.STRING);
  5. } else {
  6. type = Token.SETELEM;

代码示例来源:origin: geogebra/geogebra

  1. ((Name) left).getIdentifier());
  2. left.setType(Token.BINDNAME);
  3. return new Node(Token.SETNAME, left, right);
  4. id.setType(Token.STRING);
  5. } else {
  6. type = Token.SETELEM;

代码示例来源:origin: com.github.tntim96/rhino

  1. ((Name) left).getIdentifier());
  2. left.setType(Token.BINDNAME);
  3. return new Node(Token.SETNAME, left, right);
  4. id.setType(Token.STRING);
  5. } else {
  6. type = Token.SETELEM;

代码示例来源:origin: com.sun.phobos/phobos-rhino

  1. private Node simpleAssignment(Node left, Node right)
  2. {
  3. int nodeType = left.getType();
  4. switch (nodeType) {
  5. case Token.NAME:
  6. left.setType(Token.BINDNAME);
  7. return new Node(Token.SETNAME, left, right);
  8. case Token.GETPROP:
  9. case Token.GETELEM: {
  10. Node obj = left.getFirstChild();
  11. Node id = left.getLastChild();
  12. int type;
  13. if (nodeType == Token.GETPROP) {
  14. type = Token.SETPROP;
  15. } else {
  16. type = Token.SETELEM;
  17. }
  18. return new Node(type, obj, id, right);
  19. }
  20. case Token.GET_REF: {
  21. Node ref = left.getFirstChild();
  22. checkMutableReference(ref);
  23. return new Node(Token.SET_REF, ref, right);
  24. }
  25. }
  26. throw Kit.codeBug();
  27. }

代码示例来源:origin: rhino/js

  1. private Node simpleAssignment(Node left, Node right)
  2. {
  3. int nodeType = left.getType();
  4. switch (nodeType) {
  5. case Token.NAME:
  6. left.setType(Token.BINDNAME);
  7. return new Node(Token.SETNAME, left, right);
  8. case Token.GETPROP:
  9. case Token.GETELEM: {
  10. Node obj = left.getFirstChild();
  11. Node id = left.getLastChild();
  12. int type;
  13. if (nodeType == Token.GETPROP) {
  14. type = Token.SETPROP;
  15. } else {
  16. type = Token.SETELEM;
  17. }
  18. return new Node(type, obj, id, right);
  19. }
  20. case Token.GET_REF: {
  21. Node ref = left.getFirstChild();
  22. checkMutableReference(ref);
  23. return new Node(Token.SET_REF, ref, right);
  24. }
  25. }
  26. throw Kit.codeBug();
  27. }

代码示例来源:origin: geogebra/geogebra

  1. child.setType(Token.BINDNAME);
  2. Node left = child;
  3. Node right = Node.newString(child.getString());
  4. child.setType(Token.TYPEOFNAME);
  5. return child;
  6. child.setType(type);
  7. return child;

代码示例来源:origin: rhino/js

  1. } else {
  2. result.setType(Token.LETEXPR);
  3. nf.addChildToBack(result, expr(false));
  4. if (isStatement) {

代码示例来源:origin: org.odlabs.wiquery/wiquery-compressor

  1. result.setType(Token1.LETEXPR);
  2. nf.addChildToBack(result, expr(false));
  3. if (isStatement)

相关文章