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

x33g5p2x  于2022-01-26 转载在 JavaScript  
字(5.9k)|赞(0)|评价(0)|浏览(282)

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

Parser.function介绍

暂无

代码示例

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

  1. n = function(FunctionNode.FUNCTION_STATEMENT);
  2. break;
  3. default:

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

  1. n = function(FunctionNode.FUNCTION_STATEMENT);
  2. break;
  3. default:

代码示例来源:origin: com.yahoo/yuicompressor

  1. n = function(FunctionNode.FUNCTION_STATEMENT);
  2. break;
  3. default:

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

  1. private boolean getterSetterProperty(ObjArray elems, Object property,
  2. boolean isGetter) throws IOException {
  3. Node f = function(FunctionNode.FUNCTION_EXPRESSION);
  4. if (f.getType() != Token.FUNCTION) {
  5. reportError("msg.bad.prop");
  6. return false;
  7. }
  8. int fnIndex = f.getExistingIntProp(Node.FUNCTION_PROP);
  9. FunctionNode fn = currentScriptOrFn.getFunctionNode(fnIndex);
  10. if (fn.getFunctionName().length() != 0) {
  11. reportError("msg.bad.prop");
  12. return false;
  13. }
  14. elems.add(property);
  15. if (isGetter) {
  16. elems.add(nf.createUnary(Token.GET, f));
  17. } else {
  18. elems.add(nf.createUnary(Token.SET, f));
  19. }
  20. return true;
  21. }
  22. }

