Wiki

Changes between Version 2 and Version 3 of CtTrace

Show
Ignore:
Timestamp:
07/10/13 13:34:44 (11 years ago)
Author:
hopscc
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • CtTrace

    v2 v3  
    11= Compile Time Trace = 
    22 
    3 Emit a trace message for this line at compile time. 
     3Emit diagnostic information for the given expression showing the expression state at various stages of its compilation. 
     4 
     5Mostly only of use for compiler development. 
     6 
     7Currently this information is  
     8  - expression state before  binding to implementation. 
     9  - expression state after bind imp 
     10  - definition of the expression 
     11  - Type of the expression 
     12 
     13This can be used to see what intermediate definition and Type the compiler is generating for an expression. 
     14 
    415 
    516== Grammar == 
     
    1021}}} 
    1122 
    12 == Examples == 
     23== Example == 
    1324 
    1425{{{ 
    1526#!cobra 
    16 class Foo 
    17  
    18     def doFoo 
    19         ct_trace 'Compiling class Foo.doFoo' 
     27 x = nil 
     28 ct_trace x 
    2029        ... 
    2130}}} 
     31generates output like 
     32 
     33{{{ 
     34 
     35* Compile-time trace at Token(ID, 'ct_trace', 'ct_trace', ln 14, col 3, dec.cobra) 
     36    * before bind imp on expression: x = IdentifierExpr-sh(6682, didBindInh=false, didBindInt=false, didBindImp=false,  
     37token=Token(ID, 'x', 'x', ln 14, col 12,dec.cobra), name=x, type=nil, 6682) 
     38    * after bind imp on expression:  x = IdentifierExpr-sh(6682, didBindInh=false, didBindInt=false, didStartBindImp=true, didBindImp=true, token=Token(ID, 'x', 'x', ln 14, col 12, dec.cobra), name=x, type=NilableType-mi(15870, didStartBindInh=true, didBindInh=true, didStartBindInt=true, didBindInt=true, didBindImp=false, 15870),  
     39definition=LocalVar-mi(15871, name=x, didStartBindInh=true, didBindInh=true, didStartBindInt=true, didBindInt=true, didStartBindImp=true, didBindImp=true, token=Token(ID, 'x', 'x', ln 13, col 3, dec.cobra), isTracked=true, isTracked=true, 15871), 6682) 
     40    * definition = LocalVar(15871, "x" (ID), x, dynamic?) 
     41    * type = NilableType-sh(15870, didStartBindInh=true, didBindInh=true, didStartBindInt=true, didBindInt=true, didBindImp=false, wrappedType=DynamicType-mi(9750, didStartBindInh=true, didBindInh=true, didStartBindInt=true, didBindInt=true,  
     42didBindImp=false, 9750), 15870) 
     43}}}