File tree 2 files changed +18
-0
lines changed
2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,10 @@ class ReactComponentMacro {
13
13
react. ReactTypeMacro .alterComponentSignatures ,
14
14
react.wrap. ReactWrapperMacro .buildComponent ,
15
15
16
+ #if (debug && !react_ignore_empty_render)
17
+ react. ReactTypeMacro .ensureRenderOverride ,
18
+ #end
19
+
16
20
#if (debug && react_render_warning)
17
21
react. ReactDebugMacro .buildComponent ,
18
22
#end
Original file line number Diff line number Diff line change @@ -35,6 +35,20 @@ class ReactTypeMacro
35
35
return fields ;
36
36
}
37
37
38
+ public static function ensureRenderOverride (inClass : ClassType , fields : Array <Field >): Array <Field >
39
+ {
40
+ if (! inClass .isExtern )
41
+ if (! Lambda .exists (fields , function (f ) return f .name == ' render' ))
42
+ Context .warning (
43
+ ' Component ${inClass .name }: '
44
+ + ' No `render` method found: you may have forgotten to '
45
+ + ' override `render` from `ReactComponent`.' ,
46
+ inClass .pos
47
+ );
48
+
49
+ return fields ;
50
+ }
51
+
38
52
static function hasSetState (fields : Array <Field >) {
39
53
for (field in fields )
40
54
{
You can’t perform that action at this time.
0 commit comments