Skip to content
Browse files

#52 dictionary member check performance improved.

  • Loading branch information...
1 parent bd80221 commit 1dd97eec871aa4db7872c14de5e731ac8abbab1e @MindScriptAct committed
View
10 src/mvcexpress/core/CommandMap.as
@@ -89,7 +89,7 @@ public class CommandMap {
}
}
- if (classRegistry[type]) {
+ if (type in classRegistry) {
if (!canMapOver) {
throw Error("Only one command class can be mapped to one message type. You are trying to map " + commandClass + " to " + type + ", but it is already mapped to " + classRegistry[type]);
}
@@ -212,7 +212,7 @@ public class CommandMap {
* @return true if command pool is created.
*/
public function isCommandPooled(commandClass:Class):Boolean {
- return (commandPools[commandClass] != null && commandPools[commandClass].length);
+ return (commandClass in commandPools && commandPools[commandClass].length);
}
/**
@@ -241,7 +241,7 @@ public class CommandMap {
*/
public function isMapped(type:String, commandClass:Class = null):Boolean {
var retVal:Boolean; // = false;
- if (classRegistry[type]) {
+ if (type in classRegistry) {
if (commandClass) {
retVal = (classRegistry[type] == commandClass);
} else {
@@ -402,13 +402,13 @@ public class CommandMap {
pureLegsCore function validateCommandClass(commandClass:Class):void {
// skip already validated classes.
- if (validatedCommands[commandClass] != true) {
+ if (!(commandClass in validatedCommands)) {
if (!checkClassSuperclass(commandClass, "mvcexpress.mvc::Command")) {
throw Error("commandClass:" + commandClass + " you are trying to map MUST extend: 'mvcexpress.mvc::Command' class.");
}
- if (!commandClassParamTypes[commandClass]) {
+ if (!(commandClass in commandClassParamTypes)) {
var classDescription:XML = describeType(commandClass);
var hasExecute:Boolean; // = false;
View
4 src/mvcexpress/core/ExtensionManager.as
@@ -35,7 +35,7 @@ public class ExtensionManager {
*/
CONFIG::debug
public static function getExtensionIdByName(extensionName:String):int {
- if (ExtensionManager.EXTENSION_NAMES[extensionName] == null) {
+ if (!(extensionName in ExtensionManager.EXTENSION_NAMES)) {
ExtensionManager.EXTENSION_NAMES[extensionName] = ++ExtensionManager.extensionCount;
}
return ExtensionManager.EXTENSION_NAMES[extensionName];
@@ -68,7 +68,7 @@ public class ExtensionManager {
use namespace pureLegsCore;
var retVal:int = 0;
- if (!extensionIdRegistry[frameworkClass]) {
+ if (!(frameworkClass in extensionIdRegistry)) {
var currentClass:Class = frameworkClass;
while (retVal == 0 && currentClass != Object) {
retVal = currentClass["extension_id"];
View
18 src/mvcexpress/core/MediatorMap.as
@@ -86,17 +86,17 @@ public class MediatorMap implements IMediatorMap {
}
// check if mapping is not created already
- if (mediatorMappingRegistry[viewClass] != null) {
- if (mediatorMappingRegistry[viewClass][mediatorClass] != null) {
+ if ((viewClass in mediatorMappingRegistry)) {
+ if (mediatorClass in mediatorMappingRegistry[viewClass]) {
throw Error("Mediator class:" + mediatorClass + " is already mapped with this view class:" + viewClass + "");
}
}
// map mediatorClass to viewClass
- if (mediatorMappingRegistry[viewClass] == null) {
+ if (!(viewClass in mediatorMappingRegistry)) {
mediatorMappingRegistry[viewClass] = new Dictionary();
}
- if (mediatorMapOrderRegistry[viewClass] == null) {
+ if (!(viewClass in mediatorMapOrderRegistry)) {
mediatorMapOrderRegistry[viewClass] = new Vector.<Class>();
}
@@ -137,7 +137,7 @@ public class MediatorMap implements IMediatorMap {
MvcExpress.debug(new TraceMediatorMap_unmap(moduleName, viewClass, mediatorClass));
}
// clear mapping
- if (mediatorMappingRegistry[viewClass] != null) {
+ if (viewClass in mediatorMappingRegistry) {
if (mediatorClass) {
var mediators:Vector.<Class> = mediatorMapOrderRegistry[viewClass];
@@ -175,7 +175,7 @@ public class MediatorMap implements IMediatorMap {
public function mediate(viewObject:Object):void {
use namespace pureLegsCore;
- if (mediatorRegistry[viewObject]) {
+ if (viewObject in mediatorRegistry) {
throw Error("This view object is already mediated by " + mediatorRegistry[viewObject]);
}
@@ -241,7 +241,7 @@ public class MediatorMap implements IMediatorMap {
retVal = proxyMap.injectStuff(mediator, mediatorClass, viewObject, injectClass);
- if (mediatorRegistry[viewObject] == null) {
+ if (!(viewObject in mediatorRegistry)) {
mediatorRegistry[viewObject] = new Vector.<Mediator>;
}
mediatorRegistry[viewObject].push(mediator);
@@ -261,7 +261,7 @@ public class MediatorMap implements IMediatorMap {
public function mediateWith(viewObject:Object, mediatorClass:Class, injectClass:Class = null):void {
use namespace pureLegsCore;
- if (mediatorRegistry[viewObject]) {
+ if (viewObject in mediatorRegistry) {
var mediators:Vector.<Mediator> = mediatorRegistry[viewObject];
for (var i:int = 0; i < mediators.length; i++) {
if ((mediators[i] as Object).constructor == mediatorClass) {
@@ -365,7 +365,7 @@ public class MediatorMap implements IMediatorMap {
*/
public function isMapped(viewClass:Class, mediatorClass:Class = null):Boolean {
var retVal:Boolean; // = false;
- if (mediatorMappingRegistry[viewClass] != null) {
+ if (viewClass in mediatorMappingRegistry) {
if (mediatorClass) {
if (mediatorMappingRegistry[viewClass][mediatorClass] != null) {
retVal = true;
View
14 src/mvcexpress/core/ModuleManager.as
@@ -68,7 +68,7 @@ public class ModuleManager {
MvcExpress.debug(new TraceModuleManager_createModule(moduleName));
}
- if (moduleRegistry[moduleName] == null) {
+ if (!(moduleName in moduleRegistry)) {
_moduleId++;
//
if (!moduleName) {
@@ -144,7 +144,7 @@ public class ModuleManager {
CONFIG::debug {
MvcExpress.debug(new TraceModuleManager_disposeModule(moduleName));
}
- if (moduleRegistry[moduleName]) {
+ if (moduleName in moduleRegistry) {
delete moduleRegistry[moduleName];
} else {
throw Error("Module with moduleName:" + moduleName + " doesn't exist.");
@@ -186,7 +186,7 @@ public class ModuleManager {
* @return
*/
static public function listMappedMessages(moduleName:String):String {
- if (moduleRegistry[moduleName]) {
+ if (moduleName in moduleRegistry) {
return (moduleRegistry[moduleName] as ModuleCore).listMappedMessages();
} else {
return "Module with name :" + moduleName + " is not found.";
@@ -199,7 +199,7 @@ public class ModuleManager {
* @return
*/
static public function listMappedMediators(moduleName:String):String {
- if (moduleRegistry[moduleName]) {
+ if (moduleName in moduleRegistry) {
return (moduleRegistry[moduleName] as ModuleCore).listMappedMediators();
} else {
return "Module with name :" + moduleName + " is not found.";
@@ -212,7 +212,7 @@ public class ModuleManager {
* @return
*/
static public function listMappedProxies(moduleName:String):String {
- if (moduleRegistry[moduleName]) {
+ if (moduleName in moduleRegistry) {
return (moduleRegistry[moduleName] as ModuleCore).listMappedProxies();
} else {
return "Module with name :" + moduleName + " is not found.";
@@ -225,7 +225,7 @@ public class ModuleManager {
* @return
*/
static public function listMappedCommands(moduleName:String):String {
- if (moduleRegistry[moduleName]) {
+ if (moduleName in moduleRegistry) {
return (moduleRegistry[moduleName] as ModuleCore).listMappedCommands();
} else {
return "Module with name :" + moduleName + " is not found.";
@@ -244,7 +244,7 @@ public class ModuleManager {
* @private
*/
static pureLegsCore function invokeModuleFunction(moduleName:String, functionName:String, params:Array = null):Object {
- if (moduleRegistry[moduleName]) {
+ if (moduleName in moduleRegistry) {
try {
var callFunct:Function = moduleRegistry[moduleName][functionName]
if (params) {
View
142 src/mvcexpress/core/ProxyMap.as
@@ -131,7 +131,7 @@ public class ProxyMap implements IProxyMap {
var isAllInjected:Boolean = initProxy(proxyObject, proxyClass, injectId);
}
- if (!injectObjectRegistry[injectId]) {
+ if (!(injectId in injectObjectRegistry)) {
// store proxy injection for other classes.
injectObjectRegistry[injectId] = proxyObject;
} else {
@@ -145,12 +145,12 @@ public class ProxyMap implements IProxyMap {
}
var mediatorInjectId:String = className + name;
- if (mediatorInjectObjectRegistry[mediatorInjectId] == null) {
+ if (!(mediatorInjectId in mediatorInjectObjectRegistry)) {
mediatorInjectObjectRegistry[mediatorInjectId] = proxyObject;
mediatorInjectIdRegistry[injectId] = mediatorInjectId;
// handle case of pending injection.
- if (pendingInjectionsRegistry[mediatorInjectId] != null) {
+ if (mediatorInjectId in pendingInjectionsRegistry) {
injectPendingStuff(mediatorInjectId, proxyObject);
}
} else {
@@ -159,7 +159,7 @@ public class ProxyMap implements IProxyMap {
}
// check if there is no pending injection with this key.
- if (pendingInjectionsRegistry[injectId] != null) {
+ if (injectId in pendingInjectionsRegistry) {
injectPendingStuff(injectId, proxyObject);
}
@@ -198,7 +198,7 @@ public class ProxyMap implements IProxyMap {
var injectId:String = className + name;
// remove proxy if it exists.
- if (injectObjectRegistry[injectId]) {
+ if (injectId in injectObjectRegistry) {
var proxy:Proxy = injectObjectRegistry[injectId] as Proxy;
// handle dependencies..
@@ -212,12 +212,17 @@ public class ProxyMap implements IProxyMap {
}
// clear any injection mapping into mediators.
- var mediatorInjectId:String = mediatorInjectIdRegistry[injectId];
- if (mediatorInjectId != null) {
- delete mediatorInjectObjectRegistry[mediatorInjectId];
+ if (injectId in mediatorInjectIdRegistry) {
+ delete mediatorInjectObjectRegistry[mediatorInjectIdRegistry[injectId]];
delete mediatorInjectIdRegistry[injectId];
}
+ // clear lazy mappings
+ if (injectId in lazyProxyRegistry) {
+ lazyProxyRegistry[injectId].dispose();
+ delete lazyProxyRegistry[injectId];
+ }
+
return injectId;
}
@@ -282,7 +287,7 @@ public class ProxyMap implements IProxyMap {
var lazyInject:LazyProxyVO = new LazyProxyVO();
lazyInject.proxyClass = proxyClass;
lazyInject.injectClass = injectClass;
- lazyInject.injectClassAndName = injectId;
+ lazyInject.injectId = injectId;
lazyInject.name = name;
lazyInject.proxyParams = proxyConstructorParams;
@@ -298,7 +303,7 @@ public class ProxyMap implements IProxyMap {
var mediatorInjectId:String = mediatorInjectClassName + name;
lazyInject.mediatorInjectClass = mediatorInjectClass;
- lazyInject.mediatorInjectClassAndName = mediatorInjectId;
+ lazyInject.mediatorInjectId = mediatorInjectId;
lazyProxyRegistry[mediatorInjectId] = lazyInject;
}
@@ -334,13 +339,14 @@ public class ProxyMap implements IProxyMap {
className = getQualifiedClassName(proxyClass);
qualifiedClassNameRegistry[proxyClass] = className;
}
- var injectClassAndName:String = className + name;
+ var injectId:String = className + name;
+
// try to get proxy from standard registry.
- var proxyObject:Proxy = injectObjectRegistry[injectClassAndName] as Proxy;
+ var proxyObject:Proxy = injectObjectRegistry[injectId] as Proxy;
if (!proxyObject) {
// check lazy proxies.
- if (injectClassAndName in lazyProxyRegistry) {
- proxyObject = initLazyProxy(injectClassAndName);
+ if (injectId in lazyProxyRegistry) {
+ proxyObject = initLazyProxy(injectId);
} else {
throw Error("Proxy object is not mapped. [injectClass:" + className + " name:" + name + "]");
}
@@ -373,20 +379,20 @@ public class ProxyMap implements IProxyMap {
qualifiedClassNameRegistry[injectClass] = className;
}
- var injectClassAndName:String = className + name;
+ var injectId:String = className + name;
- if (injectClassAndName in injectObjectRegistry) {
+ if (injectId in injectObjectRegistry) {
if (proxyObject) {
- retVal = (injectObjectRegistry[injectClassAndName] == proxyObject);
+ retVal = (injectObjectRegistry[injectId] == proxyObject);
} else {
retVal = true;
}
} else {
// if proxy object is not found, try lazy mapping.
if (proxyObject == null) {
- if (injectClassAndName in lazyProxyRegistry) {
- var lazyProxyData:LazyProxyVO = lazyProxyRegistry[injectClassAndName];
- if (lazyProxyData.injectClassAndName == injectClassAndName) {
+ if (injectId in lazyProxyRegistry) {
+ var lazyProxyData:LazyProxyVO = lazyProxyRegistry[injectId];
+ if (lazyProxyData.injectId == injectId) {
retVal = true;
}
}
@@ -434,20 +440,20 @@ public class ProxyMap implements IProxyMap {
}
// init lazy proxy
- private function initLazyProxy(injectClassAndName:String):Proxy {
+ private function initLazyProxy(injectId:String):Proxy {
- var lazyProxyData:LazyProxyVO = lazyProxyRegistry[injectClassAndName];
+ var lazyProxyData:LazyProxyVO = lazyProxyRegistry[injectId];
// check if this lazy proxy mapnig has second lazy mapnig for mediator injcet.
- if (lazyProxyData.mediatorInjectClassAndName == injectClassAndName) {
+ if (lazyProxyData.mediatorInjectId == injectId) {
// this is lazy proxy mediator inject, clear lazy proxy mapping.
- delete lazyProxyRegistry[lazyProxyData.injectClassAndName];
- } else if (lazyProxyData.mediatorInjectClassAndName != null) { // check if this lazy proxy has mediator ID mapped.
+ delete lazyProxyRegistry[lazyProxyData.injectId];
+ } else if (lazyProxyData.mediatorInjectId != null) { // check if this lazy proxy has mediator ID mapped.
// this is lazy proxy inject, with mediator inject also mapped, clear lazy proxy mediator inject mapping.
- delete lazyProxyRegistry[lazyProxyData.mediatorInjectClassAndName];
+ delete lazyProxyRegistry[lazyProxyData.mediatorInjectId];
}
- delete lazyProxyRegistry[injectClassAndName];
+ delete lazyProxyRegistry[injectId];
var lazyProxy:Proxy;
if (lazyProxyData.proxyParams) {
@@ -501,28 +507,28 @@ public class ProxyMap implements IProxyMap {
className = getQualifiedClassName(proxyClass);
qualifiedClassNameRegistry[proxyClass] = className;
}
- var injectClassAndName:String = className + name;
+ var injectId:String = className + name;
// try to get proxy from mediator registry.
- var proxyObject:Object = mediatorInjectObjectRegistry[injectClassAndName];
+ var proxyObject:Proxy = mediatorInjectObjectRegistry[injectId] as Proxy;
if (!proxyObject) {
// check lazy proxies.
- if (injectClassAndName in lazyProxyRegistry) {
- initLazyProxy(injectClassAndName);
+ if (injectId in lazyProxyRegistry) {
+ initLazyProxy(injectId);
// try to get mediator inject again.
- proxyObject = mediatorInjectObjectRegistry[injectClassAndName];
+ proxyObject = mediatorInjectObjectRegistry[injectId];
}
}
// proxy is not found - throw error.
if (!proxyObject) {
- proxyObject = injectObjectRegistry[injectClassAndName];
+ proxyObject = injectObjectRegistry[injectId];
if (proxyObject) {
- throw Error("You are trying to get proxy class:" + injectClassAndName + " from mediator, but mediators are not allowed to inject this proxy. To enable this: set mediatorInjectClass parameter then you map this proxy.");
+ throw Error("You are trying to get proxy class:" + injectId + " from mediator, but mediators are not allowed to inject this proxy. To enable this: set mediatorInjectClass parameter then you map this proxy.");
} else {
throw Error("Proxy object is not mapped. [injectClass:" + className + " name:" + name + "]");
}
}
- return proxyObject as Proxy;
+ return proxyObject;
}
/**
@@ -540,16 +546,16 @@ public class ProxyMap implements IProxyMap {
className = getQualifiedClassName(proxyClass);
qualifiedClassNameRegistry[proxyClass] = className;
}
- var injectClassAndName:String = className + name;
+ var injectId:String = className + name;
- var retVal:Boolean = (injectClassAndName in mediatorInjectObjectRegistry);
+ var retVal:Boolean = (injectId in mediatorInjectObjectRegistry);
// if injection not found, try lazy mapping.
if (!retVal) {
- if (injectClassAndName in lazyProxyRegistry) {
- var lazyProxyData:LazyProxyVO = lazyProxyRegistry[injectClassAndName];
+ if (injectId in lazyProxyRegistry) {
+ var lazyProxyData:LazyProxyVO = lazyProxyRegistry[injectId];
// check if this lazy proxy mapping maps mediator class.
- if (lazyProxyData.mediatorInjectClassAndName == injectClassAndName) {
+ if (lazyProxyData.mediatorInjectId == injectId) {
retVal = true;
}
}
@@ -610,7 +616,7 @@ public class ProxyMap implements IProxyMap {
mediatorInjectClassName = getQualifiedClassName(mediatorInjectClass);
qualifiedClassNameRegistry[mediatorInjectClass] = mediatorInjectClassName;
}
- if (!mediatorInjectObjectRegistry[mediatorInjectClassName]) {
+ if (!(mediatorInjectClassName in mediatorInjectObjectRegistry)) {
mediatorInjectObjectRegistry[mediatorInjectClassName] = mediatorObject;
} else {
throw Error("Mediator object should not be mapped for injection... it was meant to be used by framework only.");
@@ -638,16 +644,16 @@ public class ProxyMap implements IProxyMap {
var injectObject:Object = null;
var rule:InjectRuleVO = rules[i];
- var injectClassAndName:String = rule.injectClassAndName;
+ var injectId:String = rule.injectId;
// check if we inject to mediator.
if (mediatorObject) {
- injectObject = mediatorInjectObjectRegistry[injectClassAndName];
+ injectObject = mediatorInjectObjectRegistry[injectId];
if (!injectObject) {
// if injection fails... test for lazy injections
- if (injectClassAndName in lazyProxyRegistry) {
- initLazyProxy(injectClassAndName);
- injectObject = mediatorInjectObjectRegistry[injectClassAndName];
+ if (injectId in lazyProxyRegistry) {
+ initLazyProxy(injectId);
+ injectObject = mediatorInjectObjectRegistry[injectId];
}
}
// proxy is not found
@@ -655,22 +661,22 @@ public class ProxyMap implements IProxyMap {
// check if pending injection feature is enabled. (wait for injcetion if it is.)
if (MvcExpress.pendingInjectsTimeOut == 0) {
// throw error.
- injectObject = injectObjectRegistry[injectClassAndName];
+ injectObject = injectObjectRegistry[injectId];
if (injectObject) {
- throw Error("You are trying to inject class:" + injectClassAndName + " into " + object + ", but mediators are not allowed to inject this proxy. To enable this: set mediatorInjectClass parameter then you map this proxy.");
+ throw Error("You are trying to inject class:" + injectId + " into " + object + ", but mediators are not allowed to inject this proxy. To enable this: set mediatorInjectClass parameter then you map this proxy.");
} else {
- throw Error("Inject object is not found for class with id:" + injectClassAndName + "(needed in " + object + ")");
+ throw Error("Inject object is not found for class with id:" + injectId + "(needed in " + object + ")");
}
}
}
} else {
- injectObject = injectObjectRegistry[injectClassAndName];
+ injectObject = injectObjectRegistry[injectId];
}
if (!injectObject) {
// if local injection fails... test for lazy injections
- if (injectClassAndName in lazyProxyRegistry) {
- injectObject = initLazyProxy(injectClassAndName);
+ if (injectId in lazyProxyRegistry) {
+ injectObject = initLazyProxy(injectId);
} else {
// remember that not all injections exists
isAllInjected = false;
@@ -682,10 +688,10 @@ public class ProxyMap implements IProxyMap {
MvcExpress.debug(new TraceProxyMap_injectPending(moduleName, object, injectObject, rule));
}
//
- addPendingInjection(injectClassAndName, new PendingInject(injectClassAndName, object, signatureClass, MvcExpress.pendingInjectsTimeOut));
+ addPendingInjection(injectId, new PendingInject(injectId, object, signatureClass, MvcExpress.pendingInjectsTimeOut));
object.pendingInjections++;
} else {
- throw Error("Inject object is not found for class with id:" + injectClassAndName + "(needed in " + object + ")");
+ throw Error("Inject object is not found for class with id:" + injectId + "(needed in " + object + ")");
}
}
}
@@ -724,15 +730,15 @@ public class ProxyMap implements IProxyMap {
/**
* Adds pending injection.
- * @param injectClassAndName
+ * @param injectId
* @param pendingInjection
* @private
*/
- pureLegsCore function addPendingInjection(injectClassAndName:String, pendingInjection:PendingInject):void {
- var pendingInjections:Vector.<PendingInject> = pendingInjectionsRegistry[injectClassAndName]
+ pureLegsCore function addPendingInjection(injectId:String, pendingInjection:PendingInject):void {
+ var pendingInjections:Vector.<PendingInject> = pendingInjectionsRegistry[injectId]
if (!pendingInjections) {
pendingInjections = new Vector.<PendingInject>();
- pendingInjectionsRegistry[injectClassAndName] = pendingInjections;
+ pendingInjectionsRegistry[injectId] = pendingInjections;
}
pendingInjections[pendingInjections.length] = pendingInjection;
}
@@ -741,10 +747,10 @@ public class ProxyMap implements IProxyMap {
* Handle all pending injections for specified key.
* @private
*/
- protected function injectPendingStuff(injectClassAndName:String, injectee:Object):void {
+ protected function injectPendingStuff(injectId:String, injectee:Object):void {
use namespace pureLegsCore;
- var pendingInjects:Vector.<PendingInject> = pendingInjectionsRegistry[injectClassAndName];
+ var pendingInjects:Vector.<PendingInject> = pendingInjectionsRegistry[injectId];
while (pendingInjects.length) {
//
var pendingInjection:PendingInject = pendingInjects.pop();
@@ -755,7 +761,7 @@ public class ProxyMap implements IProxyMap {
pendingInjection.dispose();
var ruleCount:int = rules.length;
for (var j:int = 0; j < ruleCount; j++) {
- if (rules[j].injectClassAndName == injectClassAndName) {
+ if (rules[j].injectId == injectId) {
// satisfy missing injection.
pendingInject[rules[j].varName] = injectee;
@@ -771,11 +777,11 @@ public class ProxyMap implements IProxyMap {
var mediatorObject:Mediator = pendingInject as Mediator;
// check if injection is allowed in Mediator.
- if (!(injectClassAndName in mediatorInjectObjectRegistry)) {
+ if (!(injectId in mediatorInjectObjectRegistry)) {
// undo injection..
pendingInject[rules[j].varName] = null;
// this injection is not allowed in mediator.
- throw Error("You are trying to inject class:" + injectClassAndName + " into " + mediatorObject + ", but mediators are not allowed to inject this proxy. To enable this: set mediatorInjectClass parameter then you map this proxy.");
+ throw Error("You are trying to inject class:" + injectId + " into " + mediatorObject + ", but mediators are not allowed to inject this proxy. To enable this: set mediatorInjectClass parameter then you map this proxy.");
}
mediatorObject.pendingInjections--;
if (mediatorObject.pendingInjections == 0) {
@@ -787,7 +793,7 @@ public class ProxyMap implements IProxyMap {
}
}
//
- delete pendingInjectionsRegistry[injectClassAndName];
+ delete pendingInjectionsRegistry[injectId];
}
/**
@@ -833,7 +839,7 @@ public class ProxyMap implements IProxyMap {
}
var mapRule:InjectRuleVO = new InjectRuleVO();
mapRule.varName = varName;
- mapRule.injectClassAndName = injectClass + injectName;
+ mapRule.injectId = injectClass + injectName;
return mapRule;
}
@@ -872,10 +878,10 @@ public class ProxyMap implements IProxyMap {
return classConstRegistry[constName];
}
-// gets proxy by id directly.
+ // gets proxy by id directly.
/** @private */
- pureLegsCore function getProxyById(injectClassAndName:String):Proxy {
- return injectObjectRegistry[injectClassAndName];
+ pureLegsCore function getProxyById(injectId:String):Proxy {
+ return injectObjectRegistry[injectId];
}
View
4 src/mvcexpress/core/inject/InjectRuleVO.as
@@ -15,11 +15,11 @@ public class InjectRuleVO {
public var varName:String;
/** FOR INTERNAL USE ONLY. Injection identifier, formed by class name and your custom inject name. */
- public var injectClassAndName:String;
+ public var injectId:String;
CONFIG::debug
public function toString():String {
- return "[InjectRuleVO varName=" + varName + " injectClassAndName=" + injectClassAndName + "]";
+ return "[InjectRuleVO varName=" + varName + " injectId=" + injectId + "]";
}
}
}
View
4 src/mvcexpress/core/lazy/LazyProxyVO.as
@@ -11,10 +11,10 @@ public class LazyProxyVO {
public var name:String;
public var injectClass:Class;
- public var injectClassAndName:String;
+ public var injectId:String;
public var mediatorInjectClass:Class;
- public var mediatorInjectClassAndName:String;
+ public var mediatorInjectId:String;
public var proxyParams:Array;
}
View
4 src/mvcexpress/core/messenger/Messenger.as
@@ -115,7 +115,7 @@ public class Messenger {
MvcExpress.debug(new TraceMessenger_removeHandler(moduleName, type, handler));
}
- if (handlerRegistry[type]) {
+ if (type in handlerRegistry) {
if (handlerRegistry[type][handler]) {
(handlerRegistry[type][handler] as HandlerVO).handler = null;
delete handlerRegistry[type][handler];
@@ -198,7 +198,7 @@ public class Messenger {
*/
public function isHandlerAdded(type:String, handler:Function):Boolean {
var retVal:Boolean = false;
- if (handlerRegistry[type]) {
+ if (type in handlerRegistry) {
if (handlerRegistry[type][handler]) {
retVal = true;
}
View
2 src/mvcexpress/core/namespace/pureLegsCore.as
@@ -3,5 +3,5 @@ package mvcexpress.core.namespace {
// namespace for framework internal variables and functions.
// Not meant to be used from outside. (...unless you want to hack/break the framework.)
// name constructed using two AS3 frameworks that inspired mvcExpress framework - PUREmvc and robotLEGS, and used as codename for framework prototype in it's early stage.
-public namespace pureLegsCore = "pureLegsCore-namespace";
+public namespace pureLegsCore = "pureLegsCore-ns";
}
View
2 src/mvcexpress/core/traceObjects/proxyMap/TraceProxyMap_injectPending.as
@@ -25,7 +25,7 @@ public class TraceProxyMap_injectPending extends TraceObj {
}
override public function toString():String {
- return "!!!!! " + MvcTraceActions.PROXYMAP_INJECTPENDING + " > for id:" + rule.injectClassAndName + "(needed in " + hostObject + ")" + " {" + moduleName + "}";
+ return "!!!!! " + MvcTraceActions.PROXYMAP_INJECTPENDING + " > for injectId:" + rule.injectId + "(needed in " + hostObject + ")" + " {" + moduleName + "}";
}
}
}
View
16 src/mvcexpress/mvc/Mediator.as
@@ -222,18 +222,18 @@ public class Mediator {
*/
protected function addListener(viewObject:IEventDispatcher, type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void {
if (useCapture) {
- if (!eventListenerCaptureRegistry[listener]) {
+ if (!(listener in eventListenerCaptureRegistry)) {
eventListenerCaptureRegistry[listener] = new Dictionary();
}
- if (!eventListenerCaptureRegistry[listener][type]) {
+ if (!(type in eventListenerCaptureRegistry[listener])) {
eventListenerCaptureRegistry[listener][type] = viewObject;
viewObject.addEventListener(type, listener, useCapture, priority, useWeakReference);
}
} else {
- if (!eventListenerRegistry[listener]) {
+ if (!(listener in eventListenerRegistry)) {
eventListenerRegistry[listener] = new Dictionary();
}
- if (!eventListenerRegistry[listener][type]) {
+ if (!(type in eventListenerRegistry[listener])) {
eventListenerRegistry[listener][type] = viewObject;
viewObject.addEventListener(type, listener, useCapture, priority, useWeakReference);
}
@@ -252,16 +252,16 @@ public class Mediator {
viewObject.removeEventListener(type, listener, useCapture);
if (useCapture) {
- if (eventListenerCaptureRegistry[listener]) {
- if (eventListenerCaptureRegistry[listener][type]) {
+ if (listener in eventListenerCaptureRegistry) {
+ if (type in eventListenerCaptureRegistry[listener]) {
if (eventListenerCaptureRegistry[listener][type] == viewObject) {
delete eventListenerCaptureRegistry[listener][type];
}
}
}
} else {
- if (eventListenerRegistry[listener]) {
- if (eventListenerRegistry[listener][type]) {
+ if (listener in eventListenerRegistry) {
+ if (type in eventListenerRegistry[listener]) {
if (eventListenerRegistry[listener][type] == viewObject) {
delete eventListenerRegistry[listener][type];
}
View
4 src/mvcexpress/utils/checkClassStringConstants.as
@@ -27,14 +27,14 @@ public function checkClassStringConstants(...args:Array):void {
if (constantClass) {
var needChecking:Boolean = true;
// check if class is already analyzed.
- if (StringConstantRegistry.registeredClasses[constantClass] != true) {
+ if (!(constantClass in StringConstantRegistry.registeredClasses)) {
var description:XML = describeType(constantClass);
var constantList:XMLList = description.constant;
var constantCount:int = constantList.length();
for (var j:int = 0; j < constantCount; j++) {
if (constantList[j].@type == "String") {
var constantValue:String = constantClass[constantList[j].@name];
- if (StringConstantRegistry.stringRegistry[constantValue]) {
+ if (constantValue in StringConstantRegistry.stringRegistry) {
throw Error("Class " + constantClass + " and " + StringConstantRegistry.stringRegistry[constantValue] + " have same string constant value : " + constantValue);
} else {
StringConstantRegistry.stringRegistry[constantValue] = constantClass;
View
6 srcExtensions/mvcexpress/extensions/live/core/ProcessMapLive.as
@@ -533,7 +533,7 @@ public class ProcessMapLive {
continue;
}
}
- var injectName:String = rules[i].injectClassAndName;
+ var injectName:String = rules[i].injectId;
var injectObject:Object = provideRegistry[injectName];
task.setInjectPoint(injectName, rules[i].varName);
@@ -561,7 +561,7 @@ public class ProcessMapLive {
// find task by inject object name and remove it.
var ruleCount:int = rules.length;
for (var i:int = 0; i < ruleCount; i++) {
- var allTasks:Vector.<Task> = injectObjectRegistry[rules[i].injectClassAndName];
+ var allTasks:Vector.<Task> = injectObjectRegistry[rules[i].injectId];
if (allTasks) {
var taskCount:int = allTasks.length;
for (var j:int = 0; j < taskCount; j++) {
@@ -618,7 +618,7 @@ public class ProcessMapLive {
}
var mapRule:InjectRuleTaskVO = new InjectRuleTaskVO();
mapRule.varName = node.@name.toString();
- mapRule.injectClassAndName = injectName;
+ mapRule.injectId = injectName;
mapRule.scopeName = scopeName;
retVal[retVal.length] = mapRule
}
View
2 srcExtensions/mvcexpress/extensions/live/core/inject/InjectRuleTaskVO.as
@@ -17,7 +17,7 @@ public class InjectRuleTaskVO extends InjectRuleVO {
CONFIG::debug
override public function toString():String {
- return "[InjectRuleVO varName=" + varName + " injectClassAndName=" + injectClassAndName + " scopeName=" + scopeName + "]";
+ return "[InjectRuleVO varName=" + varName + " injectId=" + injectId + " scopeName=" + scopeName + "]";
}
}
}
View
4 srcExtensions/mvcexpress/extensions/scoped/core/ProxyMapScoped.as
@@ -143,7 +143,7 @@ public class ProxyMapScoped extends ProxyMap {
for (var i:int; i < ruleCount; i++) {
var rule:InjectRuleScopedVO = rules[i] as InjectRuleScopedVO;
var scopename:String = rule.scopeName;
- var injectClassAndName:String = rule.injectClassAndName;
+ var injectClassAndName:String = rule.injectId;
if (scopename) {
if (!ScopeManager.injectScopedProxy(object, rule)) {
if (MvcExpress.pendingInjectsTimeOut && !(object is Command)) {
@@ -273,7 +273,7 @@ public class ProxyMapScoped extends ProxyMap {
}
var mapRule:InjectRuleScopedVO = new InjectRuleScopedVO();
mapRule.varName = varName;
- mapRule.injectClassAndName = injectClass + injectName;
+ mapRule.injectId = injectClass + injectName;
mapRule.scopeName = scopeName;
return mapRule;
}
View
2 srcExtensions/mvcexpress/extensions/scoped/core/ScopeManager.as
@@ -242,7 +242,7 @@ public class ScopeManager {
if (scopedProxyMap) {
use namespace pureLegsCore;
- var ijectProxy:Proxy = scopedProxyMap.getProxyById(injectRule.injectClassAndName);
+ var ijectProxy:Proxy = scopedProxyMap.getProxyById(injectRule.injectId);
if (ijectProxy) {
recipientObject[injectRule.varName] = ijectProxy;
return true;
View
2 srcExtensions/mvcexpress/extensions/scoped/core/inject/InjectRuleScopedVO.as
@@ -16,7 +16,7 @@ public class InjectRuleScopedVO extends InjectRuleVO {
CONFIG::debug
override public function toString():String {
- return "[InjectRuleVO varName=" + varName + " injectClassAndName=" + injectClassAndName + " scopeName=" + scopeName + "]";
+ return "[InjectRuleVO varName=" + varName + " injectClassAndName=" + injectId + " scopeName=" + scopeName + "]";
}
}
}
View
2 ...sions/mvcexpress/extensions/scoped/core/traceObjects/TraceProxyMap_scopedInjectPending.as
@@ -27,7 +27,7 @@ public class TraceProxyMap_scopedInjectPending extends TraceObj {
}
override public function toString():String {
- return "!!!!! " + MvcTraceActions.PROXYMAP_INJECTPENDING + " > for scopeName:" + scopeName + " with id:" + rule.injectClassAndName + "(needed in " + hostObject + ")" + " {" + moduleName + "}";
+ return "!!!!! " + MvcTraceActions.PROXYMAP_INJECTPENDING + " > for scopeName:" + scopeName + " with id:" + rule.injectId + "(needed in " + hostObject + ")" + " {" + moduleName + "}";
}
}
}

0 comments on commit 1dd97ee

Please sign in to comment.
Something went wrong with that request. Please try again.