-
-
Save adamcameron/38083f39b0c4d15c3af38075d695695c to your computer and use it in GitHub Desktop.
Showing how CF doesn't respect imports for extends attributes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
component { | |
loadMappings() | |
private void function loadMappings() { | |
thisDirectory = getDirectoryFromPath(getCurrentTemplatePath()) | |
this.mappings["/mine"] = "#thisDirectory#myApp" | |
this.mappings["/theirs"] = "#thisDirectory#theirLib" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import theirs.TheirBase | |
component extends=TheirBase { | |
function f() { | |
var fromBase = super.f() | |
return "from MySub: #fromBase#" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
component extends=theirs.TheirBase { | |
function f() { | |
var fromBase = super.f() | |
return "from MySub: #fromBase#" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
import mine.MySubUsingImport | |
import mine.MySubUsingQualified | |
import theirs.TheirBase | |
try { | |
writeOutput("Using import for creating TheirBase<br>") | |
theirBase = new TheirBase() | |
writeOutput(theirBase.f()) | |
} catch (any e) { | |
writeDump([ | |
message = e.message, | |
detail = e.detail | |
]) | |
} | |
writeOutput("<hr>") | |
try { | |
writeOutput("Using import for extexding TheirBase<br>") | |
mySubUsingImport = new MySubUsingImport() | |
writeOutput(mySubUsingImport.f()) | |
} catch (any e) { | |
writeDump([ | |
message = e.message, | |
detail = e.detail | |
]) | |
} | |
writeOutput("<hr>") | |
try { | |
writeOutput("Using fully-qualified path for extexding TheirBase<br>") | |
mySubUsingImport = new MySubUsingQualified() | |
writeOutput(mySubUsingImport.f()) | |
} catch (any e) { | |
writeDump([ | |
message = e.message, | |
detail = e.detail | |
]) | |
} | |
writeOutput("<hr>") | |
</cfscript> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
component { | |
function f() { | |
return "from TheirBase" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
File structure should be:
Run test.cfm
Works fine on Lucee.
On CF:
Expected: should bloody work.