@@ -110,14 +110,15 @@ class ScriptTreeGeneratorStub {
110110    } 
111111} 
112112
113+ // These are part of the old compiler's API. 
113114const  TYPE_NUMBER  =  1 ; 
114115const  TYPE_STRING  =  2 ; 
115116const  TYPE_BOOLEAN  =  3 ; 
116117const  TYPE_UNKNOWN  =  4 ; 
117118const  TYPE_NUMBER_NAN  =  5 ; 
118119
119120/** 
120-  * Part of the old compiler's public  API. 
121+  * Part of the old compiler's API. 
121122 */ 
122123class  TypedInput  { 
123124    /** 
@@ -132,42 +133,50 @@ class TypedInput {
132133        this . source  =  source ; 
133134
134135        if  ( typeOrIntermediate  instanceof  IntermediateInput )  { 
136+             // Path used by the compatibility layer itself 
137+ 
135138            /** 
136139             * @type  {IntermediateInput } 
137140             */ 
138141            this . intermediate  =  typeOrIntermediate ; 
142+ 
143+             /** 
144+              * @type  {number } See TYPE_* constants above 
145+              */ 
146+             this . type  =  TYPE_UNKNOWN ; 
139147        }  else  { 
148+             // Path used by extensions 
140149            this . intermediate  =  null ; 
141150            this . type  =  typeOrIntermediate ; 
142151        } 
143152    } 
144153
145154    asNumber  ( )  { 
146-         throw   new   Error ( 'TODO asNumber' ) ; 
155+         return   `(+ ${ this . source }  || 0)` ; 
147156    } 
148157
149158    asNumberOrNaN  ( )  { 
150-         throw   new   Error ( 'TODO asNumberOrNaN' ) ; 
159+         return   `(+ ${ this . source } )` ; 
151160    } 
152161
153162    asString  ( )  { 
154-         throw   new   Error ( 'TODO asString' ) ; 
163+         return   `("" +  ${ this . source } )` ; 
155164    } 
156165
157166    asBoolean  ( )  { 
158-         throw   new   Error ( 'TODO asBoolean' ) ; 
167+         return   `toBoolean( ${ this . source } )` ; 
159168    } 
160169
161170    asColor  ( )  { 
162-         throw   new   Error ( 'TODO asColor' ) ; 
171+         return   this . asUnknown ( ) ; 
163172    } 
164173
165174    asUnknown  ( )  { 
166175        return  this . source ; 
167176    } 
168177
169178    asSafe  ( )  { 
170-         return  this . source ; 
179+         return  this . asUnknown ( ) ; 
171180    } 
172181
173182    isAlwaysNumber  ( )  { 
@@ -187,7 +196,7 @@ class TypedInput {
187196} 
188197
189198/** 
190-  * Part of the old compiler's public  API. 
199+  * Part of the old compiler's API. 
191200 */ 
192201class  VariablePool  { 
193202    constructor  ( prefix )  { 
@@ -201,7 +210,7 @@ class VariablePool {
201210} 
202211
203212/** 
204-  * Part of the old compiler's public  API. 
213+  * Part of the old compiler's API. 
205214 */ 
206215class  Frame  { 
207216    constructor  ( isLoop )  { 
@@ -296,7 +305,7 @@ class JSGeneratorStub {
296305} 
297306
298307/** 
299-  * Part of old compiler's public  API. 
308+  * Part of old compiler's API. 
300309 */ 
301310JSGeneratorStub . unstable_exports  =  { 
302311    TYPE_NUMBER , 
0 commit comments