Gave sunIdentifier properties a consistent name

This commit is contained in:
arookas 2016-02-01 04:56:22 -05:00
parent 91588fae63
commit 6f74979d61
3 changed files with 19 additions and 19 deletions

View file

@ -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); } }

View file

@ -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);
}
}
}

View file

@ -85,19 +85,19 @@ namespace arookas {
}
class sunRedeclaredBuiltinException : sunNodeException<sunBuiltinDeclaration> {
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<sunFunctionCall> {
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<sunFunctionDefinition> {
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<sunFunctionDefinition> {
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) { }