PageRenderTime 16ms CodeModel.GetById 12ms app.highlight 3ms RepoModel.GetById 0ms app.codeStats 0ms

/Test/simple.js

http://github.com/fishman/ctags
JavaScript | 101 lines | 47 code | 21 blank | 33 comment | 1 complexity | 0fb3b00da69c96631ccf0b57afdb6ddf MD5 | raw file
Possible License(s): GPL-2.0
  1/*
  2 * ctags should return the following for parsing this file using:
  3 * ctags -f - simple.js
  4 *
  5 * functions
  6 *   extra.validFunctionFour
  7 *   getHalfOf
  8 *   getHalfOf.calculate
  9 *   testlib.core.validFunctionSix
 10 *   testlib.validFunctionFive
 11 *   validFunctionOne
 12 *   validFunctionThree
 13 *   validFunctionThree.innerThree
 14 *   validFunctionTwo
 15 * classes
 16 *   Database
 17 *   ValidClassTwo
 18 *   testlib.extras.ValidClassOne
 19 * methods
 20 *   Database.executeQueryString
 21 *   Database.getTodaysDate
 22 *   ValidClassTwo.validMethodFour
 23 *   ValidClassTwo.validMethodThree
 24 *   testlib.extras.ValidClassOne.validMethodOne
 25 *   testlib.extras.ValidClassOne.validMethodTwo
 26 * variables
 27 *   my_global_var1
 28 *   my_global_var2
 29 *   my_global_var3
 30 *   my_global_var4
 31 */
 32
 33validFunctionOne = function(a,b) {}
 34
 35function validFunctionTwo(a,b) {}
 36
 37function validFunctionThree(a,b) {
 38    var innerThree = function(a,b) {}
 39}
 40
 41var my_global_var1 = 33;
 42
 43function extra.validFunctionFour(a,b) {}
 44
 45//pseudo-module setup
 46testlib = {}
 47testlib.core = {}
 48testlib.extras = {}
 49
 50var my_global_var2 = "Something";
 51
 52testlib.validFunctionFive = function(a,b) {}
 53
 54    var invalidInnerFunction = function(a,b) {}
 55
 56testlib.core.validFunctionSix = function(a,b) {}
 57
 58testlib.extras.ValidClassOne = function(a,b) { 
 59    this.a = a; 
 60}
 61
 62testlib.extras.ValidClassOne.prototype = {
 63    'validMethodOne' : function(a,b) {},
 64    'validMethodTwo' : function(a,b) {}
 65}
 66
 67ValidClassTwo = function () 
 68{
 69    this.validMethodThree = function() {}
 70
 71    // unnamed method
 72    this.validMethodFour = () {}
 73}
 74
 75var my_global_var4 = document.getElementsByTagName("input");
 76for (var i = 0; i < my_global_var4.length; i++) {
 77    var originalvalue = my_global_var4[i].value;
 78    my_global_var4[i].onchange = function () {
 79        alert(this.value + " == " + originalvalue);
 80    }
 81}
 82
 83function getHalfOf(num1, num2, num3)     
 84{ 
 85  function calculate(number)
 86  {
 87    return number/2;
 88  }
 89
 90  var result="";
 91  result+=calculate(num1)+" ";
 92  result+=calculate(num2)+" ";
 93  result+=calculate(num3);
 94}         
 95
 96var my_global_var3;
 97
 98Database.prototype.getTodaysDate = Database_getTodaysDate;
 99Database.prototype.executeQueryString = Db_executeQueryString;
100
101