代码示例来源:origin: com.yahoo/yuicompressor

  1. private boolean getterSetterProperty(ObjArray elems, Object property,
  2. boolean isGetter) throws IOException {
  3. Node f = function(FunctionNode.FUNCTION_EXPRESSION);
  4. if (f.getType() != Token.FUNCTION) {
  5. reportError("msg.bad.prop");
  6. return false;
  7. }
  8. int fnIndex = f.getExistingIntProp(Node.FUNCTION_PROP);
  9. FunctionNode fn = currentScriptOrFn.getFunctionNode(fnIndex);
  10. if (fn.getFunctionName().length() != 0) {
  11. reportError("msg.bad.prop");
  12. return false;
  13. }
  14. elems.add(property);
  15. if (isGetter) {
  16. elems.add(nf.createUnary(Token.GET, f));
  17. } else {
  18. elems.add(nf.createUnary(Token.SET, f));
  19. }
  20. return true;
  21. }
  22. }

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

  1. private boolean getterSetterProperty(ObjArray elems, Object property,
  2. boolean isGetter) throws IOException {
  3. Node f = function(FunctionNode.FUNCTION_EXPRESSION);
  4. if (f.getType() != Token.FUNCTION) {
  5. reportError("msg.bad.prop");
  6. return false;
  7. }
  8. int fnIndex = f.getExistingIntProp(Node.FUNCTION_PROP);
  9. FunctionNode fn = currentScriptOrFn.getFunctionNode(fnIndex);
  10. if (fn.getFunctionName().length() != 0) {
  11. reportError("msg.bad.prop");
  12. return false;
  13. }
  14. elems.add(property);
  15. if (isGetter) {
  16. elems.add(nf.createUnary(Token.GET, f));
  17. } else {
  18. elems.add(nf.createUnary(Token.SET, f));
  19. }
  20. return true;
  21. }
  22. }

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

  1. private ObjectProperty getterSetterProperty(int pos, AstNode propName,
  2. boolean isGetter)
  3. throws IOException
  4. {
  5. FunctionNode fn = function(FunctionNode.FUNCTION_EXPRESSION);
  6. // We've already parsed the function name, so fn should be anonymous.
  7. Name name = fn.getFunctionName();
  8. if (name != null && name.length() != 0) {
  9. reportError("msg.bad.prop");
  10. }
  11. ObjectProperty pn = new ObjectProperty(pos);
  12. if (isGetter) {
  13. pn.setIsGetter();
  14. } else {
  15. pn.setIsSetter();
  16. }
  17. int end = getNodeEnd(fn);
  18. pn.setLeft(propName);
  19. pn.setRight(fn);
  20. pn.setLength(end - pos);
  21. return pn;
  22. }

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

  1. consumeToken();
  2. try {
  3. n = function(calledByCompileFunction
  4. ? FunctionNode.FUNCTION_EXPRESSION
  5. : FunctionNode.FUNCTION_STATEMENT);

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

  1. consumeToken();
  2. try {
  3. n = function(calledByCompileFunction
  4. ? FunctionNode.FUNCTION_EXPRESSION
  5. : FunctionNode.FUNCTION_STATEMENT);

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

  1. private ObjectProperty getterSetterProperty(int pos, AstNode propName,
  2. boolean isGetter)
  3. throws IOException
  4. {
  5. FunctionNode fn = function(FunctionNode.FUNCTION_EXPRESSION);
  6. // We've already parsed the function name, so fn should be anonymous.
  7. Name name = fn.getFunctionName();
  8. if (name != null && name.length() != 0) {
  9. reportError("msg.bad.prop");
  10. }
  11. ObjectProperty pn = new ObjectProperty(pos);
  12. if (isGetter) {
  13. pn.setIsGetter();
  14. } else {
  15. pn.setIsSetter();
  16. }
  17. int end = getNodeEnd(fn);
  18. pn.setLeft(propName);
  19. pn.setRight(fn);
  20. pn.setLength(end - pos);
  21. return pn;
  22. }

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

  1. private ObjectProperty getterSetterProperty(int pos, AstNode propName,
  2. boolean isGetter)
  3. throws IOException
  4. {
  5. FunctionNode fn = function(FunctionNode.FUNCTION_EXPRESSION);
  6. // We've already parsed the function name, so fn should be anonymous.
  7. Name name = fn.getFunctionName();
  8. if (name != null && name.length() != 0) {
  9. reportError("msg.bad.prop");
  10. }
  11. ObjectProperty pn = new ObjectProperty(pos);
  12. if (isGetter) {
  13. pn.setIsGetter();
  14. fn.setFunctionIsGetter();
  15. } else {
  16. pn.setIsSetter();
  17. fn.setFunctionIsSetter();
  18. }
  19. int end = getNodeEnd(fn);
  20. pn.setLeft(propName);
  21. pn.setRight(fn);
  22. pn.setLength(end - pos);
  23. return pn;
  24. }

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

  1. private ObjectProperty methodDefinition(int pos, AstNode propName, int entryKind)
  2. throws IOException
  3. {
  4. FunctionNode fn = function(FunctionNode.FUNCTION_EXPRESSION);
  5. // We've already parsed the function name, so fn should be anonymous.
  6. Name name = fn.getFunctionName();
  7. if (name != null && name.length() != 0) {
  8. reportError("msg.bad.prop");
  9. }
  10. ObjectProperty pn = new ObjectProperty(pos);
  11. switch (entryKind) {
  12. case GET_ENTRY:
  13. pn.setIsGetterMethod();
  14. fn.setFunctionIsGetterMethod();
  15. break;
  16. case SET_ENTRY:
  17. pn.setIsSetterMethod();
  18. fn.setFunctionIsSetterMethod();
  19. break;
  20. case METHOD_ENTRY:
  21. pn.setIsNormalMethod();
  22. fn.setFunctionIsNormalMethod();
  23. break;
  24. }
  25. int end = getNodeEnd(fn);
  26. pn.setLeft(propName);
  27. pn.setRight(fn);
  28. pn.setLength(end - pos);
  29. return pn;
  30. }

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

  1. n = function(FunctionNode.FUNCTION_STATEMENT);
  2. break;
  3. default:

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

  1. n = function(FunctionNode.FUNCTION_STATEMENT);
  2. break;
  3. default:

代码示例来源:origin: com.yahoo/yuicompressor

  1. consumeToken();
  2. try {
  3. n = function(calledByCompileFunction
  4. ? FunctionNode.FUNCTION_EXPRESSION
  5. : FunctionNode.FUNCTION_STATEMENT);

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

  1. consumeToken();
  2. try {
  3. n = function(calledByCompileFunction
  4. ? FunctionNode.FUNCTION_EXPRESSION
  5. : FunctionNode.FUNCTION_STATEMENT);

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

  1. consumeToken();
  2. try {
  3. n = function(calledByCompileFunction
  4. ? FunctionNode.FUNCTION_EXPRESSION
  5. : FunctionNode.FUNCTION_STATEMENT);

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

  1. return function(FunctionNode.FUNCTION_EXPRESSION);

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

  1. return function(FunctionNode.FUNCTION_EXPRESSION);

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

  1. return function(FunctionNode.FUNCTION_EXPRESSION);

相关文章

Parser类方法