@ -12,7 +12,7 @@ import {isBlank} from '../../src/facade/lang';
|
||||
import {JavaScriptEmitter} from '@angular/compiler/src/output/js_emitter';
|
||||
import {CompileIdentifierMetadata} from '@angular/compiler/src/compile_metadata';
|
||||
import * as o from '@angular/compiler/src/output/output_ast';
|
||||
import {SimpleJsImportGenerator} from '../offline_compiler_util';
|
||||
import {SimpleJsImportGenerator} from './output_emitter_util';
|
||||
|
||||
var someModuleUrl = 'asset:somePackage/lib/somePath';
|
||||
var anotherModuleUrl = 'asset:somePackage/lib/someOtherPath';
|
||||
|
@ -15,9 +15,8 @@ import {TypeScriptEmitter} from '@angular/compiler/src/output/ts_emitter';
|
||||
import {unimplemented} from '../../src/facade/exceptions';
|
||||
import {IS_DART, print} from '../../src/facade/lang';
|
||||
import {assetUrl} from '../../src/util';
|
||||
import {SimpleJsImportGenerator} from '../offline_compiler_util';
|
||||
|
||||
import {codegenExportsVars, codegenStmts} from './output_emitter_util';
|
||||
import {SimpleJsImportGenerator, codegenExportsVars, codegenStmts} from './output_emitter_util';
|
||||
|
||||
export function getExpressions(): any {
|
||||
return unimplemented();
|
||||
|
@ -12,9 +12,8 @@ import {JavaScriptEmitter} from '@angular/compiler/src/output/js_emitter';
|
||||
import {unimplemented} from '../../src/facade/exceptions';
|
||||
import {print} from '../../src/facade/lang';
|
||||
import {assetUrl} from '../../src/util';
|
||||
import {SimpleJsImportGenerator} from '../offline_compiler_util';
|
||||
|
||||
import {codegenExportsVars, codegenStmts} from './output_emitter_util';
|
||||
import {SimpleJsImportGenerator, codegenExportsVars, codegenStmts} from './output_emitter_util';
|
||||
|
||||
export function getExpressions(): any {
|
||||
return unimplemented();
|
||||
|
@ -14,7 +14,7 @@ import * as typed from './output_emitter_codegen_typed';
|
||||
import * as untyped from './output_emitter_codegen_untyped';
|
||||
import {jitStatements} from '@angular/compiler/src/output/output_jit';
|
||||
import {interpretStatements} from '@angular/compiler/src/output/output_interpreter';
|
||||
import {codegenStmts, ExternalClass, DynamicClassInstanceFactory} from './output_emitter_util';
|
||||
import {codegenStmts, ExternalClass} from './output_emitter_util';
|
||||
import {EventEmitter} from '@angular/core';
|
||||
import {ViewType} from '@angular/core/src/linker/view_type';
|
||||
import {BaseException} from '@angular/core';
|
||||
@ -23,8 +23,7 @@ import {browserDetection} from '@angular/platform-browser/testing/browser_util'
|
||||
|
||||
export function main() {
|
||||
var outputDefs: any[] /** TODO #9100 */ = []; outputDefs.push({
|
||||
'getExpressions': () => interpretStatements(
|
||||
codegenStmts, 'getExpressions', new DynamicClassInstanceFactory()),
|
||||
'getExpressions': () => interpretStatements(codegenStmts, 'getExpressions'),
|
||||
'name': 'interpreted'
|
||||
});
|
||||
if (IS_DART || !getDOM().supportsDOMEvents()) {
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
import {CompileIdentifierMetadata} from '@angular/compiler/src/compile_metadata';
|
||||
import * as o from '@angular/compiler/src/output/output_ast';
|
||||
import {DynamicInstance, InstanceFactory} from '@angular/compiler/src/output/output_interpreter';
|
||||
import {ImportGenerator} from '@angular/compiler/src/output/path_util';
|
||||
import {assetUrl} from '@angular/compiler/src/util';
|
||||
import {EventEmitter} from '@angular/core';
|
||||
import {ViewType} from '@angular/core/src/linker/view_type';
|
||||
@ -253,22 +253,13 @@ function createOperatorFn(op: o.BinaryOperator) {
|
||||
o.DYNAMIC_TYPE);
|
||||
}
|
||||
|
||||
export class DynamicClassInstanceFactory implements InstanceFactory {
|
||||
createInstance(
|
||||
superClass: any, clazz: any, args: any[], props: Map<string, any>,
|
||||
getters: Map<string, Function>, methods: Map<string, Function>): any {
|
||||
if (superClass === ExternalClass) {
|
||||
return new _InterpretiveDynamicClass(args, clazz, props, getters, methods);
|
||||
export class SimpleJsImportGenerator implements ImportGenerator {
|
||||
getImportPath(moduleUrlStr: string, importedUrlStr: string): string {
|
||||
var importedAssetUrl = ImportGenerator.parseAssetUrl(importedUrlStr);
|
||||
if (importedAssetUrl) {
|
||||
return `${importedAssetUrl.packageName}/${importedAssetUrl.modulePath}`;
|
||||
} else {
|
||||
return importedUrlStr;
|
||||
}
|
||||
throw new BaseException(`Can't instantiate class ${superClass} in interpretative mode`);
|
||||
}
|
||||
}
|
||||
|
||||
class _InterpretiveDynamicClass extends ExternalClass implements DynamicInstance {
|
||||
constructor(
|
||||
args: any[], public clazz: any, public props: Map<string, any>,
|
||||
public getters: Map<string, Function>, public methods: Map<string, Function>) {
|
||||
super(args[0]);
|
||||
}
|
||||
childMethod(a: any /** TODO #9100 */) { return this.methods.get('childMethod')(a); }
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ import {isBlank} from '../../src/facade/lang';
|
||||
import {TypeScriptEmitter} from '@angular/compiler/src/output/ts_emitter';
|
||||
import {CompileIdentifierMetadata} from '@angular/compiler/src/compile_metadata';
|
||||
import * as o from '@angular/compiler/src/output/output_ast';
|
||||
import {SimpleJsImportGenerator} from '../offline_compiler_util';
|
||||
import {SimpleJsImportGenerator} from './output_emitter_util';
|
||||
|
||||
var someModuleUrl = 'asset:somePackage/lib/somePath';
|
||||
var anotherModuleUrl = 'asset:somePackage/lib/someOtherPath';
|
||||
|
Reference in New Issue
Block a user