private NamespaceImportDeclaration CreateNamespaceImport() {
   NameDeclaration dummyName = new NameDeclaration(Dummy.Name, SourceDummy.SourceLocation);
   SimpleName microsoft = new SimpleName(this.Compilation.NameTable.GetNameFor("Microsoft"), SourceDummy.SourceLocation, false);
   SimpleName smallBasic = new SimpleName(this.Compilation.NameTable.GetNameFor("SmallBasic"), SourceDummy.SourceLocation, false);
   SimpleName library = new SimpleName(this.Compilation.NameTable.GetNameFor("Library"), SourceDummy.SourceLocation, false);
   QualifiedName microsoftSmallBasic = new QualifiedName(microsoft, smallBasic, SourceDummy.SourceLocation);
   QualifiedName microsoftSmallBasicLibrary = new QualifiedName(microsoftSmallBasic, library, SourceDummy.SourceLocation);
   NamespaceReferenceExpression smallBasicLibrary = new NamespaceReferenceExpression(microsoftSmallBasicLibrary, SourceDummy.SourceLocation);
   return new NamespaceImportDeclaration(dummyName, smallBasicLibrary, SourceDummy.SourceLocation);
 }
Exemple #2
0
 private NamespaceReferenceExpression ParseImportedNamespaceName(NameDeclaration name, TokenSet followers)
   //^ ensures followers[this.currentToken] || this.currentToken == Token.EndOfFile;
 {
   Expression expression = new SimpleName(name, name.SourceLocation, false);
   SourceLocationBuilder sctx = new SourceLocationBuilder(expression.SourceLocation);
   if (this.currentToken == Token.DoubleColon) {
     this.GetNextToken();
     SimpleName simpleName = this.ParseSimpleName(followers|Token.Dot);
     sctx.UpdateToSpan(simpleName.SourceLocation);
     expression = new AliasQualifiedName(expression, simpleName, sctx.GetSourceLocation());
   }
   while (this.currentToken == Token.Dot)
     //^ invariant expression is SimpleName || expression is QualifiedName || expression is AliasQualifiedName;
   {
     this.GetNextToken();
     SimpleName simpleName = this.ParseSimpleName(followers|Token.Dot);
     sctx.UpdateToSpan(simpleName.SourceLocation);
     expression = new QualifiedName(expression, simpleName, sctx.GetSourceLocation());
   }
   NamespaceReferenceExpression result = new NamespaceReferenceExpression(expression, sctx.GetSourceLocation());
   this.SkipTo(followers);
   return result;
 }