//Compiles a simple parameterless constructor private void CompileConstructorConstant(string typeName, ElaNameReference exp, int sca, ElaVariableFlags flags, int typeModuleId) { frame.InternalConstructors.Add(new ConstructorData { TypeName = typeName, Name = exp.Name, Code = -1, TypeModuleId = typeModuleId }); AddLinePragma(exp); cw.Emit(Op.Ctorid, frame.InternalConstructors.Count - 1); PushVar(sca); cw.Emit(Op.Newtype0); var a = AddVariable(exp.Name, exp, ElaVariableFlags.TypeFun|flags, 0); PopVar(a); }
void VariableReference(out ElaExpression exp) { exp = null; if (la.kind == 1 || la.kind == 2 || la.kind == 52) { if (la.kind == 1) { Get(); exp = new ElaNameReference(t) { Name = t.val }; } else if (la.kind == 2) { Get(); exp = new ElaNameReference(t) { Name = t.val, Uppercase = true }; } else { Get(); Expect(1); exp = new ElaNameReference(t) { Name = t.val, Bang = true }; } } else if (la.kind == 53) { Get(); exp = new ElaPlaceholder(t); } else SynErr(72); }
void OpExpr9(out ElaExpression exp) { var op = String.Empty; exp = null; var ot = t; if (StartOf(15)) { InfixExpr(out exp); while (la.kind == 11) { var cexp = default(ElaExpression); Get(); op = t.val; if (StartOf(15)) { InfixExpr(out cexp); } exp = GetOperatorFun(op, exp, cexp); } } else if (la.kind == 11) { Get(); op = t.val; if (StartOf(15)) { InfixExpr(out exp); exp = GetOperatorFun(op, null, exp); } if (exp == null) exp = new ElaNameReference(ot) { Name = t.val }; } else SynErr(87); }