bazel: compiler codegen test

This commit is contained in:
Jason Choi
2016-08-19 23:47:32 -07:00
parent fb3b490198
commit b5f97b0410
7 changed files with 82 additions and 15 deletions

View File

@ -0,0 +1,26 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import 'reflect-metadata';
import {writeFileSync} from 'fs';
import {emit as typedEmit} from './output_emitter_codegen_typed';
import {emit as untypedEmit} from './output_emitter_codegen_untyped';
// Usage:
// node path/to/output_emitter_codegen [typed output file] [untyped output file]
function main(argv: string[]) {
const [typed, untyped] = argv;
writeFileSync(typed, typedEmit());
writeFileSync(untyped, untypedEmit());
}
if (require.main === module) {
main(process.argv.slice(2));
}

View File

@ -13,16 +13,8 @@ import {TypeScriptEmitter} from '@angular/compiler/src/output/ts_emitter';
import {print} from '@angular/facade/src/lang';
import {assetUrl} from '@angular/compiler/src/util';
function unimplemented(): any {
throw new Error('unimplemented');
}
import {SimpleJsImportGenerator, codegenExportsVars, codegenStmts} from './output_emitter_util';
export function getExpressions(): any {
return unimplemented();
}
// Generator
export function emit() {
const emitter = new TypeScriptEmitter(new SimpleJsImportGenerator());

View File

@ -14,10 +14,6 @@ import {assetUrl} from '@angular/compiler/src/util';
import {SimpleJsImportGenerator, codegenExportsVars, codegenStmts} from './output_emitter_util';
export function getExpressions(): any {
throw new Error('unimplemented');
}
// Generator
export function emit() {
var emitter = new JavaScriptEmitter(new SimpleJsImportGenerator());

View File

@ -0,0 +1,9 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
export function getExpressions(): any;

View File

@ -0,0 +1,9 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
export function getExpressions(): any;

View File

@ -15,8 +15,8 @@ import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
import {browserDetection} from '@angular/platform-browser/testing/browser_util';
import {expect} from '@angular/platform-browser/testing/matchers';
import * as typed from './output_emitter_codegen_typed';
import * as untyped from './output_emitter_codegen_untyped';
import * as typed from './output_emitter_generated_typed';
import * as untyped from './output_emitter_generated_untyped';
import {ExternalClass, codegenStmts} from './output_emitter_util';
export function main() {