コード例 #1
0
ファイル: GrapeVariable.cs プロジェクト: eaglezhao/grape-sc2
 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
ファイル: GrapeMethod.cs プロジェクト: eaglezhao/grape-sc2
 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
ファイル: GrapeClass.cs プロジェクト: eaglezhao/grape-sc2
 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
ファイル: GrapeMember.cs プロジェクト: eaglezhao/grape-sc2
 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
ファイル: GrapeMethod.cs プロジェクト: eaglezhao/grape-sc2
 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
ファイル: GrapeVariable.cs プロジェクト: eaglezhao/grape-sc2
 public GrapeVariable(GrapeType type, GrapeIdentifier name, GrapeInitializer initializer)
 {
     this.name = name.Name;
     this.type = type;
     this.initializer = initializer;
 }
コード例 #14
0
ファイル: GrapeVariable.cs プロジェクト: eaglezhao/grape-sc2
 public GrapeVariable(GrapeType type, GrapeIdentifier name)
     : this(type, name, null)
 {
 }
コード例 #15
0
ファイル: GrapeParameter.cs プロジェクト: eaglezhao/grape-sc2
 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) {}