Beispiel #1
0
        public LocalVariable[] GetLocals()
        {
            if (locals == null)
            {
                LocalsInfo li = new LocalsInfo();
                try {
                    li = vm.conn.Method_GetLocalsInfo(id);
                } catch (CommandException) {
                    throw new AbsentInformationException();
                }

                // Add the arguments as well
                var pi = GetParameters();

                locals = new LocalVariable [pi.Length + li.names.Length];

                for (int i = 0; i < pi.Length; ++i)
                {
                    locals [i] = new LocalVariable(vm, this, i, pi[i].ParameterType.Id, pi[i].Name, -1, -1, true);
                }

                for (int i = 0; i < li.names.Length; ++i)
                {
                    locals [i + pi.Length] = new LocalVariable(vm, this, i, li.types [i], li.names [i], li.live_range_start [i], li.live_range_end [i], false);
                }

                if (vm.Version.AtLeast(2, 43))
                {
                    scopes = new LocalScope [li.scopes_start.Length];
                    for (int i = 0; i < scopes.Length; ++i)
                    {
                        scopes [i] = new LocalScope(vm, this, li.scopes_start [i], li.scopes_end [i]);
                    }
                }
            }
            return(locals);
        }
Beispiel #2
0
		public LocalVariable[] GetLocals () {
			if (locals == null) {
				LocalsInfo li = new LocalsInfo ();
				try {
					li = vm.conn.Method_GetLocalsInfo (id);
				} catch (CommandException) {
					throw new AbsentInformationException ();
				}

				// Add the arguments as well
				var pi = GetParameters ();

				locals = new LocalVariable [pi.Length + li.names.Length];

				for (int i = 0; i < pi.Length; ++i)
					locals [i] = new LocalVariable (vm, this, i, pi[i].ParameterType.Id, pi[i].Name, -1, -1, true);

				for (int i = 0; i < li.names.Length; ++i)
					locals [i + pi.Length] = new LocalVariable (vm, this, i, li.types [i], li.names [i], li.live_range_start [i], li.live_range_end [i], false);

				if (vm.Version.AtLeast (2, 43)) {
					scopes = new LocalScope [li.scopes_start.Length];
					for (int i = 0; i < scopes.Length; ++i)
						scopes [i] = new LocalScope (vm, this, li.scopes_start [i], li.scopes_end [i]);
				}
			}
			return locals;
		}