From 6f74979d617224e622366f511ed1921cf37fd699 Mon Sep 17 00:00:00 2001 From: arookas Date: Mon, 1 Feb 2016 04:56:22 -0500 Subject: [PATCH] Gave sunIdentifier properties a consistent name --- ssc/ast/nodes.functions.cs | 6 +++--- ssc/ast/nodes.variables.cs | 24 ++++++++++++------------ ssc/exceptions.cs | 8 ++++---- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/ssc/ast/nodes.functions.cs b/ssc/ast/nodes.functions.cs index 0e7a0b3..b56c535 100644 --- a/ssc/ast/nodes.functions.cs +++ b/ssc/ast/nodes.functions.cs @@ -3,7 +3,7 @@ using System.Linq; namespace arookas { class sunBuiltinDeclaration : sunNode { - public sunIdentifier Builtin { get { return this[1] as sunIdentifier; } } + public sunIdentifier Name { get { return this[1] as sunIdentifier; } } public sunParameterList Parameters { get { return this[2] as sunParameterList; } } public sunSymbolModifiers Modifiers { @@ -19,7 +19,7 @@ namespace arookas { } class sunFunctionDefinition : sunNode { - public sunIdentifier Function { get { return this[1] as sunIdentifier; } } + public sunIdentifier Name { get { return this[1] as sunIdentifier; } } public sunParameterList Parameters { get { return this[2] as sunParameterList; } } public sunNode Body { get { return this[3]; } } @@ -38,7 +38,7 @@ namespace arookas { } class sunFunctionCall : sunNode, sunTerm { - public sunIdentifier Function { get { return this[0] as sunIdentifier; } } + public sunIdentifier Name { get { return this[0] as sunIdentifier; } } public sunNode Arguments { get { return this[1] as sunNode; } } bool IsStatement { get { return !(Parent is sunOperand); } } diff --git a/ssc/ast/nodes.variables.cs b/ssc/ast/nodes.variables.cs index 69b04f6..edce231 100644 --- a/ssc/ast/nodes.variables.cs +++ b/ssc/ast/nodes.variables.cs @@ -1,16 +1,16 @@ namespace arookas { class sunStorableReference : sunNode, sunTerm { - public sunIdentifier Storable { get { return this[0] as sunIdentifier; } } + public sunIdentifier Name { get { return this[0] as sunIdentifier; } } public sunStorableReference(sunSourceLocation location) : base(location) { } public override void Compile(sunCompiler compiler) { - compiler.Context.MustResolveStorable(Storable).Compile(compiler); + compiler.Context.MustResolveStorable(Name).Compile(compiler); } sunExpressionFlags sunTerm.GetExpressionFlags(sunContext context) { - var symbol = context.MustResolveStorable(Storable); + var symbol = context.MustResolveStorable(Name); if (symbol is sunVariableSymbol) { return sunExpressionFlags.Variables | sunExpressionFlags.Dynamic; } @@ -22,7 +22,7 @@ } class sunVariableDeclaration : sunNode { - public sunIdentifier Variable { get { return this[1] as sunIdentifier; } } + public sunIdentifier Name { get { return this[1] as sunIdentifier; } } public sunSymbolModifiers Modifiers { get { return sunSymbol.GetModifiers(this[0]); } @@ -32,12 +32,12 @@ : base(location) { } public override void Compile(sunCompiler compiler) { - compiler.Context.DeclareVariable(Variable); + compiler.Context.DeclareVariable(this); } } class sunVariableDefinition : sunNode { - public sunIdentifier Variable { get { return this[1] as sunIdentifier; } } + public sunIdentifier Name { get { return this[1] as sunIdentifier; } } public sunAssign Operator { get { return this[2] as sunAssign; } } public sunExpression Expression { get { return this[3] as sunExpression; } } @@ -49,13 +49,13 @@ : base(location) { } public override void Compile(sunCompiler compiler) { - var symbol = compiler.Context.DeclareVariable(Variable); + var symbol = compiler.Context.DeclareVariable(this); Operator.Compile(compiler, symbol, Expression); } } class sunStorableAssignment : sunNode { - public sunIdentifier Storable { get { return this[1] as sunIdentifier; } } + public sunIdentifier Name { get { return this[1] as sunIdentifier; } } public sunAssign Operator { get { return this[2] as sunAssign; } } public sunExpression Expression { get { return this[3] as sunExpression; } } @@ -63,16 +63,16 @@ : base(location) { } public override void Compile(sunCompiler compiler) { - var symbol = compiler.Context.MustResolveStorable(Storable); + var symbol = compiler.Context.MustResolveStorable(Name); if (symbol is sunConstantSymbol) { - throw new sunAssignConstantException(Storable); + throw new sunAssignConstantException(Name); } Operator.Compile(compiler, symbol, Expression); } } class sunConstantDefinition : sunNode { - public sunIdentifier Constant { get { return this[1] as sunIdentifier; } } + public sunIdentifier Name { get { return this[1] as sunIdentifier; } } public sunExpression Expression { get { return this[3] as sunExpression; } } public sunSymbolModifiers Modifiers { @@ -90,7 +90,7 @@ if (flags.HasFlag(sunExpressionFlags.Dynamic)) { throw new sunConstantExpressionException(Expression); } - compiler.Context.DeclareConstant(Constant, Expression); + compiler.Context.DeclareConstant(this); } } } diff --git a/ssc/exceptions.cs b/ssc/exceptions.cs index d50652e..d491013 100644 --- a/ssc/exceptions.cs +++ b/ssc/exceptions.cs @@ -85,19 +85,19 @@ namespace arookas { } class sunRedeclaredBuiltinException : sunNodeException { - public override string Message { get { return String.Format("Redeclared builtin '{0}'.", Node.Builtin.Value); } } + public override string Message { get { return String.Format("Redeclared builtin '{0}'.", Node.Name.Value); } } public sunRedeclaredBuiltinException(sunBuiltinDeclaration node) : base(node) { } } class sunUndefinedFunctionException : sunNodeException { - public override string Message { get { return String.Format("Undefined function or builtin '{0}'.", Node.Function.Value); } } + public override string Message { get { return String.Format("Undefined function or builtin '{0}'.", Node.Name.Value); } } public sunUndefinedFunctionException(sunFunctionCall node) : base(node) { } } class sunRedefinedFunctionException : sunNodeException { - public override string Message { get { return String.Format("Redefined function '{0}'.", Node.Function.Value); } } + public override string Message { get { return String.Format("Redefined function '{0}'.", Node.Name.Value); } } public sunRedefinedFunctionException(sunFunctionDefinition node) : base(node) { } @@ -133,7 +133,7 @@ namespace arookas { : base(node) { } } class sunVariadicFunctionException : sunNodeException { - public override string Message { get { return String.Format("Function '{0}' is defined as a variadic function (only builtins may be variadic).", Node.Function.Value); } } + public override string Message { get { return String.Format("Function '{0}' is defined as a variadic function (only builtins may be variadic).", Node.Name.Value); } } public sunVariadicFunctionException(sunFunctionDefinition node) : base(node) { }