There's no need to create a namespace object when the importId is invalid.

This commit is contained in:
Roberto Raggi
2010-01-26 16:31:07 +01:00
parent c1b3f0b120
commit 5107ba57c2

View File

@@ -128,11 +128,11 @@ bool Bind::visit(UiImport *ast)
ObjectValue *namespaceObject;
if (ast->asToken.isValid()) { // with namespace we insert an object in the type env. to hold the imported types
namespaceObject = _interp->newObject(/*prototype */ 0);
if (!ast->importId)
return false; // this should never happen, but better be safe than sorry
namespaceObject = _interp->newObject(/*prototype */ 0);
_typeEnvironment->setProperty(ast->importId->asString(), namespaceObject);
} else { // without namespace we insert all types directly into the type env.