]> git.sur5r.net Git - cc65/blobdiff - src/ca65/expr.c
Don't use SF_TRAMPOLINE, change symbol references instead.
[cc65] / src / ca65 / expr.c
index dcb2f681e862a3c7b20d8966e4f529ad988c955f..3af3ea3099f245b6cc5e79d7b39ae70b853b9eea 100644 (file)
@@ -534,11 +534,31 @@ static ExprNode* Function (ExprNode* (*F) (void))
 
 
 
+static ExprNode* Symbol (SymEntry* S)
+/* Reference a symbol and return an expression for it */
+{
+    if (S == 0) {
+        /* Some weird error happened before */
+        return GenLiteralExpr (0);
+    } else {
+        /* Mark the symbol as referenced */
+        SymRef (S);
+        /* Remove the symbol if possible */
+        if (SymHasExpr (S)) {
+            return CloneExpr (GetSymExpr (S));
+        } else {
+            /* Create symbol node */
+            return GenSymExpr (S);
+        }
+    }
+}
+
+
+
 static ExprNode* Factor (void)
 {
     ExprNode* L;
     ExprNode* N;
-    SymEntry* S;
     long      Val;
 
     switch (Tok) {
@@ -555,24 +575,14 @@ static ExprNode* Factor (void)
 
        case TOK_NAMESPACE:
        case TOK_IDENT:
-           /* Search for the symbol */
-           S = ParseScopedSymName (SYM_ALLOC_NEW);
-           if (S == 0) {
-               /* Some weird error happened before */
-               N = GenLiteralExpr (0);
-           } else {
-               /* Mark the symbol as referenced */
-               SymRef (S);
-                /* Remove the symbol if possible */
-                if (SymHasExpr (S)) {
-                    N = CloneExpr (GetSymExpr (S));
-                } else {
-                    /* Create symbol node */
-                    N = GenSymExpr (S);
-                }
-           }
+            N = Symbol (ParseScopedSymName (SYM_ALLOC_NEW));
            break;
 
+        case TOK_LOCAL_IDENT:
+            N = Symbol (SymFindLocal (SVal, SYM_ALLOC_NEW));
+            NextTok ();
+            break;
+
        case TOK_ULABEL:
            N = ULabRef (IVal);
            NextTok ();