Click here to Skip to main content
15,891,976 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralI feel kind of bad about this Pin
honey the codewitch1-Dec-19 4:43
mvahoney the codewitch1-Dec-19 4:43 
GeneralRe: I feel kind of bad about this Pin
PIEBALDconsult1-Dec-19 5:41
mvePIEBALDconsult1-Dec-19 5:41 
GeneralRe: I feel kind of bad about this Pin
honey the codewitch1-Dec-19 5:45
mvahoney the codewitch1-Dec-19 5:45 
GeneralRe: I feel kind of bad about this Pin
BillWoodruff1-Dec-19 5:48
professionalBillWoodruff1-Dec-19 5:48 
GeneralRe: I feel kind of bad about this Pin
Ravi Bhavnani1-Dec-19 10:31
professionalRavi Bhavnani1-Dec-19 10:31 
GeneralRe: I feel kind of bad about this Pin
honey the codewitch1-Dec-19 10:34
mvahoney the codewitch1-Dec-19 10:34 
GeneralRe: I feel kind of bad about this Pin
Super Lloyd1-Dec-19 13:31
Super Lloyd1-Dec-19 13:31 
GeneralRe: I feel kind of bad about this Pin
honey the codewitch1-Dec-19 13:43
mvahoney the codewitch1-Dec-19 13:43 
I hope so. It gets instantiated a lot. I use it during code dom visitation, on any "marked" expression I need to "patch"

Basically, I'm using the CodeDOM as my abstract syntax tree to hold the results of my parse.


But without type information applied to it the tree is ambiguous. That is,
C#
foo.bar.baz()


Could be a delegate invocation of field baz, or a delegate invocation of property baz.
foo could be a variable, a method argument, a type (where bar is a static field), an instance field, etc.

So for you to even know what to compile from this parse, you need to apply type information from the tree.

The CodeDOM has different objects for reference fields, properties, methods and events, plus arguments and variables. So when I parse, i plug the tree with "dummies" - foo is always treated as a variable until it's patched. xxx(...) always refers to a delegate invocation until it's patched.

While I patch, I "visit" each object in the CodeDOM tree, and look for these dummies I inserted. When I find one, I "get scope" which returns one of the monsters the partial code for is above.

I then use that data to match it against the names of each of the dummies I inserted - to see what's a field and what's a method and what's a property, and what's a type, etc. I then use this information to fixup the tree with the appropriate objects, creating compilable code.

Not much different than what the C# compiler does internally.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

GeneralI've probably set the record for the amount of code I've written that nobody will use. Pin
honey the codewitch1-Dec-19 4:22
mvahoney the codewitch1-Dec-19 4:22 
GeneralRe: I've probably set the record for the amount of code I've written that nobody will use. Pin
RickZeeland1-Dec-19 4:32
mveRickZeeland1-Dec-19 4:32 
GeneralRe: I've probably set the record for the amount of code I've written that nobody will use. Pin
OriginalGriff1-Dec-19 4:34
mveOriginalGriff1-Dec-19 4:34 
GeneralRe: I've probably set the record for the amount of code I've written that nobody will use. Pin
honey the codewitch1-Dec-19 4:35
mvahoney the codewitch1-Dec-19 4:35 
GeneralRe: I've probably set the record for the amount of code I've written that nobody will use. Pin
OriginalGriff1-Dec-19 4:44
mveOriginalGriff1-Dec-19 4:44 
GeneralRe: I've probably set the record for the amount of code I've written that nobody will use. Pin
honey the codewitch1-Dec-19 4:45
mvahoney the codewitch1-Dec-19 4:45 
GeneralRe: I've probably set the record for the amount of code I've written that nobody will use. Pin
OriginalGriff1-Dec-19 4:48
mveOriginalGriff1-Dec-19 4:48 
GeneralRe: I've probably set the record for the amount of code I've written that nobody will use. Pin
OriginalGriff1-Dec-19 4:46
mveOriginalGriff1-Dec-19 4:46 
GeneralRe: I've probably set the record for the amount of code I've written that nobody will use. Pin
RickZeeland1-Dec-19 4:47
mveRickZeeland1-Dec-19 4:47 
GeneralRe: I've probably set the record for the amount of code I've written that nobody will use. Pin
Sander Rossel1-Dec-19 6:29
professionalSander Rossel1-Dec-19 6:29 
JokeRe: I've probably set the record for the amount of code I've written that nobody will use. Pin
honey the codewitch1-Dec-19 6:34
mvahoney the codewitch1-Dec-19 6:34 
GeneralRe: I've probably set the record for the amount of code I've written that nobody will use. Pin
#realJSOP1-Dec-19 8:19
mve#realJSOP1-Dec-19 8:19 
GeneralRe: I've probably set the record for the amount of code I've written that nobody will use. Pin
honey the codewitch1-Dec-19 8:24
mvahoney the codewitch1-Dec-19 8:24 
GeneralAnother one bites the dust: Irving Burgie Pin
OriginalGriff1-Dec-19 2:23
mveOriginalGriff1-Dec-19 2:23 
GeneralRe: Another one bites the dust: Irving Burgie Pin
RickZeeland1-Dec-19 3:15
mveRickZeeland1-Dec-19 3:15 
GeneralRe: Another one bites the dust: Irving Burgie Pin
OriginalGriff1-Dec-19 3:24
mveOriginalGriff1-Dec-19 3:24 
GeneralQuiet day today, isn't it? Pin
OriginalGriff1-Dec-19 1:38
mveOriginalGriff1-Dec-19 1:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.