Java Javascript Mozilla Library getPrototypeClazz(List nodes)

Here you can find the source of getPrototypeClazz(List nodes)

Description

get Prototype Clazz

License

BSD License

Declaration

public static final String getPrototypeClazz(List<AstNode> nodes) 

Method Source Code

//package com.java2s;
/*/*from  w w  w  .jav  a2  s. c o m*/
 * 06/05/2014
 *
 * Copyright (C) 2014 Robert Futrell
 * robert_futrell at users.sourceforge.net
 * http://fifesoft.com/rsyntaxtextarea
 *
 * This library is distributed under a modified BSD license.  See the included
 * RSTALanguageSupport.License.txt file for details.
 */

import java.util.List;

import org.mozilla.javascript.ast.AstNode;

public class Main {
    public static final String getPrototypeClazz(List<AstNode> nodes) {
        return getPrototypeClazz(nodes, -1);
    }

    public static final String getPrototypeClazz(List<AstNode> nodes, int depth) {
        if (depth < 0) {
            depth = nodes.size();
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < depth; i++) {
            // These are not always Names, can sometimes be KeywordLiterals...
            // I think that's only in the case of syntax errors?
            sb.append(nodes.get(i).toSource());
            if (i < depth - 1) {
                sb.append('.');
            }
        }
        return sb.toString();
    }
}

Related

  1. getJsArray(Scriptable scope, Vector v)
  2. getMapArgument(Object[] args, int pos)
  3. getObjectArgument(Object[] args, int pos, Object defaultValue)
  4. getProperty(Scriptable obj, final String prop)
  5. getPropertyName(AstNode propKeyNode)
  6. getScriptableArgument(Object[] args, int pos, boolean allowNull)
  7. getStaticProperty(Scriptable mixin, String name)
  8. getStringArgument(Object[] args, int pos, boolean allowNull)
  9. getStringValue(AstNode element)