File tree Expand file tree Collapse file tree 3 files changed +20
-7
lines changed
Expand file tree Collapse file tree 3 files changed +20
-7
lines changed Original file line number Diff line number Diff line change @@ -114,6 +114,7 @@ fileNames.forEach(function(fileName, index) {
114114 }
115115
116116 file . freeFunctionName = "git_" + fileName + "_free" ;
117+ file . createFunctionName = "git_" + fileName + "_create" ;
117118 }
118119
119120 // TODO Obsolete this.
@@ -136,12 +137,14 @@ fileNames.forEach(function(fileName, index) {
136137 return fnName === initFnName ;
137138 } ) ;
138139
139- // Doesn 't actually exist.
140+ // Free function doesn 't actually exist.
140141 if ( cFile . functions . indexOf ( file . freeFunctionName ) === - 1 ) {
141142 delete file . freeFunctionName ;
142143 }
143144
144-
145+ if ( cFile . functions . indexOf ( file . createFunctionName ) === - 1 ) {
146+ delete file . createFunctionName ;
147+ }
145148 var legacyFile = { } ;
146149
147150 if ( file . jsClassName . indexOf ( "Git" ) === 0 ) {
@@ -394,6 +397,12 @@ fileNames.forEach(function(fileName, index) {
394397 }
395398 } ) ;
396399
400+ if ( file . createFunctionName ) {
401+ file . cppCreateFunctionName = typeMap [ file . createFunctionName ] . cpp ;
402+ file . jsCreateFunctionName = typeMap [ file . createFunctionName ] . js ;
403+ delete file . createFunctionName ;
404+ }
405+
397406 files . push ( file ) ;
398407} ) ;
399408
Original file line number Diff line number Diff line change @@ -63,7 +63,11 @@ NAN_METHOD({{ cppClassName }}::New) {
6363 NanScope ();
6464
6565 if (args.Length () == 0 || !args[0 ]->IsExternal ()) {
66- return NanThrowError (" {{ cType }} is required." );
66+ {%if createFunctionName%}
67+ return NanThrowError (" A new {{ cppClassName }} cannot be instantiated. Use {{ jsCreateFunctionName }} instead." );
68+ {%else %}
69+ return NanThrowError (" A new {{ cppClassName }} cannot be instantiated." );
70+ {%endif%}
6771 }
6872
6973 {{ cppClassName }}* object = new {{ cppClassName }}(static_cast <{{ cType }} *>(Handle<External>::Cast (args[0 ])->Value ()), args[1 ]->BooleanValue ());
Original file line number Diff line number Diff line change @@ -91,18 +91,18 @@ describe("Commit", function() {
9191 history . on ( "commit" , function ( commit ) {
9292 historyCount ++ ;
9393 } ) ;
94-
94+
9595 history . on ( "end" , function ( commits ) {
9696 assert . equal ( historyCount , expectedHistoryCount ) ;
9797 assert . equal ( commits . length , expectedHistoryCount ) ;
9898
9999 done ( ) ;
100100 } ) ;
101-
101+
102102 history . on ( "error" , function ( err ) {
103103 assert . ok ( false ) ;
104104 } ) ;
105-
105+
106106 history . start ( ) ;
107107 } ) ;
108108
@@ -143,7 +143,7 @@ describe("Commit", function() {
143143 treeWalker . on ( "error" , function ( ) {
144144 assert . ok ( false ) ;
145145 } ) ;
146-
146+
147147 treeWalker . on ( "end" , function ( entries ) {
148148 assert . equal ( commitTreeEntryCount , expectedCommitTreeEntryCount ) ;
149149 done ( ) ;
You can’t perform that action at this time.
0 commit comments