ciscoheat / erazor

A Haxe implementation of the Razor view engine
19 stars 15 forks source link

haxe Statics don't work #11

Open postite opened 11 years ago

postite commented 11 years ago

Hi guys ! i recently noticed that haxe Statics like Math or Std doesnt work (at least for macros). i ran the test to verify and it doesnt pass !! (..) /test/erazor/TestMacro.hx:123: character 10 : { x : Float } has no field Math

even putting the typedef as Dynamic i get the same error. Is it a non-feature, a known bug ? are there some solutions using Helpers or what ? thx

fponticelli commented 11 years ago

This is not a bug but a feature. The point is that for runtime templates you need to explicitly pass whatever you want to expose. So if you want to pass the Math functions you should reference Math in your data object. The idea is to secure templates from improper usage of certain methods. Another option would be to extend erazor to include certain helper types.