Skip to content

Commit

Permalink
properly enum values to coerceInt64 while parsing nodeset2.xml files
Browse files Browse the repository at this point in the history
  • Loading branch information
erossignon committed Jul 15, 2023
1 parent 8318259 commit 1a06642
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Expand Up @@ -2,7 +2,7 @@
* @module node-opcua-address-space
*/
import { assert } from "node-opcua-assert";
import { Int64 } from "node-opcua-basic-types";
import { Int64, coerceInt64 } from "node-opcua-basic-types";
import { coerceLocalizedText } from "node-opcua-data-model";
import { EnumValueType } from "node-opcua-types";
import { EnumValueTypeOptionsLike } from "../address_space_ts";
Expand All @@ -15,17 +15,17 @@ export function coerceEnumValues(enumValues: EnumValueTypeOptionsLike[] | { [key
assert(Object.prototype.hasOwnProperty.call(en, "displayName"));
return new EnumValueType({
displayName: coerceLocalizedText(en.displayName),
value: en.value
value: coerceInt64(en.value)
});
});
} else {
return coerceEnumValues(
Object.entries(enumValues as { [key: string]: Int64 }).map((entrie: [string, Int64]) => {
const [key, value] = entrie;
Object.entries(enumValues as { [key: string]: Int64 }).map((entry: [string, Int64]) => {
const [key, value] = entry;
return new EnumValueType({
description: coerceLocalizedText(key),
displayName: coerceLocalizedText(key),
value
value: coerceInt64(value)
});
})
);
Expand Down
Expand Up @@ -648,7 +648,7 @@ function makeNodeSetParserEngine(addressSpace: IAddressSpace, options: NodeSetLo
Value: {
finish(this: any) {
// Low part
this.parent.enumValueType.value[1] = parseInt(this.text, 10);
this.parent.enumValueType.value = coerceInt64(parseInt(this.text, 10));
}
},

Expand Down

0 comments on commit 1a06642

Please sign in to comment.