Skip to content

Commit 9de6c1f

Browse files
committed
Checkpoint: Moved various annotated nodes to Traversal attributes
1 parent 9a1f793 commit 9de6c1f

3 files changed

Lines changed: 26 additions & 3 deletions

File tree

‎JSIL/AST/JSExpressionTypes.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1381,7 +1381,7 @@ public static JSExpression UnpackArrayInitializer (TypeReference arrayType, byte
13811381
public class JSPairExpression : JSExpression {
13821382
static JSPairExpression () {
13831383
SetValueNames(
1384-
typeof(JSInvocationExpression),
1384+
typeof(JSPairExpression),
13851385
"Key",
13861386
"Value"
13871387
);

‎JSIL/AST/JSIdentifierTypes.cs‎

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,49 +603,72 @@ public JSIndirectVariable (IDictionary<string, JSVariable> variables, string ide
603603
Variables = variables;
604604
}
605605

606+
private void CheckForMissingVariable () {
607+
if (!Variables.ContainsKey(Identifier))
608+
throw new KeyNotFoundException(String.Format("No variable named '{0}' currently exists.", Identifier));
609+
}
610+
606611
public override TypeReference GetActualType (TypeSystem typeSystem) {
612+
CheckForMissingVariable();
613+
607614
return Variables[Identifier].GetActualType(typeSystem);
608615
}
609616

610617
public override TypeReference IdentifierType {
611618
get {
619+
CheckForMissingVariable();
620+
612621
return Variables[Identifier].IdentifierType;
613622
}
614623
}
615624

616625
public override bool IsReference {
617626
get {
627+
CheckForMissingVariable();
628+
618629
return Variables[Identifier].IsReference;
619630
}
620631
}
621632

622633
public override bool IsParameter {
623634
get {
635+
CheckForMissingVariable();
636+
624637
return Variables[Identifier].IsParameter;
625638
}
626639
}
627640

628641
public override JSParameter GetParameter () {
642+
CheckForMissingVariable();
643+
629644
return Variables[Identifier].GetParameter();
630645
}
631646

632647
public override bool IsConstant {
633648
get {
649+
CheckForMissingVariable();
650+
634651
return Variables[Identifier].IsConstant;
635652
}
636653
}
637654

638655
public override bool IsThis {
639656
get {
657+
CheckForMissingVariable();
658+
640659
return Variables[Identifier].IsThis;
641660
}
642661
}
643662

644663
public override JSVariable Dereference () {
664+
CheckForMissingVariable();
665+
645666
return Variables[Identifier].Dereference();
646667
}
647668

648669
public override JSVariable Reference () {
670+
CheckForMissingVariable();
671+
649672
return Variables[Identifier].Reference();
650673
}
651674

@@ -667,7 +690,7 @@ public override string ToString () {
667690
if (Variables.TryGetValue(Identifier, out variable))
668691
return String.Format("@{0}", variable);
669692
else
670-
return "@undef";
693+
return String.Format("@missing({0})", Identifier);
671694
}
672695
}
673696

‎JSIL/Transforms/StaticAnalysis/EliminateSingleUseTemporaries.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
namespace JSIL.Transforms {
1010
public class EliminateSingleUseTemporaries : StaticAnalysisJSAstVisitor {
11-
public static int TraceLevel = 0;
11+
public static int TraceLevel = 5;
1212

1313
public readonly TypeSystem TypeSystem;
1414
public readonly Dictionary<string, JSVariable> Variables;

0 commit comments

Comments
 (0)