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

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

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

Parser.function介绍

暂无

代码示例

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

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

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

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

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

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

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

private boolean getterSetterProperty(ObjArray elems, Object property,
                     boolean isGetter) throws IOException {
    Node f = function(FunctionNode.FUNCTION_EXPRESSION);
    if (f.getType() != Token.FUNCTION) {
      reportError("msg.bad.prop");
      return false;
    }
    int fnIndex = f.getExistingIntProp(Node.FUNCTION_PROP);
    FunctionNode fn = currentScriptOrFn.getFunctionNode(fnIndex);
    if (fn.getFunctionName().length() != 0) {
      reportError("msg.bad.prop");
      return false;
    }
    elems.add(property);
    if (isGetter) {
      elems.add(nf.createUnary(Token.GET, f));
    } else {
      elems.add(nf.createUnary(Token.SET, f));
    }
    return true;
  }
}

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

private boolean getterSetterProperty(ObjArray elems, Object property,
                     boolean isGetter) throws IOException {
    Node f = function(FunctionNode.FUNCTION_EXPRESSION);
    if (f.getType() != Token.FUNCTION) {
      reportError("msg.bad.prop");
      return false;
    }
    int fnIndex = f.getExistingIntProp(Node.FUNCTION_PROP);
    FunctionNode fn = currentScriptOrFn.getFunctionNode(fnIndex);
    if (fn.getFunctionName().length() != 0) {
      reportError("msg.bad.prop");
      return false;
    }
    elems.add(property);
    if (isGetter) {
      elems.add(nf.createUnary(Token.GET, f));
    } else {
      elems.add(nf.createUnary(Token.SET, f));
    }
    return true;
  }
}

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

private boolean getterSetterProperty(ObjArray elems, Object property,
                     boolean isGetter) throws IOException {
    Node f = function(FunctionNode.FUNCTION_EXPRESSION);
    if (f.getType() != Token.FUNCTION) {
      reportError("msg.bad.prop");
      return false;
    }
    int fnIndex = f.getExistingIntProp(Node.FUNCTION_PROP);
    FunctionNode fn = currentScriptOrFn.getFunctionNode(fnIndex);
    if (fn.getFunctionName().length() != 0) {
      reportError("msg.bad.prop");
      return false;
    }
    elems.add(property);
    if (isGetter) {
      elems.add(nf.createUnary(Token.GET, f));
    } else {
      elems.add(nf.createUnary(Token.SET, f));
    }
    return true;
  }
}

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

private ObjectProperty getterSetterProperty(int pos, AstNode propName,
                      boolean isGetter)
  throws IOException
{
  FunctionNode fn = function(FunctionNode.FUNCTION_EXPRESSION);
  // We've already parsed the function name, so fn should be anonymous.
  Name name = fn.getFunctionName();
  if (name != null && name.length() != 0) {
    reportError("msg.bad.prop");
  }
  ObjectProperty pn = new ObjectProperty(pos);
  if (isGetter) {
    pn.setIsGetter();
  } else {
    pn.setIsSetter();
  }
  int end = getNodeEnd(fn);
  pn.setLeft(propName);
  pn.setRight(fn);
  pn.setLength(end - pos);
  return pn;
}

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

consumeToken();
try {
  n = function(calledByCompileFunction
         ? FunctionNode.FUNCTION_EXPRESSION
         : FunctionNode.FUNCTION_STATEMENT);

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

consumeToken();
try {
  n = function(calledByCompileFunction
         ? FunctionNode.FUNCTION_EXPRESSION
         : FunctionNode.FUNCTION_STATEMENT);

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

private ObjectProperty getterSetterProperty(int pos, AstNode propName,
                      boolean isGetter)
  throws IOException
{
  FunctionNode fn = function(FunctionNode.FUNCTION_EXPRESSION);
  // We've already parsed the function name, so fn should be anonymous.
  Name name = fn.getFunctionName();
  if (name != null && name.length() != 0) {
    reportError("msg.bad.prop");
  }
  ObjectProperty pn = new ObjectProperty(pos);
  if (isGetter) {
    pn.setIsGetter();
  } else {
    pn.setIsSetter();
  }
  int end = getNodeEnd(fn);
  pn.setLeft(propName);
  pn.setRight(fn);
  pn.setLength(end - pos);
  return pn;
}

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

private ObjectProperty getterSetterProperty(int pos, AstNode propName,
                      boolean isGetter)
  throws IOException
{
  FunctionNode fn = function(FunctionNode.FUNCTION_EXPRESSION);
  // We've already parsed the function name, so fn should be anonymous.
  Name name = fn.getFunctionName();
  if (name != null && name.length() != 0) {
    reportError("msg.bad.prop");
  }
  ObjectProperty pn = new ObjectProperty(pos);
  if (isGetter) {
    pn.setIsGetter();
    fn.setFunctionIsGetter();
  } else {
    pn.setIsSetter();
    fn.setFunctionIsSetter();
  }
  int end = getNodeEnd(fn);
  pn.setLeft(propName);
  pn.setRight(fn);
  pn.setLength(end - pos);
  return pn;
}

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

private ObjectProperty methodDefinition(int pos, AstNode propName, int entryKind)
  throws IOException
{
  FunctionNode fn = function(FunctionNode.FUNCTION_EXPRESSION);
  // We've already parsed the function name, so fn should be anonymous.
  Name name = fn.getFunctionName();
  if (name != null && name.length() != 0) {
    reportError("msg.bad.prop");
  }
  ObjectProperty pn = new ObjectProperty(pos);
  switch (entryKind) {
  case GET_ENTRY:
    pn.setIsGetterMethod();
    fn.setFunctionIsGetterMethod();
    break;
  case SET_ENTRY:
    pn.setIsSetterMethod();
    fn.setFunctionIsSetterMethod();
    break;
  case METHOD_ENTRY:
    pn.setIsNormalMethod();
    fn.setFunctionIsNormalMethod();
    break;
  }
  int end = getNodeEnd(fn);
  pn.setLeft(propName);
  pn.setRight(fn);
  pn.setLength(end - pos);
  return pn;
}

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

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

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

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

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

consumeToken();
try {
  n = function(calledByCompileFunction
         ? FunctionNode.FUNCTION_EXPRESSION
         : FunctionNode.FUNCTION_STATEMENT);

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

consumeToken();
try {
  n = function(calledByCompileFunction
         ? FunctionNode.FUNCTION_EXPRESSION
         : FunctionNode.FUNCTION_STATEMENT);

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

consumeToken();
try {
  n = function(calledByCompileFunction
         ? FunctionNode.FUNCTION_EXPRESSION
         : FunctionNode.FUNCTION_STATEMENT);

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

return function(FunctionNode.FUNCTION_EXPRESSION);

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

return function(FunctionNode.FUNCTION_EXPRESSION);

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

return function(FunctionNode.FUNCTION_EXPRESSION);

相关文章

微信公众号

Parser类方法