internal void Parse(Parser parser) {
   this.sourceAttributes = new List<SourceCustomAttribute>(0);
   List<INamespaceDeclarationMember> members = this.members = new List<INamespaceDeclarationMember>(2);
   members.Add(this.CreateNamespaceImport());
   List<ITypeDeclarationMember> typeMembers = new List<ITypeDeclarationMember>();
   RootClassDeclaration rootClass = new RootClassDeclaration(new NameDeclaration(this.Compilation.NameTable.GetNameFor("RootClass"), this.SourceLocation), typeMembers, this.SourceLocation);
   members.Add(rootClass);
   List<Statement> statements = new List<Statement>();
   rootClass.AddStandardMembers(this.Compilation, statements);
   parser.ParseStatements(statements, rootClass);
 }
Example #2
0
 internal void ParseStatements(List<Statement> statements, RootClassDeclaration rootClass) {
   this.rootClass = rootClass;
   this.GetNextToken();
   TokenSet statementStartOrEof = Parser.StatementStart|Parser.EndOfFile;
   this.ParseStatements(statements, statementStartOrEof);
 }
Example #3
0
 private Expression ConvertToDelegate(Expression expression, ITypeDefinition targetType, int labelIndex, RootClassDeclaration rootClass) {
   IMethodDefinition invokeMethod = this.GetInvokeMethod(targetType);
   if (invokeMethod != Dummy.Method && invokeMethod.Type.TypeCode == PrimitiveTypeCode.Void && IteratorHelper.EnumerableIsEmpty(invokeMethod.Parameters)) {
     IMethodDefinition matchingMethod = rootClass.MainMethod.MethodDefinition;
     CompileTimeConstant constant = new CompileTimeConstant(labelIndex, SourceDummy.SourceLocation);
     constant.SetContainingExpression(expression);
     Expression instance = this.GetRootClassInstance(constant, rootClass);
     return new CreateDelegateInstance(instance, targetType, matchingMethod, expression.SourceLocation);
   }
   return base.ImplicitConversion(expression, targetType);
 }
 internal GosubStatement(SimpleName targetLabel, ISourceLocation sourceLocation, RootClassDeclaration rootClass)
   : base(sourceLocation) {
   this.targetLabel = targetLabel;
   this.rootClass = rootClass;
 }
Example #5
0
 private Expression GetRootClassInstance(CompileTimeConstant labelIndex, RootClassDeclaration rootClass) {
   List<Expression> arguments = new List<Expression>(1);
   arguments.Add(labelIndex);
   foreach (IMethodDefinition constructor in rootClass.TypeDefinition.GetMembersNamed(this.Compilation.NameTable.Ctor, false)) {
     return new CreateObjectInstanceForResolvedConstructor(constructor, arguments, SourceDummy.SourceLocation);
   }
   //^ assume false;
   return labelIndex;
 }