mirror of
https://github.com/openharmony/developtools_ace-ets2bundle.git
synced 2026-07-22 12:36:01 -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(
|
const compilerOptions: ts.CompilerOptions = ts.readConfigFile(
|
||||||
path.resolve(__dirname, '../tsconfig.json'), ts.sys.readFile).config.compilerOptions;
|
path.resolve(__dirname, '../tsconfig.json'), ts.sys.readFile).config.compilerOptions;
|
||||||
Object.assign(compilerOptions, {
|
Object.assign(compilerOptions, {
|
||||||
|
'allowJs': false,
|
||||||
'moduleResolution': ts.ModuleResolutionKind.NodeJs,
|
'moduleResolution': ts.ModuleResolutionKind.NodeJs,
|
||||||
'target': ts.ScriptTarget.ES2017,
|
'target': ts.ScriptTarget.ES2017,
|
||||||
'baseUrl': path.resolve(projectConfig.projectPath),
|
'baseUrl': path.resolve(projectConfig.projectPath),
|
||||||
|
|||||||
@@ -395,8 +395,8 @@ export function collectExtend(collectionSet: Map<string, Set<string>>, component
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function isExtendFunction(node: ts.FunctionDeclaration): string {
|
export function isExtendFunction(node: ts.FunctionDeclaration): string {
|
||||||
if (node.decorators && node.decorators[0].expression &&
|
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.expression.escapedText.toString() === CHECK_COMPONENT_EXTEND_DECORATOR &&
|
||||||
node.decorators[0].expression.arguments) {
|
node.decorators[0].expression.arguments) {
|
||||||
return node.decorators[0].expression.arguments[0].escapedText.toString();
|
return node.decorators[0].expression.arguments[0].escapedText.toString();
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ import {
|
|||||||
import { projectConfig } from '../main';
|
import { projectConfig } from '../main';
|
||||||
import { collectExtend } from './process_ui_syntax';
|
import { collectExtend } from './process_ui_syntax';
|
||||||
import { importModuleCollection } from "./ets_checker";
|
import { importModuleCollection } from "./ets_checker";
|
||||||
|
import { isExtendFunction } from "./process_ui_syntax";
|
||||||
|
|
||||||
export interface ComponentCollection {
|
export interface ComponentCollection {
|
||||||
entryComponent: string;
|
entryComponent: string;
|
||||||
@@ -300,6 +301,10 @@ function visitAllNode(node: ts.Node, sourceFileNode: ts.SourceFile, allComponent
|
|||||||
if (ts.isMethodDeclaration(node) && hasDecorator(node, COMPONENT_BUILDER_DECORATOR)) {
|
if (ts.isMethodDeclaration(node) && hasDecorator(node, COMPONENT_BUILDER_DECORATOR)) {
|
||||||
CUSTOM_BUILDER_METHOD.add(node.name.getText());
|
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));
|
node.getChildren().forEach((item: ts.Node) => visitAllNode(item, sourceFileNode, allComponentNames, log));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user