parent
							
								
									78946fe9fa
								
							
						
					
					
						commit
						96ae348648
					
				| @ -483,8 +483,8 @@ function runTsc(project, done) { | ||||
| } | ||||
| 
 | ||||
| gulp.task('test.js', function(done) { | ||||
|   runSequence('test.unit.tools/ci', 'test.transpiler.unittest', 'test.unit.js/ci', | ||||
|               'test.unit.cjs/ci', 'test.compiler_cli', 'test.typings', 'check-public-api', | ||||
|   runSequence('test.compiler_cli', 'test.unit.tools/ci', 'test.transpiler.unittest', | ||||
|               'test.unit.js/ci', 'test.unit.cjs/ci', 'test.typings', 'check-public-api', | ||||
|               sequenceComplete(done)); | ||||
| }); | ||||
| 
 | ||||
|  | ||||
| @ -70,7 +70,7 @@ export interface StaticReflectorHost { | ||||
|  * | ||||
|  * This token is unique for a moduleId and name and can be used as a hash table key. | ||||
|  */ | ||||
| export class StaticSymbol { | ||||
| export class StaticSymbol implements ModuleContext { | ||||
|   constructor(public moduleId: string, public filePath: string, public name: string) {} | ||||
| } | ||||
| 
 | ||||
| @ -336,7 +336,7 @@ export class StaticReflector implements ReflectorReader { | ||||
|                 if (isClassMetadata(declarationValue)) { | ||||
|                   result = staticSymbol; | ||||
|                 } else { | ||||
|                   const newModuleContext = | ||||
|                   let newModuleContext = | ||||
|                       new ModuleContext(staticSymbol.moduleId, staticSymbol.filePath); | ||||
|                   result = _this.simplify(newModuleContext, declarationValue, crossModules); | ||||
|                 } | ||||
| @ -382,9 +382,6 @@ export class StaticReflector implements ReflectorReader { | ||||
|   } | ||||
| 
 | ||||
|   private getTypeMetadata(type: StaticSymbol): {[key: string]: any} { | ||||
|     if (!(type instanceof StaticSymbol)) { | ||||
|       throw new Error('not static type'); | ||||
|     } | ||||
|     let moduleMetadata = this.getModuleMetadata(type.filePath); | ||||
|     let result = moduleMetadata['metadata'][type.name]; | ||||
|     if (!isPresent(result)) { | ||||
|  | ||||
| @ -234,13 +234,13 @@ export function main() { | ||||
|     }); | ||||
| 
 | ||||
|     it('should simplify a module reference across modules', () => { | ||||
|       expect(crossModuleSimplify({moduleId: '', filePath: '/src/cases'}, | ||||
|       expect(crossModuleSimplify(new ModuleContext('', '/src/cases'), | ||||
|                                  ({__symbolic: "reference", module: "./extern", name: "s"}))) | ||||
|           .toEqual("s"); | ||||
|     }); | ||||
| 
 | ||||
|     it('should simplify a module reference without crossing modules', () => { | ||||
|       expect(singleModuleSimplify({moduleId: '', filePath: '/src/cases'}, | ||||
|       expect(singleModuleSimplify(new ModuleContext('', '/src/cases'), | ||||
|                                   ({__symbolic: "reference", module: "./extern", name: "s"}))) | ||||
|           .toEqual(host.getStaticSymbol('', '/src/extern.d.ts', 's')); | ||||
|     }); | ||||
| @ -261,7 +261,7 @@ class MockReflectorHost implements StaticReflectorHost { | ||||
|   } | ||||
| 
 | ||||
|   // In tests, assume that symbols are not re-exported
 | ||||
|   findDeclaration(modulePath: string, symbolName: string, containingFile: string): StaticSymbol { | ||||
|   findDeclaration(modulePath: string, symbolName: string, containingFile?: string): StaticSymbol { | ||||
|     function splitPath(path: string): string[] { return path.split(/\/|\\/g); } | ||||
| 
 | ||||
|     function resolvePath(pathParts: string[]): string { | ||||
|  | ||||
| @ -14,14 +14,14 @@ export function main() { | ||||
| 
 | ||||
| // A service available to the Injector, used by the HelloCmp component.
 | ||||
| @Injectable() | ||||
| class GreetingService { | ||||
| export class GreetingService { | ||||
|   greeting: string = 'hello'; | ||||
| } | ||||
| 
 | ||||
| // Directives are light-weight. They don't allow new
 | ||||
| // expression contexts (use @Component for those needs).
 | ||||
| @Directive({selector: '[red]'}) | ||||
| class RedDec { | ||||
| export class RedDec { | ||||
|   // ElementRef is always injectable and it wraps the element on which the
 | ||||
|   // directive was found by the compiler.
 | ||||
|   constructor(el: ElementRef, renderer: Renderer) { | ||||
| @ -34,8 +34,6 @@ class RedDec { | ||||
| //   ShadowDom.(http://www.html5rocks.com/en/tutorials/webcomponents/shadowdom/)
 | ||||
| // - Directive - add behavior to existing elements.
 | ||||
| 
 | ||||
| // @Component is AtScript syntax to annotate the HelloCmp class as an Angular
 | ||||
| // 2.0 component.
 | ||||
| @Component({ | ||||
|   // The Selector prop tells Angular on which elements to instantiate this
 | ||||
|   // class. The syntax supported is a basic subset of CSS selectors, for example
 | ||||
|  | ||||
| @ -24,8 +24,6 @@ class RedDec { | ||||
| //   ShadowDom.(http://www.html5rocks.com/en/tutorials/webcomponents/shadowdom/)
 | ||||
| // - Directive - add behavior to existing elements.
 | ||||
| 
 | ||||
| // @Component is AtScript syntax to annotate the HelloCmp class as an Angular
 | ||||
| // 2.0 component.
 | ||||
| @Component({ | ||||
|   // The Selector prop tells Angular on which elements to instantiate this
 | ||||
|   // class. The syntax supported is a basic subset of CSS selectors, for example
 | ||||
|  | ||||
| @ -68,7 +68,7 @@ export class NodeReflectorHost implements StaticReflectorHost { | ||||
|       if (!symbol) { | ||||
|         throw new Error(`can't find symbol ${symbolName} exported from module ${filePath}`); | ||||
|       } | ||||
|       while (symbol && | ||||
|       if (symbol && | ||||
|           symbol.flags & ts.SymbolFlags.Alias) {  // This is an alias, follow what it aliases
 | ||||
|         symbol = tc.getAliasedSymbol(symbol); | ||||
|       } | ||||
|  | ||||
| @ -117,18 +117,20 @@ describe('Evaluator', () => { | ||||
|     expect(evaluator.evaluateNode(findVar(forwardRef, 'bFalse').initializer)).toEqual(false); | ||||
|   }); | ||||
| 
 | ||||
|   it('should return new expressions', () => { | ||||
|   fit('should return new expressions', () => { | ||||
|     evaluator = | ||||
|         new Evaluator(typeChecker, symbols, [{from: './classes', namedImports: [{name: 'Value'}]}]); | ||||
|     var newExpression = program.getSourceFile('newExpression.ts'); | ||||
|     expect(evaluator.evaluateNode(findVar(newExpression, 'someValue').initializer)) | ||||
|         .toEqual({ | ||||
|           __symbolic: "new", | ||||
|           expression: {__symbolic: "reference", name: "Value", module: "classes.ts"}, | ||||
|           expression: {__symbolic: "reference", name: "Value", module: "./classes"}, | ||||
|           arguments: ["name", 12] | ||||
|         }); | ||||
|     expect(evaluator.evaluateNode(findVar(newExpression, 'complex').initializer)) | ||||
|         .toEqual({ | ||||
|           __symbolic: "new", | ||||
|           expression: {__symbolic: "reference", name: "Value", module: "classes.ts"}, | ||||
|           expression: {__symbolic: "reference", name: "Value", module: "./classes"}, | ||||
|           arguments: ["name", 12] | ||||
|         }); | ||||
|   }); | ||||
|  | ||||
| @ -1031,7 +1031,7 @@ const COMPILER = [ | ||||
|   'CompileDirectiveMetadata.type:CompileTypeMetadata', | ||||
|   'CompileDirectiveMetadata.viewQueries:CompileQueryMetadata[]', | ||||
|   'CompileTemplateMetadata', | ||||
|   'CompileTemplateMetadata.constructor({encapsulation,template,templateUrl,styles,styleUrls,ngContentSelectors}:{encapsulation?:ViewEncapsulation, template?:string, templateUrl?:string, styles?:string[], styleUrls?:string[], ngContentSelectors?:string[]})', | ||||
|   'CompileTemplateMetadata.constructor({encapsulation,template,templateUrl,styles,styleUrls,ngContentSelectors,baseUrl}:{encapsulation?:ViewEncapsulation, template?:string, templateUrl?:string, styles?:string[], styleUrls?:string[], ngContentSelectors?:string[], baseUrl?:string})', | ||||
|   'CompileTemplateMetadata.encapsulation:ViewEncapsulation', | ||||
|   'CompileTemplateMetadata.fromJson(data:{[key:string]:any}):CompileTemplateMetadata', | ||||
|   'CompileTemplateMetadata.ngContentSelectors:string[]', | ||||
| @ -1040,6 +1040,7 @@ const COMPILER = [ | ||||
|   'CompileTemplateMetadata.template:string', | ||||
|   'CompileTemplateMetadata.templateUrl:string', | ||||
|   'CompileTemplateMetadata.toJson():{[key:string]:any}', | ||||
|   'CompileTemplateMetadata.baseUrl:string', | ||||
|   'CompileTypeMetadata', | ||||
|   'CompileTypeMetadata.diDeps:CompileDiDependencyMetadata[]', | ||||
|   'CompileTypeMetadata.fromJson(data:{[key:string]:any}):CompileTypeMetadata', | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user