mirror of
https://github.com/openharmony/developtools_ace-ets2bundle.git
synced 2026-07-21 12:05:24 -04:00
fix @extend Signed-off-by: houhaoyu <houhaoyu@huawei.com> Change-Id: I6149aca8befdc3330b2513366e44917b97d2d53e
This commit is contained in:
@@ -51,6 +51,7 @@ export function createLanguageService(rootFileNames: string[]): ts.LanguageServi
|
||||
const compilerOptions: ts.CompilerOptions = ts.readConfigFile(
|
||||
path.resolve(__dirname, '../tsconfig.json'), ts.sys.readFile).config.compilerOptions;
|
||||
Object.assign(compilerOptions, {
|
||||
'allowJs': false,
|
||||
'moduleResolution': ts.ModuleResolutionKind.NodeJs,
|
||||
'target': ts.ScriptTarget.ES2017,
|
||||
'baseUrl': path.resolve(projectConfig.projectPath),
|
||||
|
||||
@@ -395,8 +395,8 @@ export function collectExtend(collectionSet: Map<string, Set<string>>, component
|
||||
}
|
||||
}
|
||||
|
||||
function isExtendFunction(node: ts.FunctionDeclaration): string {
|
||||
if (node.decorators && node.decorators[0].expression &&
|
||||
export function isExtendFunction(node: ts.FunctionDeclaration): string {
|
||||
if (node.decorators && node.decorators[0].expression && node.decorators[0].expression.expression &&
|
||||
node.decorators[0].expression.expression.escapedText.toString() === CHECK_COMPONENT_EXTEND_DECORATOR &&
|
||||
node.decorators[0].expression.arguments) {
|
||||
return node.decorators[0].expression.arguments[0].escapedText.toString();
|
||||
|
||||
@@ -62,6 +62,7 @@ import {
|
||||
import { projectConfig } from '../main';
|
||||
import { collectExtend } from './process_ui_syntax';
|
||||
import { importModuleCollection } from "./ets_checker";
|
||||
import { isExtendFunction } from "./process_ui_syntax";
|
||||
|
||||
export interface ComponentCollection {
|
||||
entryComponent: string;
|
||||
@@ -300,6 +301,10 @@ function visitAllNode(node: ts.Node, sourceFileNode: ts.SourceFile, allComponent
|
||||
if (ts.isMethodDeclaration(node) && hasDecorator(node, COMPONENT_BUILDER_DECORATOR)) {
|
||||
CUSTOM_BUILDER_METHOD.add(node.name.getText());
|
||||
}
|
||||
if (ts.isFunctionDeclaration(node) && isExtendFunction(node)) {
|
||||
let componentName: string = isExtendFunction(node);
|
||||
collectExtend(EXTEND_ATTRIBUTE, componentName, node.name.getText());
|
||||
}
|
||||
node.getChildren().forEach((item: ts.Node) => visitAllNode(item, sourceFileNode, allComponentNames, log));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user