mirror of
https://gitee.com/openharmony/developtools_ace_ets2bundle
synced 2024-11-23 00:19:53 +00:00
!3913 fix staticCode 编译后产物丢失
Merge pull request !3913 from Bo Jiang/master_1
This commit is contained in:
commit
2d11de75e9
@ -240,6 +240,7 @@ function processMembers(members: ts.NodeArray<ts.ClassElement>, parentComponentN
|
||||
processPropertyUnchanged(result, purgeVariableDepStatements);
|
||||
}
|
||||
}
|
||||
staticBlock(item, newMembers);
|
||||
if (ts.isMethodDeclaration(item) && item.name) {
|
||||
updateItem =
|
||||
processComponentMethod(item, context, log, buildCount);
|
||||
@ -274,6 +275,12 @@ function processMembers(members: ts.NodeArray<ts.ClassElement>, parentComponentN
|
||||
return newMembers;
|
||||
}
|
||||
|
||||
function staticBlock(item: ts.ClassElement, newMembers: ts.ClassElement[]): void {
|
||||
if (ts.isClassStaticBlockDeclaration(item) && item.body && ts.isBlock(item.body)) {
|
||||
newMembers.push(item);
|
||||
}
|
||||
}
|
||||
|
||||
export function decoratorAssignParams(decoratorNode: readonly ts.Decorator[], context: ts.TransformationContext,
|
||||
creezeParam: FreezeParamType): boolean {
|
||||
if (decoratorNode && Array.isArray(decoratorNode) && decoratorNode.length) {
|
||||
|
98
compiler/test/utForPartialUpdate/logicMethod/staticCode.ts
Normal file
98
compiler/test/utForPartialUpdate/logicMethod/staticCode.ts
Normal file
@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
exports.source = `
|
||||
@Entry
|
||||
@Component
|
||||
struct Index {
|
||||
@State message: string = 'Hello World';
|
||||
static message1 = 'Hello World';
|
||||
static message2 = 'Hello World';
|
||||
static {
|
||||
this.message2 = 'Hi World';
|
||||
}
|
||||
build() {
|
||||
RelativeContainer() {
|
||||
Text(this.message)
|
||||
}
|
||||
.height('100%')
|
||||
.width('100%')
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
exports.expectResult =
|
||||
`"use strict";
|
||||
var _a;
|
||||
if (!("finalizeConstruction" in ViewPU.prototype)) {
|
||||
Reflect.set(ViewPU.prototype, "finalizeConstruction", () => { });
|
||||
}
|
||||
class Index extends ViewPU {
|
||||
constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined, extraInfo) {
|
||||
super(parent, __localStorage, elmtId, extraInfo);
|
||||
if (typeof paramsLambda === "function") {
|
||||
this.paramsGenerator_ = paramsLambda;
|
||||
}
|
||||
this.__message = new ObservedPropertySimplePU('Hello World', this, "message");
|
||||
this.setInitiallyProvidedValue(params);
|
||||
this.finalizeConstruction();
|
||||
}
|
||||
setInitiallyProvidedValue(params) {
|
||||
if (params.message !== undefined) {
|
||||
this.message = params.message;
|
||||
}
|
||||
}
|
||||
updateStateVars(params) {
|
||||
}
|
||||
purgeVariableDependenciesOnElmtId(rmElmtId) {
|
||||
this.__message.purgeDependencyOnElmtId(rmElmtId);
|
||||
}
|
||||
aboutToBeDeleted() {
|
||||
this.__message.aboutToBeDeleted();
|
||||
SubscriberManager.Get().delete(this.id__());
|
||||
this.aboutToBeDeletedInternal();
|
||||
}
|
||||
get message() {
|
||||
return this.__message.get();
|
||||
}
|
||||
set message(newValue) {
|
||||
this.__message.set(newValue);
|
||||
}
|
||||
initialRender() {
|
||||
this.observeComponentCreation2((elmtId, isInitialRender) => {
|
||||
RelativeContainer.create();
|
||||
RelativeContainer.height('100%');
|
||||
RelativeContainer.width('100%');
|
||||
}, RelativeContainer);
|
||||
this.observeComponentCreation2((elmtId, isInitialRender) => {
|
||||
Text.create(this.message);
|
||||
}, Text);
|
||||
Text.pop();
|
||||
RelativeContainer.pop();
|
||||
}
|
||||
rerender() {
|
||||
this.updateDirtyElements();
|
||||
}
|
||||
}
|
||||
_a = Index;
|
||||
Index.message1 = 'Hello World';
|
||||
Index.message2 = 'Hello World';
|
||||
(() => {
|
||||
_a.message2 = 'Hi World';
|
||||
})();
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(ViewStackProcessor.AllocateNewElmetIdForNextComponent());
|
||||
loadDocument(new Index(undefined, {}));
|
||||
ViewStackProcessor.StopGetAccessRecording();
|
||||
`;
|
Loading…
Reference in New Issue
Block a user