예제 #1
0
 internal static GrapeVariable Create(GrapeSimpleType type, GrapeIdentifier name)
 {
     GrapeVariable variable = new GrapeVariable(type, name);
     variable.InitializeFromTemplate(type);
     variable.InitializeFromChildren(type.FileName, new GrapeEntity[] {type, name});
     return variable;
 }
예제 #2
0
 public GrapeMethod(GrapeList<GrapeModifier> modifiers, GrapeType returnType, GrapeIdentifier name, GrapeList<GrapeParameter> parameters, GrapeList<GrapeStatement> body)
     : base(modifiers)
 {
     this.returnType = returnType;
     this.name = name.Name;
     this.parameters = parameters.ToList(this).AsReadOnly();
     this.body = body.ToList(this).AsReadOnly();
 }
예제 #3
0
		internal static GrapeCallExpression Create(GrapeIdentifier identifier, GrapeList<GrapeExpression> parameters, GrapeAccessExpression next) {
			List<GrapeEntity> children = new List<GrapeEntity>();
			children.Add(identifier);
			children.AddRange(parameters.Enumerate());
			GrapeCallExpression result = new GrapeCallExpression(identifier, parameters, next);
			result.InitializeFromTemplate(identifier);
			result.InitializeFromChildren(identifier.FileName, children);
			return result;
		}
예제 #4
0
		internal static GrapeMemberExpression Create(GrapeAccessExpressionType type, GrapeIdentifier identifier, GrapeAccessExpression next) {
			if (identifier == null) {
				throw new ArgumentNullException("identifier");
			}
			Debug.Assert((type == GrapeAccessExpressionType.Root) || (type == GrapeAccessExpressionType.Field));
			GrapeMemberExpression result = new GrapeMemberExpression(type, identifier, next);
			result.InitializeFromTemplate(identifier);
			return result;
		}
예제 #5
0
 public GrapeClass(GrapeList<GrapeModifier> modifiers, GrapeIdentifier identifier, GrapeOptional<GrapeLiteralExpression<int>> size, GrapeOptional<GrapeSimpleType> inherits, GrapeList<GrapeClassItem> classItems)
     : base(modifiers)
 {
     GrapeLiteralExpression<int> sizeLiteral = size;
     this.size = (sizeLiteral == null) ? default(int?) : sizeLiteral.Value;
     this.inherits = inherits;
     this.classItems = classItems.ToList(this).AsReadOnly();
     name = identifier.Name;
 }
예제 #6
0
		protected override GrapeAccessExpression ToExpression(GrapeIdentifier identifier, GrapeAccessExpression next) {
			return GrapeCallExpression.Create(identifier, parameters, next);
		}
예제 #7
0
 protected virtual GrapeAccessExpression ToExpression(GrapeIdentifier identifier, GrapeAccessExpression next)
 {
     return GrapeMemberExpression.Create((identifiers.Count == 1) && (ofMember == null) ? GrapeAccessExpression.GrapeAccessExpressionType.Root : GrapeAccessExpression.GrapeAccessExpressionType.Field, identifier, next);
 }
예제 #8
0
 public GrapeMethod(GrapeList<GrapeModifier> modifiers, GrapeIdentifier name, GrapeList<GrapeParameter> parameters, GrapeList<GrapeStatement> body)
     : this(modifiers, null, name, parameters, body)
 {
 }
예제 #9
0
		private GrapeCallExpression(GrapeIdentifier identifier, GrapeList<GrapeExpression> parameters, GrapeAccessExpression next): base(GrapeAccessExpressionType.Method, identifier, next) {
			this.parameters = parameters.ToList(this).AsReadOnly();
		}
예제 #10
0
		protected GrapeMemberExpression(GrapeAccessExpressionType type, GrapeIdentifier identifier, GrapeAccessExpression next): base(next) {
			Debug.Assert(type != GrapeAccessExpressionType.Array);
			this.type = type;
			this.identifier = identifier;
		}
예제 #11
0
		public GrapeConstructor(GrapeList<GrapeModifier> modifiers, GrapeIdentifier name, GrapeList<GrapeParameter> parameters, GrapeList<GrapeStatement> body): base(modifiers, name, parameters, body) {}
예제 #12
0
		public GrapeCatchClause(GrapeSimpleType exceptionType, GrapeIdentifier variableIdentifier, GrapeList<GrapeStatement> statements): base(statements) {
			this.exceptionType = exceptionType;
			exceptionVariable = GrapeVariable.Create(exceptionType, variableIdentifier);
		}
예제 #13
0
 public GrapeVariable(GrapeType type, GrapeIdentifier name, GrapeInitializer initializer)
 {
     this.name = name.Name;
     this.type = type;
     this.initializer = initializer;
 }
예제 #14
0
 public GrapeVariable(GrapeType type, GrapeIdentifier name)
     : this(type, name, null)
 {
 }
예제 #15
0
 public GrapeParameter(GrapeType type, GrapeIdentifier name)
     : base(type, name, null)
 {
 }
예제 #16
0
		public GrapeDestructor(GrapeList<GrapeModifier> modifiers, GrapeIdentifier name, GrapeList<GrapeStatement> body): base(modifiers, name, null, body) {}