@Override public String toString() { return getKey(); }
@Override public int compareTo(SourceCode resource) { return key.compareTo(resource.getKey()); }
@Override public void index(SourceCode sourceCode) { sourceCode.setSourceCodeIndexer(this); index.put(sourceCode.getKey(), sourceCode); } }
@Override public boolean equals(Object obj) { return (obj instanceof FlexSquidPackage) && getKey().equals(((SourceCode) obj).getKey()); }
@Override public void log(CheckMessage message) { if (peekSourceCode() instanceof SourceFile) { peekSourceCode().log(message); } else if (peekSourceCode().getParent(SourceFile.class) != null) { peekSourceCode().getParent(SourceFile.class).log(message); } else { throw new IllegalStateException("Unable to log a check message on source code '" + (peekSourceCode() == null ? "[NULL]" : peekSourceCode().getKey()) + "'"); } }
/** * {@inheritDoc} */ @Override public void log(CheckMessage message) { if (peekSourceCode() instanceof SourceFile) { peekSourceCode().log(message); } else if (peekSourceCode().getParent(SourceFile.class) != null) { peekSourceCode().getParent(SourceFile.class).log(message); } else { throw new IllegalStateException("Unable to log a check message on source code '" + (peekSourceCode() == null ? "[NULL]" : peekSourceCode().getKey()) + "'"); } }
@Override public SourceCode createSourceCode(SourceCode parentSourceCode, AstNode astNode) { AstNode identifier = astNode.getFirstChild(EcmaScriptTokenType.IDENTIFIER, EcmaScriptGrammar.PROPERTY_NAME, Kind.IDENTIFIER); final String functionName = identifier == null ? "anonymous" : identifier.getTokenValue(); final String fileKey = parentSourceCode.isType(SourceFile.class) ? parentSourceCode.getKey() : parentSourceCode.getParent(SourceFile.class).getKey(); SourceFunction function = new SourceFunction(fileKey + ":" + functionName + ":" + astNode.getToken().getLine() + ":" + astNode.getToken().getColumn()); function.setStartAtLine(astNode.getTokenLine()); return function; } }, FUNCTION_NODES));