public override void EmitJs (JsEmitContext jec) { CheckExternImpl (); base.EmitJs (jec); }
public override void EmitStatementJs (JsEmitContext jec) { // It can be null for static initializers if (base_ctor == null || base_ctor.DeclaringType == jec.Compiler.BuiltinTypes.Object) return; jec.Buf.Write ("\t", Location); EmitJs (jec); jec.Buf.Write (";\n"); }
public void EmitJs (TypeDefinition parent, JsEmitContext jec) { var mc = (IMemberContext) method; method.ParameterInfo.ApplyAttributes (mc, MethodBuilder); ToplevelBlock block = method.Block; if (block != null) { BlockContext bc = new BlockContext (mc, block, method.ReturnType); if (block.Resolve (null, bc, method)) { block.EmitBlockJs (jec, false, false); } } }
public override void EmitJs (JsEmitContext jec) { var typeName = jec.MakeJsTypeName(this.Parent.MemberName.Name); var proto = ""; if ((ModFlags & Modifiers.STATIC) == 0) { proto = ".prototype"; } jec.Buf.Write ("\tObject.defineProperty(", typeName, proto, ", \"", MemberName.Name, "\", {\n", Location); jec.Buf.Indent (); if (this.Get != null) { this.Get.EmitJs (jec); } if (this.Set != null) { this.Set.EmitJs (jec); } jec.Buf.Write ("\tenumerable: true,\n\tconfigurable: true\n"); jec.Buf.Unindent (); jec.Buf.Write ("\t});\n"); }
public override void EmitJs (JsEmitContext jec) { if ((ModFlags & Modifiers.COMPILER_GENERATED) == 0) { parameters.CheckConstraints (this); } base.EmitJs (jec); }
public override void EmitJs (JsEmitContext jec) { child.EmitJs (jec); }
public override void EmitJs (JsEmitContext jec) { jec.Buf.Write ("\tget: function() ", Location); method_data.EmitJs (Parent as TypeDefinition, jec); jec.Buf.Write (",\n"); block = null; }
public override void EmitJs (JsEmitContext jec) { jec.Buf.Write ("undefined", Location); }
protected override void DoEmitJs (JsEmitContext jec) { expr.EmitJs (jec); }
public override void EmitJs (JsEmitContext jec) { Arguments[0].Expr.EmitJs (jec); jec.Buf.Write (".", name, Location); }
public override void EmitJs (JsEmitContext jec) { Expr.EmitJs (jec); jec.Buf.Write (" in "); ObjectExpression.EmitJs (jec); }
/// <summary> /// Base JS emit method. This is also entry point for CLS-Compliant verification. /// </summary> public virtual void EmitJs (JsEmitContext jec) { if (!Compiler.Settings.VerifyClsCompliance) return; VerifyClsCompliance (); }
public override void EmitContainerJs (JsEmitContext jec) { jec.Buf.Write ("// File: ", this.FileName, "\n"); base.EmitContainerJs (jec); }
public override void EmitContainerJs (JsEmitContext jec) { VerifyClsCompliance (); var name = jec.MakeJsNamespaceName (this.NS.Name); bool is_global_ns = String.IsNullOrEmpty (name); if (!is_global_ns) { jec.Buf.Write ("\tvar ", name, ";\n", "\t(function (", name, ") {\n", Location); jec.Buf.Indent (); jec.MarkNamespaceDefined (NS.Name); } base.EmitContainerJs (jec); if (!is_global_ns) { jec.Buf.Unindent (); jec.Buf.Write ("\t})(", name, " || (", name, " = {});\n"); } }
public override void EmitJs (JsEmitContext jec) { Target.EmitJs (jec); jec.Buf.Write (" = "); Source.EmitJs (jec); }
public override void EmitJs (JsEmitContext jec) { DoEmitJs (jec); }
public override void EmitStatementJs (JsEmitContext jec) { jec.Buf.Write ("\t", Location); Target.EmitJs (jec); jec.Buf.Write (" = "); Source.EmitJs (jec); jec.Buf.Write (";\n"); }
public override void EmitJs (JsEmitContext jec) { jec.Buf.Write ("{", Location); bool first = true; foreach (ElementInitializer elem in Elements) { if (!first) jec.Buf.Write (", "); jec.Buf.Write ("\"", elem.Name, "\":"); elem.Source.EmitJs (jec); first = false; } jec.Buf.Write ("}"); }
public virtual void EmitJs (JsEmitContext jec) { bool first = true; foreach (Argument a in args) { if (!first) jec.Buf.Write(", "); a.Expr.EmitJs (jec); first = false; } }
public override void EmitJs (JsEmitContext jec) { jec.Buf.Write ("[", Location); bool first = true; foreach (var elem in Elements) { if (!first) jec.Buf.Write (", "); elem.EmitJs (jec); first = false; } jec.Buf.Write ("]"); }
public override void EmitJs (JsEmitContext jec) { var parms = this.ParameterInfo; jec.Buf.Write ("\tset: function(", parms[0].Name, ") ", Location); method_data.EmitJs (Parent as TypeDefinition, jec); jec.Buf.Write (",\n"); block = null; }
public override void EmitJs (JsEmitContext jec) { jec.Buf.Write ("new ", Location); Expr.EmitJs (jec); }
public override void EmitJs (JsEmitContext jec) { try { base.EmitJs (jec); } catch { Console.WriteLine ("Internal compiler error at {0}: exception caught while emitting {1}", Location, MethodBuilder); throw; } }
public override void EmitJs (JsEmitContext jec) { jec.Buf.Write (GetValue () as String, Location); }
public override void EmitJs (JsEmitContext jec) { // It can be null for static initializers if (base_ctor == null) return; if (base_ctor.DeclaringType == jec.Compiler.BuiltinTypes.Object) throw new Exception ("Object constructor doesn't exist."); jec.Buf.Write ("_super.call(this, ", Location); if (argument_list != null) { argument_list.EmitJs (jec); } jec.Buf.Write (")"); // var call = new CallEmitter (); // call.InstanceExpression = new CompilerGeneratedThis (type, loc); // call.EmitPredefined (ec, base_ctor, argument_list); }
public override void EmitContainerJs (JsEmitContext jec) { if (OptAttributes != null) OptAttributes.EmitJs (jec); foreach (var tc in containers) { tc.PrepareEmit (); } base.EmitContainerJs (jec); if (Compiler.Report.Errors == 0 && !Compiler.Settings.WriteMetadataOnly) VerifyMembers (); if (anonymous_types != null) { foreach (var atypes in anonymous_types) foreach (var at in atypes.Value) at.EmitContainerJs (jec); } }
public override void EmitJs (JsEmitContext jec) { base.EmitJs (jec); bool is_static = (this.ModFlags & Modifiers.STATIC) != 0; if (!is_static) { jec.Buf.Write ("\tfunction " + this.Parent.MemberName.Name + "(", Location); parameters.EmitJs (jec); jec.Buf.Write (") "); } BlockContext bc = new BlockContext (this, block, Compiler.BuiltinTypes.Void); bc.Set (ResolveContext.Options.ConstructorScope); bool emitted_block = false; if (block != null) { // // If we use a "this (...)" constructor initializer, then // do not emit field initializers, they are initialized in the other constructor // if (!(Initializer is ConstructorThisInitializer)) Parent.PartialContainer.ResolveFieldInitializers (bc); if (!IsStatic) { if (Initializer == null) { if (Parent.PartialContainer.Kind == MemberKind.Struct) { // // If this is a non-static `struct' constructor and doesn't have any // initializer, it must initialize all of the struct's fields. // block.AddThisVariable (bc); } else if (Parent.PartialContainer.Kind == MemberKind.Class) { Initializer = new GeneratedBaseInitializer (Location); } } if (Initializer != null && !(bc.FileType == SourceFileType.PlayScript && Initializer.IsAsExplicitSuperCall)) { // // mdb format does not support reqions. Try to workaround this by emitting the // sequence point at initializer. Any breakpoint at constructor header should // be adjusted to this sequence point as it's the next one which follows. // block.AddScopeStatement (new StatementExpression (Initializer)); } } if (block.Resolve (null, bc, this)) { block.EmitBlockJs (jec, false, is_static); emitted_block = true; } } if (!is_static) { if (!emitted_block) jec.Buf.Write ("{\n\t}", Location); jec.Buf.Write ("\n"); } block = null; }
public override void EmitJs (JsEmitContext jec) { jec.Buf.Write ("\"", jec.Buf.EscapeString(Value), "\"", loc); }
public override void EmitJs (JsEmitContext jec) { base.EmitJs (jec); if ((this.ModFlags & Modifiers.STATIC) != 0) { jec.Buf.Write ("\t" + this.Parent.MemberName.Name + "." + this.MemberName.Name + " = function(", Location); } else { jec.Buf.Write ("\t" + this.Parent.MemberName.Name + ".prototype." + this.MemberName.Name + " = function(", Location); } parameters.EmitJs (jec); jec.Buf.Write (") "); if (MethodData != null) MethodData.EmitJs (Parent, jec); Block = null; jec.Buf.Write (";\n"); }
public virtual void EmitContainerJs (JsEmitContext jec) { if (containers != null) { for (int i = 0; i < containers.Count; ++i) containers[i].EmitContainerJs (jec); } }