View Single Post
Old 11-20-2011, 08:13 PM   #3632
Barade
User
 
Barade's Avatar
 
Join Date: May 2006
Posts: 163

Barade is on a distinguished road (14)

Default

Quote:
Originally Posted by Anitarf
That's what keyword is for:
Collapse JASS:
library Test
    private keyword Test2
    struct Test
        private Test2 member

        public static method create takes nothing returns thistype
            local thistype this = thistype.allocate()
            set this.member = Test2.create.evaluate() // Works now.
            return this
        endmethod
    endstruct

    private struct Test2
        static method create takes nothing returns thistype
            return .allocate() // It won't work unless you declare a custom create method.
        endmethod
    endstruct
endlibrary

Regarding the problem with the constant string, it seems to incorrectly identify // inside the string as a comment. You can just write the url without the "https://" part, it works just as well. If you absolutely must have that, you can use string concatenation to work around the issue.
Unfortunately, there's another bug with /// comments after constants in 0.A.2.B:
Collapse JASS:
 
public static constant string defaultOrderErrorMessage = A_TEXT_TARGET_TALKS_ALREADY ///
says
Quote:
Line 39697: Syntax Error, unexpected: end of line?
Line 39697: (At generated code): constant string s__ATalk_defaultOrderErrorMessage= A_TEXT_TARGET_TALKS_ALREADY /
Besides static if statements shouldn't ignore //! import statements (they don't ignore //! runtextmacro as well afaik).
I have some options which can be defined globally using constants and require more files to be imported.
Is there any interest in continuing the development of the JassHelper or to create a new vJass compiler? I would like to drop some unnecessary things, to allow more flexible encapsulation of declarations and to get something like "protected" into the language.
__________________
Barade is offline   Reply With Quote